Files
Website/src/content/config.ts

90 lines
2.5 KiB
TypeScript

/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// @ts-ignore
import {defineCollection, reference, z} from 'astro:content';
export const pages = defineCollection({
type: "content",
schema: z.object({
title: z.string().min(1).max(80),
description: z.string().min(1).max(120),
german: z.boolean().optional().default(false),
image: z.string().optional()
})
})
export const help = defineCollection({
type: "content",
schema: z.object({
title: z.string().min(1).max(80),
description: z.string().min(1).max(120),
tags: z.array(z.string()),
related: z.array(reference('help')).optional()
})
})
export const modes = defineCollection({
type: "data",
schema: z.object({
translationKey: z.string(),
main: z.boolean(),
ranked: z.boolean().optional().default(false)
})
})
export const downloads = defineCollection({
type: "data",
schema: z.object({
name: z.string(),
description: z.string(),
url: z.string().url()
.or(z.record(z.string(), z.string())),
sourceUrl: z.string().url().optional(),
})
})
export const rules = defineCollection({
type: "content",
schema: z.object({
translationKey: z.string(),
})
})
export const announcements = defineCollection({
type: "content",
schema: ({image}) => z.object({
title: z.string(),
description: z.string(),
image: image().optional(),
tags: z.array(z.string()),
created: z.date(),
key: z.string()
})
})
export const collections = {
'pages': pages,
'help': help,
'modes': modes,
'rules': rules,
'downloads': downloads,
'announcements': announcements
}