Remodeled database and api to prepare for move

This commit is contained in:
Alexis
2024-05-15 17:18:17 +02:00
parent 3a8e8b0947
commit 49e523485b
21 changed files with 479 additions and 274 deletions

View File

@@ -0,0 +1,23 @@
import { serverSupabaseClient } from "#supabase/server";
import { z } from 'zod'
const querySchema = z.object({
world_id: z.number({ coerce: true }).positive().int()
})
export default defineEventHandler(async (event) => {
const client = await serverSupabaseClient(event)
const query = await getValidatedQuery(event, querySchema.parse)
const output = client
.from('events')
.select(`
id,
title,
description,
world_calendars (id, world_id)
`)
.eq('world_calendars.world_id', query.world_id)
return output
})