Skip to content

Commit

Permalink
update migration
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-ng committed Mar 28, 2024
1 parent 07cbfd5 commit d80ee67
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@ const SEEDED_DATA = [
last_name: "Doe",
email: "johndoe@gmail.com",
auth_id: "bide",
role: "User",
permission: "Reviewers",
role: "Developer",
},
{
first_name: "Jane",
last_name: "Doe",
email: "janedoe@gmail.ca",
auth_id: "none",
role: "Admin",
permission: "Reviewers",
role: "Developer",
},
{
first_name: "UW",
last_name: "Blueprint",
email: "recruitmenttools@uwblueprint.org",
auth_id: "1Z4wyuonu9MhAi4VoAEiTMVj1iT2",
role: "Admin",
permission: "Reviewers",
role: "Developer",
},
];
// recruitmenttools@uwblueprint.org
Expand Down Expand Up @@ -55,8 +58,13 @@ export const up: Migration = async ({ context: sequelize }) => {
primaryKey: true,
allowNull: false,
},
permission: {
type: DataType.ENUM("VP Talent", "Eteam", "Engineering", "Product", "Design", "Reviewers"),
allowNull: false,
defaultValue: "Reviewers"
},
role: {
type: DataType.ENUM("User", "Admin"),
type: DataType.ENUM("Developer", "Designer"),
allowNull: false,
},
createdAt: DataType.DATE,
Expand Down

This file was deleted.

7 changes: 5 additions & 2 deletions backend/typescript/models/user.model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint import/no-cycle: 0 */

import { Column, DataType, HasMany, Model, Table } from "sequelize-typescript";
import { Role } from "../types";
import { Permission, Role } from "../types";
import ApplicationDashboardTable from "./applicationDashboard.model";

@Table({ tableName: "users" })
Expand All @@ -21,7 +21,10 @@ export default class User extends Model {
@Column({ type: DataType.INTEGER, primaryKey: true, autoIncrement: true })
id!: number;

@Column({ type: DataType.ENUM("User", "Admin") })
@Column({ type: DataType.ENUM("VP Talent", "Eteam", "Engineering", "Product", "Design", "Reviewers"), allowNull: false, defaultValue: 'Reviewers' })
permission!: Permission;

@Column({ type: DataType.ENUM("Developer, Designer"), allowNull: false })
role!: Role;

@HasMany(() => ApplicationDashboardTable)
Expand Down
4 changes: 3 additions & 1 deletion backend/typescript/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export type Role = "User" | "Admin";
export type Permission = "VP Talent" | "Eteam" | "Engineering" | "Product" | "Design" | "Reviewers";

export type Role = "Developer" | "Designer";

export enum StatusType {
ACCEPTED = "accepted",
Expand Down

0 comments on commit d80ee67

Please sign in to comment.