From b6575ca9c0c6d645545ff1d603b0433c4c8e7dbd Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Sun, 30 Nov 2025 16:35:26 +0100 Subject: [PATCH] Refactor education and experiences API to use meta properties for sorting and mapping Remove pretty-printing from resume link JSON response --- server/api/education.get.ts | 14 +++++++------- server/api/experiences.get.ts | 16 ++++++++-------- server/mcp/tools/resume-link.ts | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/server/api/education.get.ts b/server/api/education.get.ts index 8a69b93..28d1911 100644 --- a/server/api/education.get.ts +++ b/server/api/education.get.ts @@ -4,12 +4,12 @@ export default defineEventHandler(async (event) => { .all() return result - .sort((a, b) => new Date(b.startDate).getTime() - new Date(a.startDate).getTime()) - .map(edu => ({ - degree: edu.degree, - institution: edu.institution, - startDate: edu.startDate, - endDate: edu.endDate, - location: edu.location + .sort((a, b) => new Date(b.meta.startDate).getTime() - new Date(a.meta.startDate).getTime()) + .map((edu) => ({ + degree: edu.meta.degree, + institution: edu.meta.institution, + startDate: edu.meta.startDate, + endDate: edu.meta.endDate, + location: edu.meta.location })) }) diff --git a/server/api/experiences.get.ts b/server/api/experiences.get.ts index 5a038b5..61efa88 100644 --- a/server/api/experiences.get.ts +++ b/server/api/experiences.get.ts @@ -4,14 +4,14 @@ export default defineEventHandler(async (event) => { .all() return result - .sort((a, b) => new Date(b.startDate).getTime() - new Date(a.startDate).getTime()) + .sort((a, b) => new Date(b.meta.startDate).getTime() - new Date(a.meta.startDate).getTime()) .map(exp => ({ - title: exp.title, - company: exp.company, - companyUrl: exp.companyUrl, - startDate: exp.startDate, - endDate: exp.endDate, - location: exp.location, - description: exp.description + title: exp.meta.title, + company: exp.meta.company, + companyUrl: exp.meta.companyUrl, + startDate: exp.meta.startDate, + endDate: exp.meta.endDate, + location: exp.meta.location, + description: exp.meta.description })) }) diff --git a/server/mcp/tools/resume-link.ts b/server/mcp/tools/resume-link.ts index 574dee5..bd96bdd 100644 --- a/server/mcp/tools/resume-link.ts +++ b/server/mcp/tools/resume-link.ts @@ -9,7 +9,7 @@ export default defineMcpTool({ const base_url = import.meta.dev ? 'http://localhost:3000/api' : 'https://mcp.arthurdanjou.fr/api' const url = `${base_url}/resumes/${lang}` return { - content: [{ type: 'text', text: JSON.stringify(url, null, 2) }] + content: [{ type: 'text', text: JSON.stringify(url) }] } } })