Convert isViewer and isAdmin to getters (#6724)

This commit is contained in:
Tom Moor
2024-03-28 17:00:35 -06:00
committed by GitHub
parent 278b81a8fb
commit 0dede0b56e
20 changed files with 113 additions and 139 deletions

View File

@@ -1,6 +1,6 @@
import Router from "koa-router";
import { Op, WhereOptions } from "sequelize";
import { UserPreference } from "@shared/types";
import { UserPreference, UserRole } from "@shared/types";
import { UserValidation } from "@shared/validations";
import userDemoter from "@server/commands/userDemoter";
import userDestroyer from "@server/commands/userDestroyer";
@@ -59,17 +59,17 @@ router.post(
}
case "viewers": {
where = { ...where, isViewer: true };
where = { ...where, role: UserRole.Viewer };
break;
}
case "admins": {
where = { ...where, isAdmin: true };
where = { ...where, role: UserRole.Admin };
break;
}
case "members": {
where = { ...where, isAdmin: false, isViewer: false };
where = { ...where, role: UserRole.Member };
break;
}