feat: CSV exports, PDF improvements, play internal/external with hour split, roles cleanup, admin companies with 'Cliente avulso', ticket list spacing/alignment fixes, status translations and mappings
This commit is contained in:
parent
addd4ce6e8
commit
3bafcc5a0a
45 changed files with 1401 additions and 256 deletions
|
|
@ -4,7 +4,6 @@ import type { Id } from "./_generated/dataModel"
|
|||
import type { MutationCtx, QueryCtx } from "./_generated/server"
|
||||
|
||||
const STAFF_ROLES = new Set(["ADMIN", "MANAGER", "AGENT", "COLLABORATOR"])
|
||||
const CUSTOMER_ROLE = "CUSTOMER"
|
||||
const MANAGER_ROLE = "MANAGER"
|
||||
|
||||
type Ctx = QueryCtx | MutationCtx
|
||||
|
|
@ -45,13 +44,7 @@ export async function requireAdmin(ctx: Ctx, userId: Id<"users">, tenantId?: str
|
|||
return result
|
||||
}
|
||||
|
||||
export async function requireCustomer(ctx: Ctx, userId: Id<"users">, tenantId?: string) {
|
||||
const result = await requireUser(ctx, userId, tenantId)
|
||||
if (result.role !== CUSTOMER_ROLE) {
|
||||
throw new ConvexError("Acesso restrito ao portal do cliente")
|
||||
}
|
||||
return result
|
||||
}
|
||||
// removed customer role; use requireCompanyManager or requireStaff as appropriate
|
||||
|
||||
export async function requireCompanyManager(ctx: Ctx, userId: Id<"users">, tenantId?: string) {
|
||||
const result = await requireUser(ctx, userId, tenantId)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue