Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Users table #49

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@ const SEEDED_DATA = [
last_name: "Doe",
email: "[email protected]",
auth_id: "bide",
role: "User",
permission: "Reviewers",
role: "Project Developer",
},
{
first_name: "Jane",
last_name: "Doe",
email: "[email protected]",
auth_id: "none",
role: "Admin",
permission: "Reviewers",
role: "Project Developer",
},
{
first_name: "UW",
last_name: "Blueprint",
email: "[email protected]",
auth_id: "1Z4wyuonu9MhAi4VoAEiTMVj1iT2",
role: "Admin",
permission: "Reviewers",
role: "Project Developer",
},
];
// [email protected]
Expand Down Expand Up @@ -55,8 +58,17 @@ 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(
"Co-President", "Director Lead", "Internal Director", "External Director",
"VP Engineering", "VP Design", "VP Product", "VP Project Scoping", "VP Finance & Operations", "VP Talent",
"Graphic Designer", "Marketing & Outreach Director", "Product Manager", "Project Lead", "Project Developer", "Product Designer"
),
allowNull: false,
},
createdAt: DataType.DATE,
Expand Down
13 changes: 11 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,16 @@ 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(
"Co-President", "Director Lead", "Internal Director", "External Director",
"VP Engineering", "VP Design", "VP Product", "VP Project Scoping", "VP Finance & Operations", "VP Talent",
"Graphic Designer", "Marketing & Outreach Director", "Product Manager", "Project Lead", "Project Developer", "Product Designer"
), allowNull: false
})
role!: Role;

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

export type Role = "Co-President" | "Director Lead" | "Internal Director" | "External Director" |
"VP Engineering" | "VP Design" | "VP Product" | "VP Project Scoping" | "VP Finance & Operations" | "VP Talent" |
"Graphic Designer" | "Marketing & Outreach Director" | "Product Manager" | "Project Lead" | "Project Developer" | "Product Designer";

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