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:
@@ -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
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user