Replace typo in function name (ensureUserExist -> ensureUserExists)

This commit is contained in:
Konstantin Wohlwend 2024-10-13 13:01:24 -07:00
parent e33afeaedc
commit f7e56a8f34
3 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
import { ensureTeamExist, ensureTeamMembershipExists, ensureUserExist, ensureUserTeamPermissionExists } from "@/lib/request-checks";
import { ensureTeamExist, ensureTeamMembershipExists, ensureUserExists, ensureUserTeamPermissionExists } from "@/lib/request-checks";
import { prismaClient } from "@/prisma-client";
import { createCrudHandlers } from "@/route-handlers/crud-handler";
import { Prisma } from "@prisma/client";
@ -60,7 +60,7 @@ export const teamMemberProfilesCrudHandlers = createLazyProxy(() => createCrudHa
await ensureTeamExist(tx, { projectId: auth.project.id, teamId: query.team_id });
}
if (query.user_id) {
await ensureUserExist(tx, { projectId: auth.project.id, userId: query.user_id });
await ensureUserExists(tx, { projectId: auth.project.id, userId: query.user_id });
}
}

View File

@ -1,4 +1,4 @@
import { ensureTeamMembershipExists, ensureUserExist } from "@/lib/request-checks";
import { ensureTeamMembershipExists, ensureUserExists } from "@/lib/request-checks";
import { PrismaTransaction } from "@/lib/types";
import { sendTeamMembershipDeletedWebhook, sendUserCreatedWebhook, sendUserDeletedWebhook, sendUserUpdatedWebhook } from "@/lib/webhooks";
import { prismaClient } from "@/prisma-client";
@ -481,7 +481,7 @@ export const usersCrudHandlers = createLazyProxy(() => createCrudHandlers(usersC
},
onUpdate: async ({ auth, data, params }) => {
const result = await prismaClient.$transaction(async (tx) => {
await ensureUserExist(tx, { projectId: auth.project.id, userId: params.user_id });
await ensureUserExists(tx, { projectId: auth.project.id, userId: params.user_id });
if (data.selected_team_id !== undefined) {
if (data.selected_team_id !== null) {
@ -768,7 +768,7 @@ export const usersCrudHandlers = createLazyProxy(() => createCrudHandlers(usersC
},
onDelete: async ({ auth, params }) => {
const { teams } = await prismaClient.$transaction(async (tx) => {
await ensureUserExist(tx, { projectId: auth.project.id, userId: params.user_id });
await ensureUserExists(tx, { projectId: auth.project.id, userId: params.user_id });
const teams = await tx.team.findMany({
where: {

View File

@ -33,7 +33,7 @@ export async function ensureTeamMembershipExists(
userId: string,
}
) {
await ensureUserExist(tx, { projectId: options.projectId, userId: options.userId });
await ensureUserExists(tx, { projectId: options.projectId, userId: options.userId });
const member = await _getTeamMembership(tx, options);
@ -112,7 +112,7 @@ export async function ensureUserTeamPermissionExists(
}
}
export async function ensureUserExist(
export async function ensureUserExists(
tx: PrismaTransaction,
options: {
projectId: string,
@ -149,4 +149,4 @@ export function ensureStandardProvider(
throw new KnownErrors.InvalidStandardOAuthProviderId(providerId);
}
return providerId as any;
}
}