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) {
|
if (!ensuredAssignedUserId && context.persona && context.assignedUserEmail) {
|
||||||
try {
|
try {
|
||||||
const ensureArgs: Record<string, unknown> = {
|
const ensuredUser = (await client.mutation(api.users.ensureUser, {
|
||||||
tenantId: context.tenantId ?? DEFAULT_TENANT_ID,
|
tenantId: context.tenantId ?? DEFAULT_TENANT_ID,
|
||||||
email: context.assignedUserEmail,
|
email: context.assignedUserEmail,
|
||||||
name: context.assignedUserName ?? context.assignedUserEmail,
|
name: context.assignedUserName ?? context.assignedUserEmail,
|
||||||
avatarUrl: undefined,
|
|
||||||
role: (context.assignedUserRole ?? context.persona ?? "collaborator").toUpperCase(),
|
role: (context.assignedUserRole ?? context.persona ?? "collaborator").toUpperCase(),
|
||||||
}
|
companyId: context.companyId ? (context.companyId as Id<"companies">) : undefined,
|
||||||
if (context.companyId) {
|
})) as {
|
||||||
ensureArgs.companyId = context.companyId as Id<"companies">
|
|
||||||
}
|
|
||||||
|
|
||||||
const ensuredUser = (await client.mutation(api.users.ensureUser, ensureArgs)) as {
|
|
||||||
_id?: Id<"users">
|
_id?: Id<"users">
|
||||||
name?: string | null
|
name?: string | null
|
||||||
role?: string | null
|
role?: string | null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue