Skip to content

Commit 7867d17

Browse files
Merge pull request #72 from uwblueprint/INTF25-update-db-with-scores-col
[INTF25] Update db with scores column
2 parents 76954ca + 95c103e commit 7867d17

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { DataType } from "sequelize-typescript";
2+
import { Migration } from "../umzug";
3+
4+
const REV_APP_TABLE = "reviewed_applicant_records";
5+
const APP_TABLE = "applicant_records";
6+
7+
export const up: Migration = async ({ context: sequelize }) => {
8+
await sequelize.getQueryInterface().addColumn(REV_APP_TABLE, "score", {
9+
type: DataType.INTEGER,
10+
allowNull: true,
11+
defaultValue: null,
12+
});
13+
14+
await sequelize.getQueryInterface().addColumn(APP_TABLE, "combined_score", {
15+
type: DataType.INTEGER,
16+
allowNull: true,
17+
defaultValue: null,
18+
});
19+
};
20+
21+
export const down: Migration = async ({ context: sequelize }) => {
22+
await sequelize
23+
.getQueryInterface()
24+
.removeColumn("reviewed_applicant_records", "score");
25+
26+
await sequelize
27+
.getQueryInterface()
28+
.removeColumn("applicant_records", "combined_score");
29+
};

backend/typescript/models/applicantRecord.model.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ export default class ApplicantRecord extends Model {
4848
@Column({ type: DataType.JSONB, allowNull: true })
4949
extraInfo!: ApplicantRecordExtraInfo;
5050

51+
@Column({
52+
type: DataType.INTEGER,
53+
allowNull: true,
54+
defaultValue: null,
55+
})
56+
combined_score!: number;
57+
5158
@Column({ type: DataType.BOOLEAN, defaultValue: false })
5259
isApplicantFlagged!: boolean;
5360
}

backend/typescript/models/reviewedApplicantRecord.model.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ export default class ReviewedApplicantRecord extends Model {
3030
})
3131
status!: ReviewStatus;
3232

33+
@Column({
34+
type: DataType.INTEGER,
35+
allowNull: true,
36+
defaultValue: null,
37+
})
38+
score!: number;
39+
3340
@Column({
3441
type: DataType.BOOLEAN,
3542
defaultValue: false,

backend/typescript/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export type ApplicantRecordDTO = {
104104
choice: number;
105105
status: ApplicationStatus;
106106
skillCategory?: SkillCategory;
107+
combined_score?: number | null;
107108
};
108109

109110
export type ApplicationStatus =
@@ -235,5 +236,6 @@ export type ReviewedApplicantRecordDTO = {
235236
reviewerId: number;
236237
review: Review;
237238
status: ReviewStatus;
239+
score?: number | null;
238240
reviewerHasConflict: boolean;
239241
};

0 commit comments

Comments
 (0)