43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import { defineCollection, z, reference } from "astro:content";
|
|
import { glob } from "astro/loaders";
|
|
|
|
const trainers = defineCollection({
|
|
loader: glob({ pattern: "**/*.md", base: "./src/content/trainers" }),
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
name: z.string(),
|
|
image: image(),
|
|
networks: z.array(
|
|
z.object({
|
|
alt: z.string(),
|
|
url: z.string().url(),
|
|
}),
|
|
),
|
|
}),
|
|
});
|
|
|
|
const courses = defineCollection({
|
|
loader: glob({ pattern: "**/*.{md,mdx}", base: "./src/content/courses" }),
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
id: z.string(),
|
|
title: z.string(),
|
|
excerpt: z.string(),
|
|
slug: z.string(),
|
|
image: image().optional(),
|
|
course: z.object({
|
|
hours: z.number(),
|
|
unit_price: z.number().default(0),
|
|
reciclagem: z.boolean().default(false),
|
|
}),
|
|
seo: z
|
|
.object({
|
|
tags: z.array(z.string()),
|
|
})
|
|
.optional(),
|
|
draft: z.boolean().default(true),
|
|
}),
|
|
});
|
|
|
|
export const collections = { trainers, courses };
|