Skip to content

Commit fd8b571

Browse files
committed
Fix bug in addNewRole
switch on wrong field forgot `break` didn't capitalize query field
1 parent eebe820 commit fd8b571

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rolesOps.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ export async function addNewRole<T extends IRole>(
6363
) {
6464
// This function is triggered when a user changes their role, it adds the new role to the user
6565
let role;
66-
switch (model.constructor) {
67-
case classModel:
66+
switch (model.modelName) {
67+
case "class":
6868
//TODO: Rewrite IRole to include name, and replace CODE with name
6969
role = await model.findOne({ CODE: id });
70+
break;
7071
default:
71-
role = await model.findOne({ Name: id });
72+
role = await model.findOne({ NAME: id });
7273
}
7374

7475
if (role === null) {

0 commit comments

Comments
 (0)