feat: automações de tickets e testes de regressão
This commit is contained in:
parent
9f1a6a7401
commit
8ab510bfe9
18 changed files with 2221 additions and 20 deletions
|
|
@ -5,6 +5,7 @@ import type { MutationCtx, QueryCtx } from "./_generated/server"
|
|||
|
||||
const STAFF_ROLES = new Set(["ADMIN", "MANAGER", "AGENT"])
|
||||
const MANAGER_ROLE = "MANAGER"
|
||||
const INTERNAL_ROLES = new Set(["ADMIN", "AGENT"])
|
||||
|
||||
type Ctx = QueryCtx | MutationCtx
|
||||
|
||||
|
|
@ -44,6 +45,14 @@ export async function requireAdmin(ctx: Ctx, userId: Id<"users">, tenantId?: str
|
|||
return result
|
||||
}
|
||||
|
||||
export async function requireInternal(ctx: Ctx, userId: Id<"users">, tenantId?: string) {
|
||||
const result = await requireUser(ctx, userId, tenantId)
|
||||
if (!result.role || !INTERNAL_ROLES.has(result.role)) {
|
||||
throw new ConvexError("Acesso restrito a administradores e agentes")
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// removed customer role; use requireCompanyManager or requireStaff as appropriate
|
||||
|
||||
export async function requireCompanyManager(ctx: Ctx, userId: Id<"users">, tenantId?: string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue