Split Schema
All checks were successful
/ checking (push) Successful in 12s

This commit is contained in:
Firq 2024-01-25 21:21:45 +01:00
parent 58a33025c4
commit 2db950a59d
Signed by: Firq
GPG key ID: 3ACC61C8CEC83C20

View file

@ -1,6 +1,6 @@
import { z, defineCollection } from 'astro:content' import { z, defineCollection } from 'astro:content'
const taEntry = z.object({ const entry = z.object({
title: z.string(), title: z.string(),
link: z.string().url(), link: z.string().url(),
date: z.string().transform((str) => new Date(str)), date: z.string().transform((str) => new Date(str)),
@ -9,25 +9,27 @@ const taEntry = z.object({
runner: z.string(), runner: z.string(),
}) })
const taInfo = defineCollection({ const quest = z.object({
type: 'data', questTitle: z.string(),
schema: z.object({ description: z.string(),
info: z.object({ data: z.array(entry)
})
const info = z.object({
title: z.string(), title: z.string(),
releaseDate: z.string().transform((str) => new Date(str)), releaseDate: z.string().transform((str) => new Date(str)),
shortdescription: z.string(), shortdescription: z.string(),
releaseNumber: z.number().default(1), releaseNumber: z.number().default(1),
}),
quests: z.array(
z.object({
questTitle: z.string(),
description: z.string(),
data: z.array(taEntry)
}) })
),
const taData = defineCollection({
type: 'data',
schema: z.object({
info: info,
quests: z.array(quest),
}), }),
}) })
export const collections = { export const collections = {
taInfoData: taInfo, taInfoData: taData,
} }