Skip to content

Commit efc4b37

Browse files
added positions references
1 parent 75a4691 commit efc4b37

File tree

5 files changed

+64
-63
lines changed

5 files changed

+64
-63
lines changed

backend/typescript/migrations/2025.06.21T07.02.40.create-applicants.ts

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@ import { Migration } from "../umzug";
44

55
const TABLE_NAME = "applicants";
66

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-
];
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+
// ];
2929

3030
export const up: Migration = async ({ context: sequelize }) => {
3131
await sequelize.getQueryInterface().createTable(TABLE_NAME, {
@@ -99,7 +99,6 @@ export const up: Migration = async ({ context: sequelize }) => {
9999
allowNull: false,
100100
},
101101
});
102-
await sequelize.getQueryInterface().bulkInsert(TABLE_NAME, SEEDED_DATA);
103102
};
104103

105104
export const down: Migration = async ({ context: sequelize }) => {

backend/typescript/migrations/2025.06.21T15.30.15.create-applicant-record.ts

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
import { DataType } from "sequelize-typescript";
22
import { Migration } from "../umzug";
3+
import { PositionTitles } from "../types";
34

45
const TABLE_NAME = "applicant_records"; // Changed table name to differentiate from applicantresponse
56

6-
const SEEDED_DATA = [
7-
{
8-
id: "1",
9-
applicationtId: "123",
10-
// role: "developer",
11-
roleSpecificQuestions: ["i like monke"],
12-
choice: 1,
13-
status: "Applied",
14-
skillCategory: "junior",
15-
createdAt: new Date(),
16-
updatedAt: new Date(),
17-
},
18-
];
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+
// ];
1920

2021
export const up: Migration = async ({ context: sequelize }) => {
2122
await sequelize.getQueryInterface().createTable(TABLE_NAME, {
@@ -32,15 +33,14 @@ export const up: Migration = async ({ context: sequelize }) => {
3233
key: "id",
3334
},
3435
},
35-
// ADD IN ONCE CAROLYNS THING IS ADDED
36-
// role: {
37-
// type: DataType.STRING,
38-
// allowNull: true,
39-
// references: {
40-
// model: "roles",
41-
// key: "id",
42-
// },
43-
// },
36+
position: {
37+
type: DataType.ENUM(...PositionTitles),
38+
allowNull: true,
39+
references: {
40+
model: "positions",
41+
key: "title",
42+
},
43+
},
4444
roleSpecificQuestions: {
4545
type: DataType.ARRAY(DataType.STRING),
4646
allowNull: true,
@@ -57,16 +57,11 @@ export const up: Migration = async ({ context: sequelize }) => {
5757
type: DataType.STRING,
5858
allowNull: true,
5959
},
60-
createdAt: {
61-
type: DataType.DATE,
62-
allowNull: false,
63-
},
64-
updatedAt: {
65-
type: DataType.DATE,
66-
allowNull: false,
60+
extraInfo: {
61+
type: DataType.JSONB,
62+
allowNull: true,
6763
},
6864
});
69-
await sequelize.getQueryInterface().bulkInsert(TABLE_NAME, SEEDED_DATA);
7065
};
7166

7267
export const down: Migration = async ({ context: sequelize }) => {

backend/typescript/models/applicant.model.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
/* eslint import/no-cycle: 0 */
22

3-
import { Column, DataType, HasMany, Model, Table } from "sequelize-typescript";
4-
import { DataTypes } from "sequelize";
5-
import ApplicationDashboardTable from "./applicationDashboard.model";
6-
import { StatusType, SecondChoiceStatusType } from "../types";
3+
import { Column, DataType, Model, Table } from "sequelize-typescript";
74

85
@Table({ tableName: "applicantresponse" })
96
export default class Applicant extends Model {

backend/typescript/models/applicantRecord.model.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import {
77
Model,
88
Table,
99
} from "sequelize-typescript";
10-
import { DataTypes } from "sequelize";
11-
import ApplicationDashboardTable from "./applicationDashboard.model";
12-
import { ApplicationStatus, SkillCategory } from "../types";
10+
import {
11+
ApplicantRecordExtraInfo,
12+
ApplicationStatus,
13+
SkillCategory,
14+
} from "../types";
1315
import Applicant from "./applicant.model";
16+
import Position from "./position.model";
1417

1518
@Table({ tableName: "applicantresponse" })
1619
export default class ApplicantRecord extends Model {
@@ -21,9 +24,9 @@ export default class ApplicantRecord extends Model {
2124
@Column({ type: DataType.STRING })
2225
applicantId!: string;
2326

24-
// @ForeignKey(() => Role)
25-
// @Column({ type: DataType.STRING })
26-
// role!: string;
27+
@ForeignKey(() => Position)
28+
@Column({ type: DataType.STRING })
29+
role!: string;
2730

2831
@Column({ type: DataType.ARRAY(DataType.STRING) })
2932
roleSpecificQuestions!: string[];
@@ -36,4 +39,7 @@ export default class ApplicantRecord extends Model {
3639

3740
@Column({ type: DataType.STRING, allowNull: true })
3841
skillCategory!: SkillCategory;
42+
43+
@Column({ type: DataType.JSONB, allowNull: true })
44+
extraInfo!: ApplicantRecordExtraInfo;
3945
}

backend/typescript/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ export type ApplicationStatus =
116116

117117
export type SkillCategory = "Junior" | "Intermediate" | "Senior";
118118

119+
export type ApplicantRecordExtraInfo = {
120+
adminReview?: string;
121+
};
122+
119123
export type ApplicationDashboardRowDTO = {
120124
application: ApplicationDTO;
121125
reviewDashboards: ApplicationDashboardDTO[];

0 commit comments

Comments
 (0)