diff --git a/backend/typescript/migrations/20260210000000-create-interviewed-applicant-records-table.ts b/backend/typescript/migrations/20260210000000-create-interviewed-applicant-records-table.ts new file mode 100644 index 0000000..9f376d7 --- /dev/null +++ b/backend/typescript/migrations/20260210000000-create-interviewed-applicant-records-table.ts @@ -0,0 +1,66 @@ +import { DataTypes } from "sequelize"; +import { Migration } from "../umzug"; + +const TABLE_NAME = "interviewed_applicant_records"; + +export const up: Migration = async ({ context: sequelize }) => { + await sequelize.getQueryInterface().createTable(TABLE_NAME, { + id: { + type: DataTypes.UUID, + defaultValue: DataTypes.UUIDV4, + allowNull: false, + primaryKey: true, + }, + applicantRecordId: { + type: DataTypes.STRING, + allowNull: false, + unique: true, + references: { + model: "applicant_records", + key: "id", + }, + }, + score: { + type: DataTypes.INTEGER, + allowNull: true, + }, + interviewJson: { + type: DataTypes.JSONB, + allowNull: true, + }, + status: { + type: DataTypes.STRING, + allowNull: false, + }, + interviewNotesId: { + type: DataTypes.UUID, + allowNull: true, + references: { + model: "firebase_files", + key: "id", + }, + }, + schedulingLink: { + type: DataTypes.STRING, + allowNull: true, + }, + interviewDate: { + type: DataTypes.DATE, + allowNull: true, + }, + createdAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: DataTypes.NOW, + }, + updatedAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: DataTypes.NOW, + }, + }); +}; + +export const down: Migration = async ({ context: sequelize }) => { + await sequelize.getQueryInterface().dropTable(TABLE_NAME); +}; diff --git a/backend/typescript/models/interviewedApplicantRecord.model.ts b/backend/typescript/models/interviewedApplicantRecord.model.ts new file mode 100644 index 0000000..03caf6a --- /dev/null +++ b/backend/typescript/models/interviewedApplicantRecord.model.ts @@ -0,0 +1,79 @@ +import { + Column, + DataType, + ForeignKey, + Model, + Table, +} from "sequelize-typescript"; +import { Interview, InterviewStatus } from "../types"; +import ApplicantRecord from "./applicantRecord.model"; +import File from "./file.model"; + +@Table({ tableName: "interviewed_applicant_records" }) +export default class InterviewedApplicantRecord extends Model { + @Column({ + type: DataType.UUID, + defaultValue: DataType.UUIDV4, + primaryKey: true, + }) + id!: string; + + @ForeignKey(() => ApplicantRecord) + @Column({ + type: DataType.STRING, + allowNull: false, + unique: true, + }) + applicantRecordId!: string; + + @Column({ + type: DataType.INTEGER, + allowNull: true, + }) + score!: number | null; + + @Column({ + type: DataType.JSONB, + allowNull: true, + }) + interviewJson!: Interview | null; + + @Column({ + type: DataType.STRING, + allowNull: false, + }) + status!: InterviewStatus; + + @ForeignKey(() => File) + @Column({ + type: DataType.UUID, + allowNull: true, + }) + interviewNotesId!: string | null; + + @Column({ + type: DataType.STRING, + allowNull: true, + }) + schedulingLink!: string | null; + + @Column({ + type: DataType.DATE, + allowNull: true, + }) + interviewDate!: Date | null; + + @Column({ + type: DataType.DATE, + allowNull: false, + defaultValue: DataType.NOW, + }) + createdAt!: Date; + + @Column({ + type: DataType.DATE, + allowNull: false, + defaultValue: DataType.NOW, + }) + updatedAt!: Date; +} diff --git a/backend/typescript/types.ts b/backend/typescript/types.ts index a5a4964..8da4693 100644 --- a/backend/typescript/types.ts +++ b/backend/typescript/types.ts @@ -99,6 +99,17 @@ export type ApplicationStatus = export type SkillCategory = "Junior" | "Intermediate" | "Senior"; +export type Interview = { + passionFSG?: number; + teamPlayer?: number; + desireToLearn?: number; + skill?: number; + skillCategory?: SkillCategory; + comments?: string; +}; + +export type InterviewStatus = "NeedsReview" | "InProgress" | "Complete"; + export type ApplicantRecordExtraInfo = { adminReview?: string; }; @@ -222,6 +233,17 @@ export type DeleteReviewedApplicantRecordDTO = { reviewerId: number; }; +export type InterviewedApplicantRecordDTO = { + id: string; + applicantRecordId: string; + score: number | null; + interviewJson: Interview | null; + status: InterviewStatus; + interviewNotesId: string | null; + schedulingLink: string | null; + interviewDate: Date | null; +}; + export type ReviewDetails = { reviewerFirstName: string; reviewerLastName: string;