mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
44 lines
1009 B
TypeScript
44 lines
1009 B
TypeScript
import { Prisma, TeamUser } from '@prisma/client';
|
|
import prisma from 'lib/prisma';
|
|
|
|
export async function createTeamUser(
|
|
data: Prisma.TeamUserCreateInput | Prisma.TeamUserUncheckedCreateInput,
|
|
): Promise<TeamUser> {
|
|
return prisma.client.teamUser.create({
|
|
data,
|
|
});
|
|
}
|
|
|
|
export async function getTeamUser(where: Prisma.TeamUserWhereInput): Promise<TeamUser> {
|
|
return prisma.client.teamUser.findFirst({
|
|
where,
|
|
});
|
|
}
|
|
|
|
export async function getTeamUsers(where: Prisma.TeamUserWhereInput): Promise<TeamUser[]> {
|
|
return prisma.client.teamUser.findMany({
|
|
where,
|
|
});
|
|
}
|
|
|
|
export async function updateTeamUser(
|
|
data: Prisma.TeamUserUpdateInput,
|
|
where: Prisma.TeamUserWhereUniqueInput,
|
|
): Promise<TeamUser> {
|
|
return prisma.client.teamUser.update({
|
|
data,
|
|
where,
|
|
});
|
|
}
|
|
|
|
export async function deleteTeamUser(teamUserId: string): Promise<TeamUser> {
|
|
return prisma.client.teamUser.update({
|
|
data: {
|
|
isDeleted: true,
|
|
},
|
|
where: {
|
|
id: teamUserId,
|
|
},
|
|
});
|
|
}
|