Huge refactor for backend and client

This is barely functionnal, but at least it can display some data without crashing
Most other functionnalities other than displaying events are broken, and so are the relative date operations, they need to be fixed asap
This commit is contained in:
Alexis
2024-05-16 22:58:19 +02:00
parent 49e523485b
commit 67f5a270af
28 changed files with 247 additions and 303 deletions

View File

@@ -1,5 +1,6 @@
import { serverSupabaseClient } from "#supabase/server";
import { z } from 'zod'
import type { Calendar } from "~/models/CalendarConfig";
const querySchema = z.object({
world_id: z.number({ coerce: true }).positive().int()
@@ -13,11 +14,21 @@ export default defineEventHandler(async (event) => {
.from('world_calendars')
.select(`
id,
months,
days_per_year,
events (*)
months:calendar_months (*),
events:calendar_events (
id,
title,
description,
hidden,
startDate:start_date,
endDate:end_date,
wiki,
category:calendar_events_category (*)
)
`)
.eq('world_id', query.world_id)
.limit(1)
.single<Calendar>()
return output
})

View File

@@ -10,7 +10,7 @@ export default defineEventHandler(async (event) => {
const query = await getValidatedQuery(event, querySchema.parse)
const output = client
.from('events')
.from('calendar_events')
.select(`
id,
title,