39 lines
999 B
TypeScript
39 lines
999 B
TypeScript
import { defineCollection, z, reference } from 'astro:content'
|
|
import { glob } from 'astro/loaders'
|
|
|
|
const trainers = defineCollection({
|
|
loader: glob({ pattern: '**/*.md', base: './src/data/trainers' }),
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
name: z.string(),
|
|
image: image(),
|
|
bio: z.string(),
|
|
}),
|
|
})
|
|
|
|
const courses = defineCollection({
|
|
loader: glob({ pattern: '**/*.md', base: './src/data/courses' }),
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
id: z.string(),
|
|
title: z.string(),
|
|
summary: z.string(),
|
|
slug: z.string(),
|
|
img: image().optional(),
|
|
course: z.object({
|
|
hours: z.number(),
|
|
reciclagem: z.boolean().default(false),
|
|
modules: z.array(z.string()),
|
|
trainer: reference('trainers').optional(),
|
|
}),
|
|
seo: z
|
|
.object({
|
|
tags: z.array(z.string()),
|
|
})
|
|
.optional(),
|
|
draft: z.boolean().default(true),
|
|
}),
|
|
})
|
|
|
|
export const collections = { trainers, courses }
|