31 lines
623 B
TypeScript
31 lines
623 B
TypeScript
"use server";
|
|
import { Prisma, prisma } from "@repo/db";
|
|
|
|
export const addPenalty = async (
|
|
data: Prisma.Without<Prisma.PenaltyCreateInput, Prisma.PenaltyUncheckedCreateInput> &
|
|
Prisma.PenaltyUncheckedCreateInput,
|
|
) => {
|
|
return await prisma.penalty.create({
|
|
data,
|
|
});
|
|
};
|
|
|
|
export const editPenalty = async (id: number, data: Prisma.PenaltyUpdateInput) => {
|
|
return await prisma.penalty.update({
|
|
where: {
|
|
id: id,
|
|
},
|
|
data,
|
|
});
|
|
};
|
|
|
|
export const editPenaltys = async (
|
|
data: Prisma.PenaltyUpdateInput,
|
|
where: Prisma.PenaltyWhereInput,
|
|
) => {
|
|
return await prisma.penalty.updateMany({
|
|
where,
|
|
data,
|
|
});
|
|
};
|