Skip to content

Commit 68299fa

Browse files
author
Maggie Chen
committed
add migration file and adjust models
1 parent ea91602 commit 68299fa

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { Column, DataType, Model, Table } from "sequelize-typescript";
2-
import { Department, PositionTitle, PositionTitles } from "../types";
32

43
@Table({ tableName: "positions" })
54
export default class Position extends Model {
6-
@Column({ type: DataType.ENUM(...PositionTitles), primaryKey: true })
7-
title!: PositionTitle;
5+
@Column({ type: DataType.STRING, primaryKey: true })
6+
title!: string;
87

9-
@Column({ type: DataType.ENUM(...Object.values(Department)) })
10-
department!: Department;
8+
@Column({ type: DataType.STRING })
9+
department!: string;
1110
}

backend/typescript/models/user.model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
Table,
1010
} from "sequelize-typescript";
1111
import { NonAttribute } from "sequelize";
12-
import { PositionTitle, PositionTitles, Role } from "../types";
12+
import { Role } from "../types";
1313
import Position from "./position.model";
1414
import ReviewedApplicantRecord from "./reviewedApplicantRecord.model";
1515

@@ -34,8 +34,8 @@ export default class User extends Model {
3434
role!: Role;
3535

3636
@ForeignKey(() => Position)
37-
@Column({ type: DataType.ENUM(...Object.values(PositionTitles)) })
38-
position?: PositionTitle;
37+
@Column({ type: DataType.STRING })
38+
position?: string;
3939

4040
@HasMany(() => ReviewedApplicantRecord, {
4141
foreignKey: "reviewerId",

0 commit comments

Comments
 (0)