Skip to content

Commit

Permalink
Fix bug in addNewRole
Browse files Browse the repository at this point in the history
switch on wrong field
forgot `break`
didn't capitalize query field
  • Loading branch information
schiltz3 committed Sep 6, 2022
1 parent eebe820 commit fd8b571
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rolesOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ export async function addNewRole<T extends IRole>(
) {
// This function is triggered when a user changes their role, it adds the new role to the user
let role;
switch (model.constructor) {
case classModel:
switch (model.modelName) {
case "class":
//TODO: Rewrite IRole to include name, and replace CODE with name
role = await model.findOne({ CODE: id });
break;
default:
role = await model.findOne({ Name: id });
role = await model.findOne({ NAME: id });
}

if (role === null) {
Expand Down

0 comments on commit fd8b571

Please sign in to comment.