Show database links pointing to texts
This commit is contained in:
parent
2ee17b6b3e
commit
8b3a32d3c0
2 changed files with 54 additions and 3 deletions
|
@ -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<ArticleLienDb[]>`
|
||||
SELECT * FROM article_lien WHERE id = ${params.id}
|
||||
`
|
||||
const texteVersionLienDbArray = await db<TexteVersionLienDb[]>`
|
||||
SELECT * FROM texte_version_lien WHERE id = ${params.id}
|
||||
`
|
||||
|
||||
return {
|
||||
article_lien: articleLienDbArray,
|
||||
texte_version: texteVersion,
|
||||
texte_version_lien: texteVersionLienDbArray,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
/>
|
||||
|
||||
<section class="mt-4">
|
||||
<h2
|
||||
class="scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0"
|
||||
>
|
||||
Articles pointant sur le texte
|
||||
</h2>
|
||||
|
||||
<TreeView
|
||||
access={{ key: "article_lien" }}
|
||||
frame={false}
|
||||
open
|
||||
summarize={summarizeArticleLienDbProperties}
|
||||
value={articleLienDbArray}
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section class="mt-4">
|
||||
<h2
|
||||
class="scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0"
|
||||
>
|
||||
Textes pointant sur le texte
|
||||
</h2>
|
||||
|
||||
<TreeView
|
||||
access={{ key: "texte_version_lien" }}
|
||||
frame={false}
|
||||
open
|
||||
summarize={summarizeTexteVersionLienDbProperties}
|
||||
value={texteVersionLienDbArray}
|
||||
/>
|
||||
</section>
|
||||
|
|
Loading…
Reference in a new issue