mirror of
https://github.com/ArthurDanjou/artapi.git
synced 2026-01-14 22:29:26 +01:00
Amélioration de la configuration du contenu et ajout de nouvelles ressources : mise à jour des collections de profil et de mathématiques, correction des types de fichiers, et ajustement des titres des ressources.
This commit is contained in:
124
server/api/content.config.ts
Normal file
124
server/api/content.config.ts
Normal file
@@ -0,0 +1,124 @@
|
||||
import { defineCollection, defineContentConfig, z } from '@nuxt/content'
|
||||
|
||||
export default defineContentConfig({
|
||||
collections: {
|
||||
projects: defineCollection({
|
||||
type: 'page',
|
||||
source: 'projects/*.md',
|
||||
schema: z.object({
|
||||
slug: z.string(),
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
publishedAt: z.string(),
|
||||
readingTime: z.number().optional(),
|
||||
tags: z.array(z.string()),
|
||||
cover: z.string(),
|
||||
favorite: z.boolean().optional()
|
||||
})
|
||||
}),
|
||||
usesCategories: defineCollection({
|
||||
type: 'data',
|
||||
source: 'uses/categories/*.md',
|
||||
schema: z.object({
|
||||
slug: z.string(),
|
||||
name: z.string()
|
||||
})
|
||||
}),
|
||||
uses: defineCollection({
|
||||
type: 'data',
|
||||
source: 'uses/*.md',
|
||||
schema: z.object({
|
||||
name: z.string(),
|
||||
description: z.string(),
|
||||
category: z.string()
|
||||
})
|
||||
}),
|
||||
skills: defineCollection({
|
||||
type: 'page',
|
||||
source: 'skills.json',
|
||||
schema: z.object({
|
||||
description: z.string(),
|
||||
body: z.array(z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
items: z.array(z.object({
|
||||
name: z.string(),
|
||||
icon: z.string()
|
||||
}))
|
||||
}))
|
||||
})
|
||||
}),
|
||||
experiences: defineCollection({
|
||||
type: 'data',
|
||||
source: 'experiences/*.md',
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
company: z.string(),
|
||||
companyUrl: z.string().url().optional(),
|
||||
startDate: z.string(),
|
||||
endDate: z.string().optional(),
|
||||
location: z.string(),
|
||||
description: z.string(),
|
||||
tags: z.array(z.string())
|
||||
})
|
||||
}),
|
||||
education: defineCollection({
|
||||
type: 'data',
|
||||
source: 'education/*.md',
|
||||
schema: z.object({
|
||||
degree: z.string(),
|
||||
institution: z.string(),
|
||||
startDate: z.string(),
|
||||
endDate: z.string().optional(),
|
||||
location: z.string()
|
||||
})
|
||||
}),
|
||||
contact: defineCollection({
|
||||
type: 'page',
|
||||
source: 'contact.json',
|
||||
schema: z.object({
|
||||
body: z.array(z.object({
|
||||
name: z.string(),
|
||||
icon: z.string().optional(),
|
||||
value: z.string().url(),
|
||||
username: z.string().optional()
|
||||
}))
|
||||
})
|
||||
}),
|
||||
hobbies: defineCollection({
|
||||
type: 'page',
|
||||
source: 'hobbies.md'
|
||||
}),
|
||||
languages: defineCollection({
|
||||
type: 'page',
|
||||
source: 'languages.json',
|
||||
schema: z.object({
|
||||
body: z.array(z.object({
|
||||
name: z.string(),
|
||||
level: z.string(),
|
||||
proficiency: z.string()
|
||||
}))
|
||||
})
|
||||
}),
|
||||
certifications: defineCollection({
|
||||
type: 'page',
|
||||
source: 'certifications.json',
|
||||
schema: z.object({
|
||||
body: z.array(z.object({
|
||||
name: z.string(),
|
||||
issuer: z.string(),
|
||||
date: z.string(),
|
||||
url: z.string().url().optional()
|
||||
}))
|
||||
})
|
||||
}),
|
||||
mathematics: defineCollection({
|
||||
type: 'page',
|
||||
source: 'mathematics.md'
|
||||
}),
|
||||
profile: defineCollection({
|
||||
type: 'page',
|
||||
source: 'profile.md'
|
||||
})
|
||||
}
|
||||
})
|
||||
10
server/api/mathematics.get.ts
Normal file
10
server/api/mathematics.get.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { queryCollection } from '@nuxt/content/server'
|
||||
|
||||
export default defineCachedEventHandler(async (event) => {
|
||||
return await queryCollection(event, 'mathematics')
|
||||
.where('extension', '=', 'md')
|
||||
.first()
|
||||
}, {
|
||||
name: 'mathematics-list',
|
||||
maxAge: 3600 // 1 hour
|
||||
})
|
||||
@@ -2,7 +2,7 @@ import { queryCollection } from '@nuxt/content/server'
|
||||
|
||||
export default defineCachedEventHandler(async (event) => {
|
||||
return await queryCollection(event, 'profile')
|
||||
.where('extension', '=', 'json')
|
||||
.where('extension', '=', 'md')
|
||||
.first()
|
||||
}, {
|
||||
name: 'profile-info',
|
||||
|
||||
Reference in New Issue
Block a user