master-wiki/config.ts
2023-11-18 14:03:06 -03:00

64 lines
1.4 KiB
TypeScript

import { MediaType } from '@components/MediaGallery/types';
import { z, defineCollection } from 'astro:content';
// AstroJS collection configuration
const games = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
release: z.coerce.date(),
developers: z.array(z.string()),
genres: z.array(z.string()),
status: z.enum([
'Backlog',
'On Line',
'Playing',
'Played',
'Wishlist',
'Want to Replay',
'Always Playable',
'Tried',
]),
times_played: z.number(),
}),
});
const blog = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
draft: z.boolean().optional(),
tags: z.array(z.string()).optional(),
published_at: z.coerce.date().optional(),
updated_at: z.coerce.date().optional(),
}),
});
const portafolio = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
draft: z.boolean().optional(),
tags: z.array(z.string()).optional(),
technologies: z.array(z.string()),
published_at: z.coerce.date().optional(),
updated_at: z.coerce.date().optional(),
media: z
.array(
z.object({
type: z.nativeEnum(MediaType),
url: z.string().url(),
alt: z.string(),
mime: z.string().optional(),
}),
)
.catch([]),
}),
});
export const collections = {
games,
blog,
portafolio,
};