Tipa chamada ao ensureUser na sessão de máquina
This commit is contained in:
parent
11390a9d83
commit
6a9759e12f
1 changed files with 3 additions and 8 deletions
|
|
@ -95,18 +95,13 @@ export async function GET(request: NextRequest) {
|
|||
|
||||
if (!ensuredAssignedUserId && context.persona && context.assignedUserEmail) {
|
||||
try {
|
||||
const ensureArgs: Record<string, unknown> = {
|
||||
const ensuredUser = (await client.mutation(api.users.ensureUser, {
|
||||
tenantId: context.tenantId ?? DEFAULT_TENANT_ID,
|
||||
email: context.assignedUserEmail,
|
||||
name: context.assignedUserName ?? context.assignedUserEmail,
|
||||
avatarUrl: undefined,
|
||||
role: (context.assignedUserRole ?? context.persona ?? "collaborator").toUpperCase(),
|
||||
}
|
||||
if (context.companyId) {
|
||||
ensureArgs.companyId = context.companyId as Id<"companies">
|
||||
}
|
||||
|
||||
const ensuredUser = (await client.mutation(api.users.ensureUser, ensureArgs)) as {
|
||||
companyId: context.companyId ? (context.companyId as Id<"companies">) : undefined,
|
||||
})) as {
|
||||
_id?: Id<"users">
|
||||
name?: string | null
|
||||
role?: string | null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue