diff --git a/src/routes/texte_version/[id]/+page.server.ts b/src/routes/texte_version/[id]/+page.server.ts index 3523869..0aded77 100644 --- a/src/routes/texte_version/[id]/+page.server.ts +++ b/src/routes/texte_version/[id]/+page.server.ts @@ -1,6 +1,7 @@ import { error } from "@sveltejs/kit" import type { TexteVersion } from "$lib/legal" +import type { ArticleLienDb, TexteVersionLienDb } from "$lib/legal/shared" import { db } from "$lib/server/databases" import type { PageServerLoad } from "./$types" @@ -16,5 +17,17 @@ export const load: PageServerLoad = async ({ params }) => { if (texteVersion === undefined) { error(404, `TEXTE_VERSION ${params.id} non trouvé`) } - return { texte_version: texteVersion } + + const articleLienDbArray = await db` + SELECT * FROM article_lien WHERE id = ${params.id} + ` + const texteVersionLienDbArray = await db` + SELECT * FROM texte_version_lien WHERE id = ${params.id} + ` + + return { + article_lien: articleLienDbArray, + texte_version: texteVersion, + texte_version_lien: texteVersionLienDbArray, + } } diff --git a/src/routes/texte_version/[id]/+page.svelte b/src/routes/texte_version/[id]/+page.svelte index de4a92d..94afbd0 100644 --- a/src/routes/texte_version/[id]/+page.svelte +++ b/src/routes/texte_version/[id]/+page.svelte @@ -3,15 +3,21 @@ import IdPagesSwitcher from "$lib/components/IdPagesSwitcher.svelte" import { - summarizeTexteVersionProperties, + summarizeArticleLienDbProperties, summarizeLegalObject, + summarizeTexteVersionLienDbProperties, + summarizeTexteVersionProperties, } from "$lib/summaries" import type { PageData } from "./$types" export let data: PageData - $: ({ texte_version: texteVersion } = data) + $: ({ + article_lien: articleLienDbArray, + texte_version: texteVersion, + texte_version_lien: texteVersionLienDbArray, + } = data) $: summary = summarizeLegalObject( { key: "texte_version" }, @@ -42,3 +48,35 @@ summarize={summarizeTexteVersionProperties} value={texteVersion} /> + +
+

+ Articles pointant sur le texte +

+ + +
+ +
+

+ Textes pointant sur le texte +

+ + +