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,4 +1,5 @@
import { Op, Transaction } from "sequelize";
import { UserRole } from "@shared/types";
import { Event, User } from "@server/models";
import { ValidationError } from "../errors";
@@ -29,7 +30,7 @@ export default async function userDestroyer({
if (user.isAdmin) {
const otherAdminsCount = await User.count({
where: {
isAdmin: true,
role: UserRole.Admin,
teamId,
id: {
[Op.ne]: user.id,