From 630cbaba1bf1f0f6ab7972c5738f540e202ae4b1 Mon Sep 17 00:00:00 2001 From: Emmanuel Raviart Date: Tue, 17 Sep 2024 10:20:58 +0200 Subject: [PATCH] Accept JORF articles in search API --- src/routes/api/recherche/+server.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/api/recherche/+server.ts b/src/routes/api/recherche/+server.ts index 4f61da5..5b8a8f9 100644 --- a/src/routes/api/recherche/+server.ts +++ b/src/routes/api/recherche/+server.ts @@ -73,13 +73,14 @@ export const GET: RequestHandler = async ({ url }) => { const aggregator = new Aggregator(follow) let id: string | undefined = undefined if (q !== undefined) { + // https://www.legifrance.gouv.fr/jorf/article_jo/JORFARTI000048727355 // https://www.legifrance.gouv.fr/codes/article_lc/LEGIARTI000006308296/ // https://www.legifrance.gouv.fr/codes/article_lc/LEGIARTI000006308296/1983-12-30/ // https://www.legifrance.gouv.fr/codes/article_lc/LEGIARTI000006308296/1984-12-30/ // https://www.legifrance.gouv.fr/loda/article_lc/LEGIARTI000036456533 // https://www.legifrance.gouv.fr/loda/article_lc/LEGIARTI000036456533/2018-01-01 // https://www.legifrance.gouv.fr/loda/id/LEGIARTI000006317314/1983-12-30 - id = q.match(/LEGIARTI\d+/)?.[0] + id = q.match(/(JORF|LEGI)ARTI\d{12}/)?.[0] if (id != null) { let article = ( await db<{ data: JorfArticle | LegiArticle }[]>`