Skip to content

Commit 8a6c796

Browse files
Merge pull request #56 from uwblueprint/INTS25_reviewed_applications
[INTS25] Create Reviewed Applicant Record table + migration files
2 parents 39e7a24 + 4300db4 commit 8a6c796

File tree

7 files changed

+433
-0
lines changed

7 files changed

+433
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import { DataType } from "sequelize-typescript";
2+
3+
import { Migration } from "../umzug";
4+
5+
const TABLE_NAME = "applicants";
6+
7+
// const SEEDED_DATA = [
8+
// {
9+
// id: "123",
10+
// academicOrCoop: "Academic",
11+
// academicYear: "2024",
12+
// email: "jj2huang@uwaterloo.ca",
13+
// firstName: "Jesse",
14+
// lastName: "Huang",
15+
// heardFrom: "LinkedIn",
16+
// locationPreference: "Waterloo",
17+
// program: "Computer Science",
18+
// pronouns: "he/him",
19+
// resumeUrl:
20+
// "https://www.youtube.com/watch?v=xvFZjo5PgG0&list=RDxvFZjo5PgG0&start_radio=1",
21+
// timesApplied: 1,
22+
// shortAnswerQuestions: ["hi", "bye"],
23+
// term: "S25",
24+
// submittedAt: "2025-06-21T07:02:40.000Z",
25+
// createdAt: new Date(),
26+
// updatedAt: new Date(),
27+
// },
28+
// ];
29+
30+
export const up: Migration = async ({ context: sequelize }) => {
31+
await sequelize.getQueryInterface().createTable(TABLE_NAME, {
32+
id: {
33+
type: DataType.STRING,
34+
allowNull: false,
35+
primaryKey: true,
36+
},
37+
academicOrCoop: {
38+
type: DataType.STRING,
39+
allowNull: false,
40+
},
41+
academicYear: {
42+
type: DataType.STRING,
43+
allowNull: false,
44+
},
45+
email: {
46+
type: DataType.STRING,
47+
allowNull: false,
48+
},
49+
firstName: {
50+
type: DataType.STRING,
51+
allowNull: false,
52+
},
53+
lastName: {
54+
type: DataType.STRING,
55+
allowNull: false,
56+
},
57+
heardFrom: {
58+
type: DataType.STRING,
59+
allowNull: false,
60+
},
61+
locationPreference: {
62+
type: DataType.STRING,
63+
allowNull: false,
64+
},
65+
program: {
66+
type: DataType.STRING,
67+
allowNull: false,
68+
},
69+
pronouns: {
70+
type: DataType.STRING,
71+
allowNull: false,
72+
},
73+
resumeUrl: {
74+
type: DataType.STRING,
75+
allowNull: true,
76+
},
77+
timesApplied: {
78+
type: DataType.INTEGER,
79+
allowNull: false,
80+
},
81+
shortAnswerQuestions: {
82+
type: DataType.ARRAY(DataType.STRING),
83+
allowNull: true,
84+
},
85+
term: {
86+
type: DataType.STRING,
87+
allowNull: false,
88+
},
89+
submittedAt: {
90+
type: DataType.DATE,
91+
allowNull: false,
92+
},
93+
createdAt: {
94+
type: DataType.DATE,
95+
allowNull: false,
96+
},
97+
updatedAt: {
98+
type: DataType.DATE,
99+
allowNull: false,
100+
},
101+
});
102+
};
103+
104+
export const down: Migration = async ({ context: sequelize }) => {
105+
await sequelize.getQueryInterface().dropTable(TABLE_NAME);
106+
};
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { DataType } from "sequelize-typescript";
2+
import { Migration } from "../umzug";
3+
import { PositionTitles } from "../types";
4+
5+
const TABLE_NAME = "applicant_records"; // Changed table name to differentiate from applicantresponse
6+
7+
// const SEEDED_DATA = [
8+
// {
9+
// id: "1",
10+
// applicationtId: "123",
11+
// // role: "developer",
12+
// roleSpecificQuestions: ["i like monke"],
13+
// choice: 1,
14+
// status: "Applied",
15+
// skillCategory: "junior",
16+
// createdAt: new Date(),
17+
// updatedAt: new Date(),
18+
// },
19+
// ];
20+
21+
export const up: Migration = async ({ context: sequelize }) => {
22+
await sequelize.getQueryInterface().createTable(TABLE_NAME, {
23+
id: {
24+
type: DataType.STRING,
25+
allowNull: false,
26+
primaryKey: true,
27+
},
28+
applicantId: {
29+
type: DataType.STRING,
30+
allowNull: false,
31+
references: {
32+
model: "applicants",
33+
key: "id",
34+
},
35+
},
36+
position: {
37+
type: DataType.ENUM(...PositionTitles),
38+
allowNull: true,
39+
references: {
40+
model: "positions",
41+
key: "title",
42+
},
43+
},
44+
roleSpecificQuestions: {
45+
type: DataType.ARRAY(DataType.STRING),
46+
allowNull: true,
47+
},
48+
choice: {
49+
type: DataType.INTEGER,
50+
allowNull: false,
51+
},
52+
status: {
53+
type: DataType.STRING,
54+
allowNull: false,
55+
},
56+
skillCategory: {
57+
type: DataType.STRING,
58+
allowNull: true,
59+
},
60+
selectedForInterview: {
61+
type: DataType.BOOLEAN,
62+
allowNull: false,
63+
defaultValue: false,
64+
},
65+
extraInfo: {
66+
type: DataType.JSONB,
67+
allowNull: true,
68+
},
69+
});
70+
};
71+
72+
export const down: Migration = async ({ context: sequelize }) => {
73+
await sequelize.getQueryInterface().dropTable(TABLE_NAME);
74+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { DataType } from "sequelize-typescript";
2+
import { Migration } from "../umzug";
3+
import { ReviewStatusEnum } from "../types";
4+
5+
const TABLE_NAME = "reviewed_applicant_records";
6+
7+
export const up: Migration = async ({ context: sequelize }) => {
8+
await sequelize.getQueryInterface().createTable(TABLE_NAME, {
9+
applicantRecordId: {
10+
type: DataType.STRING,
11+
allowNull: false,
12+
references: {
13+
model: "applicant_records",
14+
key: "id",
15+
},
16+
primaryKey: true,
17+
},
18+
reviewerId: {
19+
type: DataType.INTEGER,
20+
allowNull: false,
21+
references: {
22+
model: "users",
23+
key: "id",
24+
},
25+
primaryKey: true,
26+
},
27+
review: {
28+
type: DataType.JSONB,
29+
allowNull: true,
30+
},
31+
status: {
32+
type: DataType.STRING,
33+
allowNull: false,
34+
defaultValue: ReviewStatusEnum.TODO,
35+
},
36+
});
37+
};
38+
39+
export const down: Migration = async ({ context: sequelize }) => {
40+
await sequelize.getQueryInterface().dropTable(TABLE_NAME);
41+
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/* eslint import/no-cycle: 0 */
2+
3+
import { Column, DataType, Model, Table } from "sequelize-typescript";
4+
5+
@Table({ tableName: "applicantresponse" })
6+
export default class Applicant extends Model {
7+
@Column({
8+
type: DataType.INTEGER,
9+
primaryKey: true,
10+
unique: true,
11+
autoIncrement: true,
12+
})
13+
id!: string;
14+
15+
@Column({ type: DataType.STRING })
16+
academicOrCoop!: string;
17+
18+
@Column({ type: DataType.STRING })
19+
academicYear!: string;
20+
21+
@Column({ type: DataType.STRING })
22+
email!: string;
23+
24+
@Column({ type: DataType.STRING })
25+
firstName!: string;
26+
27+
@Column({ type: DataType.STRING })
28+
lastName!: string;
29+
30+
@Column({ type: DataType.STRING })
31+
heardFrom!: string;
32+
33+
@Column({ type: DataType.STRING })
34+
locationPreference!: string;
35+
36+
@Column({ type: DataType.STRING })
37+
program!: string;
38+
39+
@Column({ type: DataType.STRING })
40+
pronouns!: string;
41+
42+
@Column({ type: DataType.STRING })
43+
resumeUrl!: string;
44+
45+
@Column({ type: DataType.INTEGER })
46+
timesApplied!: number;
47+
48+
@Column({ type: DataType.ARRAY(DataType.STRING) })
49+
shortAnswerQuestions!: string[];
50+
51+
@Column({ type: DataType.STRING })
52+
term!: string;
53+
54+
@Column({ type: DataType.DATE })
55+
submittedAt!: Date;
56+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/* eslint import/no-cycle: 0 */
2+
3+
import {
4+
Column,
5+
DataType,
6+
ForeignKey,
7+
Model,
8+
Table,
9+
} from "sequelize-typescript";
10+
import {
11+
ApplicantRecordExtraInfo,
12+
ApplicationStatus,
13+
SkillCategory,
14+
} from "../types";
15+
import Applicant from "./applicant.model";
16+
import Position from "./position.model";
17+
18+
@Table({ tableName: "applicantresponse" })
19+
export default class ApplicantRecord extends Model {
20+
@Column({
21+
type: DataType.INTEGER,
22+
primaryKey: true,
23+
unique: true,
24+
autoIncrement: true,
25+
})
26+
id!: string;
27+
28+
@ForeignKey(() => Applicant)
29+
@Column({ type: DataType.STRING })
30+
applicantId!: string;
31+
32+
@ForeignKey(() => Position)
33+
@Column({ type: DataType.STRING })
34+
role!: string;
35+
36+
@Column({ type: DataType.ARRAY(DataType.STRING) })
37+
roleSpecificQuestions!: string[];
38+
39+
@Column({ type: DataType.INTEGER })
40+
choice!: number;
41+
42+
@Column({ type: DataType.STRING })
43+
status!: ApplicationStatus;
44+
45+
@Column({ type: DataType.STRING, allowNull: true })
46+
skillCategory!: SkillCategory;
47+
48+
@Column({ type: DataType.BOOLEAN })
49+
selectedForInterview!: boolean;
50+
51+
@Column({ type: DataType.JSONB, allowNull: true })
52+
extraInfo!: ApplicantRecordExtraInfo;
53+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* eslint import/no-cycle: 0 */
2+
3+
import {
4+
Column,
5+
DataType,
6+
ForeignKey,
7+
Model,
8+
Table,
9+
} from "sequelize-typescript";
10+
import User from "./user.model";
11+
import { Review, ReviewStatus, ReviewStatusEnum } from "../types";
12+
import ApplicantRecord from "./applicantRecord.model";
13+
14+
@Table({ tableName: "reviewed_applicant_records" })
15+
export default class ReviewedApplicantRecord extends Model {
16+
@ForeignKey(() => ApplicantRecord)
17+
@Column({ type: DataType.STRING, primaryKey: true })
18+
applicantRecordId!: number;
19+
20+
@ForeignKey(() => User)
21+
@Column({ type: DataType.INTEGER, primaryKey: true })
22+
reviewerId!: number;
23+
24+
@Column({ type: DataType.JSONB })
25+
review!: Review;
26+
27+
@Column({
28+
type: DataType.STRING,
29+
defaultValue: ReviewStatusEnum.TODO,
30+
})
31+
status!: ReviewStatus;
32+
}

0 commit comments

Comments
 (0)