added select form
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use server';
|
||||
|
||||
import { prisma, Prisma, Event } from '@repo/db';
|
||||
import { prisma, Prisma, Event, Participant } from '@repo/db';
|
||||
|
||||
export const upsertEvent = async (
|
||||
event: Prisma.EventCreateInput,
|
||||
@@ -18,3 +18,20 @@ export const upsertEvent = async (
|
||||
export const deleteEvent = async (id: Event['id']) => {
|
||||
await prisma.event.delete({ where: { id: id } });
|
||||
};
|
||||
|
||||
export const upsertParticipant = async (
|
||||
participant: Prisma.ParticipantCreateInput,
|
||||
id?: Participant['id']
|
||||
) => {
|
||||
const newParticipant = id
|
||||
? await prisma.participant.update({
|
||||
where: { id: id },
|
||||
data: participant,
|
||||
})
|
||||
: await prisma.participant.create({ data: participant });
|
||||
return newParticipant;
|
||||
};
|
||||
|
||||
export const deleteParticipant = async (id: Participant['id']) => {
|
||||
await prisma.participant.delete({ where: { id: id } });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user