Working event base

This commit is contained in:
Alexis
2024-05-22 19:27:43 +02:00
parent 030e3cdc12
commit c0940c4985
12 changed files with 245 additions and 299 deletions

View File

@@ -1,5 +1,6 @@
import { serverSupabaseClient } from "#supabase/server";
import { z } from 'zod'
import type { CalendarEvent } from "~/models/CalendarEvent";
const querySchema = z.object({
world_id: z.number({ coerce: true }).positive().int()
@@ -17,7 +18,10 @@ export default defineEventHandler(async (event) => {
description,
world_calendars (id, world_id)
`)
.eq('world_calendars.world_id', query.world_id)
return output
if (query.world_id) {
output.eq('world_calendars.world_id', query.world_id)
}
return output.returns<CalendarEvent[]>()
})