fix astro schema config

This commit is contained in:
Alexander Navarro 2023-11-18 14:03:06 -03:00
parent e52081e1e2
commit 3ba1dd4625
2 changed files with 27 additions and 9 deletions

View file

@ -1,3 +1,4 @@
import { MediaType } from '@components/MediaGallery/types';
import { z, defineCollection } from 'astro:content';
// AstroJS collection configuration
@ -17,6 +18,7 @@ const games = defineCollection({
'Wishlist',
'Want to Replay',
'Always Playable',
'Tried',
]),
times_played: z.number(),
}),
@ -39,14 +41,19 @@ const portafolio = defineCollection({
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.enum(['image', 'video']),
url: z.string().url(),
}),
),
media: z
.array(
z.object({
type: z.nativeEnum(MediaType),
url: z.string().url(),
alt: z.string(),
mime: z.string().optional(),
}),
)
.catch([]),
}),
});