MCPcopy Create free account
hub / github.com/code100x/cms / addEvent

Function addEvent

src/actions/event-actions/index.ts:20–29  ·  view source on GitHub ↗
(
  event: Omit<Event, 'id' | 'createdAt' | 'updatedAt'>,
)

Source from the content-addressed store, hash-verified

18}
19
20export async function addEvent(
21 event: Omit<Event, 'id' | 'createdAt' | 'updatedAt'>,
22) {
23 if (!(await isAdmin())) {
24 return { error: 'Unauthorized' };
25 }
26
27 await prisma.event.create({ data: event });
28 revalidatePath('/');
29}
30
31export async function updateEvent(event: Event) {
32 if (!(await isAdmin())) {

Callers 1

handleAddEventFunction · 0.90

Calls 1

isAdminFunction · 0.85

Tested by

no test coverage detected