Migrate to latest Svelte Kit.
This commit is contained in:
parent
b6c309af2e
commit
675cb024d9
68 changed files with 1316 additions and 1289 deletions
786
package-lock.json
generated
786
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -27,8 +27,9 @@
|
||||||
"@iconify/svelte": "^2.2.1",
|
"@iconify/svelte": "^2.2.1",
|
||||||
"@playwright/test": "^1.22.2",
|
"@playwright/test": "^1.22.2",
|
||||||
"@sveltejs/adapter-node": "^1.0.0-next.86",
|
"@sveltejs/adapter-node": "^1.0.0-next.86",
|
||||||
"@sveltejs/kit": "next",
|
"@sveltejs/kit": "^1.0.0-next.427",
|
||||||
"@tailwindcss/typography": "^0.5.3",
|
"@tailwindcss/typography": "^0.5.3",
|
||||||
|
"@tricoteuses/explorer-tools": "^0.1.4",
|
||||||
"@types/fs-extra": "^9.0.13",
|
"@types/fs-extra": "^9.0.13",
|
||||||
"@types/he": "^1.1.2",
|
"@types/he": "^1.1.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
||||||
|
|
10
src/hooks.ts
10
src/hooks.ts
|
@ -1,12 +1,4 @@
|
||||||
import type { GetSession, Handle } from "@sveltejs/kit"
|
import type { Handle } from "@sveltejs/kit"
|
||||||
|
|
||||||
import config from "$lib/server/config"
|
|
||||||
|
|
||||||
export const getSession: GetSession = async () => {
|
|
||||||
return {
|
|
||||||
title: config.title,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const handle: Handle = async ({ event, resolve }) => {
|
export const handle: Handle = async ({ event, resolve }) => {
|
||||||
// Add CORS support.
|
// Add CORS support.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import type { MenuItem } from "@tricoteuses/explorer-tools"
|
||||||
|
|
||||||
export interface Article {
|
export interface Article {
|
||||||
META: {
|
META: {
|
||||||
META_COMMUN: MetaCommun
|
META_COMMUN: MetaCommun
|
||||||
|
@ -182,6 +184,44 @@ export interface XmlHeader {
|
||||||
"@version": "1.0"
|
"@version": "1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const appMenu: MenuItem[] = [
|
||||||
|
{ href: "/recherche", label: "Recherche" },
|
||||||
|
{
|
||||||
|
items: [
|
||||||
|
{ href: "/article", label: "ARTICLE" },
|
||||||
|
{ href: "/dossier_legislatif", label: "DOSSIER_LEGISLATIF" },
|
||||||
|
{ href: "/id", label: "ID" },
|
||||||
|
{ href: "/idcc", label: "IDCC" },
|
||||||
|
{ href: "/jo", label: "JO" },
|
||||||
|
{ href: "/section_ta", label: "SECTION_TA" },
|
||||||
|
{ href: "/texte_version", label: "TEXTE_VERSION" },
|
||||||
|
{ href: "/textekali", label: "TEXTEKALI" },
|
||||||
|
{ href: "/textelr", label: "TEXTELR" },
|
||||||
|
{ href: "/versions", label: "VERSIONS" },
|
||||||
|
],
|
||||||
|
label: "Données",
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// items: [
|
||||||
|
// { href: "/jo", label: "JO" },
|
||||||
|
// ],
|
||||||
|
// label: "JORF",
|
||||||
|
// title: "Textes publiés au Journal officiel de la République française",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// items: [
|
||||||
|
// { href: "/article", label: "ARTICLE" },
|
||||||
|
// // { href: "/eli/ids", label: "ID" },
|
||||||
|
// { href: "/section_ta", label: "SECTION_TA" },
|
||||||
|
// { href: "/texte_version", label: "TEXTE_VERSION" },
|
||||||
|
// { href: "/textelr", label: "TEXTELR" },
|
||||||
|
// // { href: "/eli/versions", label: "VERSIONS" },
|
||||||
|
// ],
|
||||||
|
// label: "LEGI",
|
||||||
|
// title: "Codes, lois et règlements consolidés",
|
||||||
|
// },
|
||||||
|
]
|
||||||
|
|
||||||
export function assertNeverLegalObjectType(type: never): never {
|
export function assertNeverLegalObjectType(type: never): never {
|
||||||
throw `Unexpected type for legal object: ${type}`
|
throw `Unexpected type for legal object: ${type}`
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,9 +192,10 @@ export function summarizeLegalObject(
|
||||||
const dossierLegislatif = value as DossierLegislatif | undefined
|
const dossierLegislatif = value as DossierLegislatif | undefined
|
||||||
return dossierLegislatif?.META.META_DOSSIER_LEGISLATIF.TITRE
|
return dossierLegislatif?.META.META_DOSSIER_LEGISLATIF.TITRE
|
||||||
}
|
}
|
||||||
case "id":
|
case "id": {
|
||||||
const idWrapper = value as IdWrapper | undefined
|
const idWrapper = value as IdWrapper | undefined
|
||||||
return idWrapper?.eli
|
return idWrapper?.eli
|
||||||
|
}
|
||||||
case "idcc": {
|
case "idcc": {
|
||||||
const idcc = value as Idcc | undefined
|
const idcc = value as Idcc | undefined
|
||||||
return idcc?.META.META_SPEC.META_CONTENEUR.TITRE
|
return idcc?.META.META_SPEC.META_CONTENEUR.TITRE
|
||||||
|
@ -225,9 +226,10 @@ export function summarizeLegalObject(
|
||||||
const textelr = value as Textelr | undefined
|
const textelr = value as Textelr | undefined
|
||||||
return textelr?.META.META_COMMUN.ID
|
return textelr?.META.META_COMMUN.ID
|
||||||
}
|
}
|
||||||
case "versions":
|
case "versions": {
|
||||||
const versionsWrapper = value as VersionsWrapper | undefined
|
const versionsWrapper = value as VersionsWrapper | undefined
|
||||||
return versionsWrapper?.eli
|
return versionsWrapper?.eli
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
assertNeverLegalObjectType(type)
|
assertNeverLegalObjectType(type)
|
||||||
}
|
}
|
||||||
|
|
7
src/routes/+layout.server.ts
Normal file
7
src/routes/+layout.server.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import config from "$lib/server/config"
|
||||||
|
|
||||||
|
import type { LayoutServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: LayoutServerLoad = () => {
|
||||||
|
return { appTitle: config.title }
|
||||||
|
}
|
23
src/routes/+layout.svelte
Normal file
23
src/routes/+layout.svelte
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import "../app.postcss"
|
||||||
|
|
||||||
|
// import { NavBar } from "@tricoteuses/explorer-tools"
|
||||||
|
import NavBar from "@tricoteuses/explorer-tools/components/NavBar.svelte"
|
||||||
|
|
||||||
|
import { page } from "$app/stores"
|
||||||
|
import { appMenu } from "$lib/legal"
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>{$page.data.appTitle}</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
<NavBar
|
||||||
|
contributeUrl="https://git.en-root.org/tricoteuses/tricoteuses-legal-explorer"
|
||||||
|
leftMenu={appMenu}
|
||||||
|
title={$page.data.appTitle}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="mx-auto w-11/12">
|
||||||
|
<slot />
|
||||||
|
</div>
|
|
@ -1,13 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { session } from "$app/stores"
|
import { page } from "$app/stores"
|
||||||
|
|
||||||
const title = $session.title
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
|
||||||
<title>{title}</title>
|
|
||||||
</svelte:head>
|
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div class="hero bg-base-200">
|
<div class="hero bg-base-200">
|
||||||
<div class="hero-content flex-col lg:flex-row">
|
<div class="hero-content flex-col lg:flex-row">
|
||||||
|
@ -17,7 +11,10 @@
|
||||||
src="/tricoteuses_jacobines_1301x1907.jpg"
|
src="/tricoteuses_jacobines_1301x1907.jpg"
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
<h1 class="text-5xl font-bold">Tricoteuses</h1>
|
<h1 class="text-5xl font-bold">
|
||||||
|
{$page.data.appTitle}
|
||||||
|
Légifrance
|
||||||
|
</h1>
|
||||||
<p class="py-6">
|
<p class="py-6">
|
||||||
Un site et des API pour permettre aux développeurs d'utiliser plus
|
Un site et des API pour permettre aux développeurs d'utiliser plus
|
||||||
facilement les données publiques légales de la <abbr
|
facilement les données publiques légales de la <abbr
|
|
@ -1,131 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import "../app.css"
|
|
||||||
|
|
||||||
import Icon from "@iconify/svelte"
|
|
||||||
import chevronDown from "@iconify-icons/codicon/chevron-down"
|
|
||||||
import chevronRight from "@iconify-icons/codicon/chevron-right"
|
|
||||||
import threeBars from "@iconify-icons/codicon/three-bars"
|
|
||||||
|
|
||||||
import { session } from "$app/stores"
|
|
||||||
|
|
||||||
type MenuItem = MenuItemLink | MenuItemSubMenu
|
|
||||||
|
|
||||||
interface MenuItemBase {
|
|
||||||
href?: string
|
|
||||||
items?: MenuItemLink[]
|
|
||||||
label: string
|
|
||||||
title?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MenuItemLink extends MenuItemBase {
|
|
||||||
href: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MenuItemSubMenu extends MenuItemBase {
|
|
||||||
items: MenuItemLink[]
|
|
||||||
}
|
|
||||||
|
|
||||||
const menuItems: MenuItem[] = [
|
|
||||||
{ href: "/recherche", label: "Recherche" },
|
|
||||||
{
|
|
||||||
items: [
|
|
||||||
{ href: "/article", label: "ARTICLE" },
|
|
||||||
{ href: "/dossier_legislatif", label: "DOSSIER_LEGISLATIF" },
|
|
||||||
{ href: "/id", label: "ID" },
|
|
||||||
{ href: "/idcc", label: "IDCC" },
|
|
||||||
{ href: "/jo", label: "JO" },
|
|
||||||
{ href: "/section_ta", label: "SECTION_TA" },
|
|
||||||
{ href: "/texte_version", label: "TEXTE_VERSION" },
|
|
||||||
{ href: "/textekali", label: "TEXTEKALI" },
|
|
||||||
{ href: "/textelr", label: "TEXTELR" },
|
|
||||||
{ href: "/versions", label: "VERSIONS" },
|
|
||||||
],
|
|
||||||
label: "Données",
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// items: [
|
|
||||||
// { href: "/jo", label: "JO" },
|
|
||||||
// ],
|
|
||||||
// label: "JORF",
|
|
||||||
// title: "Textes publiés au Journal officiel de la République française",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// items: [
|
|
||||||
// { href: "/article", label: "ARTICLE" },
|
|
||||||
// // { href: "/eli/ids", label: "ID" },
|
|
||||||
// { href: "/section_ta", label: "SECTION_TA" },
|
|
||||||
// { href: "/texte_version", label: "TEXTE_VERSION" },
|
|
||||||
// { href: "/textelr", label: "TEXTELR" },
|
|
||||||
// // { href: "/eli/versions", label: "VERSIONS" },
|
|
||||||
// ],
|
|
||||||
// label: "LEGI",
|
|
||||||
// title: "Codes, lois et règlements consolidés",
|
|
||||||
// },
|
|
||||||
]
|
|
||||||
const title = $session.title
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="navbar mb-2 bg-neutral text-neutral-content">
|
|
||||||
<div class="navbar-start">
|
|
||||||
<div class="dropdown">
|
|
||||||
<button tabindex="0" class="btn btn-ghost lg:hidden">
|
|
||||||
<Icon class="h-5 w-5" icon={threeBars} />
|
|
||||||
</button>
|
|
||||||
<ul
|
|
||||||
tabindex="0"
|
|
||||||
class="dropdown-content menu rounded-box menu-compact mt-3 w-52 bg-neutral p-2 text-neutral-content shadow"
|
|
||||||
>
|
|
||||||
{#each menuItems as { href, items, label, title }}
|
|
||||||
{#if href !== undefined}
|
|
||||||
<li><a {href} {title}>{label}</a></li>
|
|
||||||
{:else if items !== undefined}
|
|
||||||
<li tabindex="0">
|
|
||||||
<span class="justify-between" {title}>
|
|
||||||
{label}
|
|
||||||
<Icon class="h-5 w-5" icon={chevronRight} />
|
|
||||||
</span>
|
|
||||||
<ul class="bg-neutral p-2 text-neutral-content">
|
|
||||||
{#each items as { href, label }}
|
|
||||||
<li><a {href} {title}>{label}</a></li>
|
|
||||||
{/each}
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
{/if}
|
|
||||||
{/each}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<a class="btn btn-ghost text-xl normal-case" href="/"> {title}</a>
|
|
||||||
</div>
|
|
||||||
<div class="navbar-center hidden lg:flex">
|
|
||||||
<ul class="menu menu-horizontal p-0">
|
|
||||||
{#each menuItems as { href, items, label, title }}
|
|
||||||
{#if href !== undefined}
|
|
||||||
<li><a {href} {title}>{label}</a></li>
|
|
||||||
{:else if items !== undefined}
|
|
||||||
<li tabindex="0">
|
|
||||||
<span class="justify-between" {title}>
|
|
||||||
{label}
|
|
||||||
<Icon class="h-5 w-5" icon={chevronDown} />
|
|
||||||
</span>
|
|
||||||
<ul class="bg-neutral p-2 text-neutral-content">
|
|
||||||
{#each items as { href, label }}
|
|
||||||
<li><a {href} {title}>{label}</a></li>
|
|
||||||
{/each}
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
{/if}
|
|
||||||
{/each}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="navbar-end">
|
|
||||||
<a
|
|
||||||
class="btn"
|
|
||||||
href="https://git.en-root.org/tricoteuses/tricoteuses-legal-explorer"
|
|
||||||
>Contribuer</a
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mx-auto w-11/12">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { Article } from "$lib/legal"
|
import type { Article } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset } = query
|
const { limit, offset } = query
|
||||||
|
|
||||||
|
@ -65,7 +58,5 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
LIMIT ${limit}
|
LIMIT ${limit}
|
||||||
`
|
`
|
||||||
).map(({ data }) => data)
|
).map(({ data }) => data)
|
||||||
return {
|
return { article: articles }
|
||||||
body: { article: articles as unknown as JSONObject[] },
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,14 +4,14 @@
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
// import { page } from "$app/stores"
|
// import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import type { Article } from "$lib/legal"
|
|
||||||
import { summarizeArticleProperties } from "$lib/summaries"
|
import { summarizeArticleProperties } from "$lib/summaries"
|
||||||
|
|
||||||
let articles: Article[]
|
import type { PageData } from "./$types"
|
||||||
export { articles as article }
|
|
||||||
export let error: unknown
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ article: articles } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -51,18 +51,12 @@
|
||||||
</div>
|
</div>
|
||||||
</form> -->
|
</form> -->
|
||||||
|
|
||||||
{#if error != null}
|
<TreeView
|
||||||
<ErrorAlert {error} />
|
access={{ key: "article" }}
|
||||||
{/if}
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeArticleProperties}
|
||||||
|
value={articles}
|
||||||
|
/>
|
||||||
|
|
||||||
{#if error == null}
|
<Pagination currentPageCount={articles?.length ?? 0} />
|
||||||
<TreeView
|
|
||||||
access={{ key: "article" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeArticleProperties}
|
|
||||||
value={articles}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Pagination currentPageCount={articles.length ?? 0} />
|
|
||||||
{/if}
|
|
|
@ -1,38 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
|
||||||
|
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import type { Article } from "$lib/legal"
|
|
||||||
import {
|
|
||||||
summarizeArticleProperties,
|
|
||||||
summarizeLegalObject,
|
|
||||||
} from "$lib/summaries"
|
|
||||||
|
|
||||||
export let error: unknown
|
|
||||||
export let article: Article
|
|
||||||
|
|
||||||
const summary = summarizeLegalObject({ key: "article" }, "article", article)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
|
||||||
<h2>ARTICLE</h2>
|
|
||||||
{#if summary !== undefined}
|
|
||||||
<h1>
|
|
||||||
<SummaryView {summary} />
|
|
||||||
</h1>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if error != null}
|
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null}
|
|
||||||
<TreeView
|
|
||||||
access={{ key: "article" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeArticleProperties}
|
|
||||||
value={article}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
|
@ -1,21 +0,0 @@
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import type { Article } from "$lib/legal"
|
|
||||||
import { db } from "$lib/server/database"
|
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
|
||||||
const article = (
|
|
||||||
await db<{ data: Article }[]>`
|
|
||||||
SELECT data FROM article
|
|
||||||
WHERE id = ${params.id}
|
|
||||||
`
|
|
||||||
).map(({ data }) => data)[0]
|
|
||||||
|
|
||||||
if (article === undefined) {
|
|
||||||
return { status: 404 }
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
body: { article: article as unknown as JSONObject },
|
|
||||||
}
|
|
||||||
}
|
|
20
src/routes/article/[id]/+page.server.ts
Normal file
20
src/routes/article/[id]/+page.server.ts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import { error } from "@sveltejs/kit"
|
||||||
|
|
||||||
|
import type { Article } from "$lib/legal"
|
||||||
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
|
const article = (
|
||||||
|
await db<{ data: Article }[]>`
|
||||||
|
SELECT data FROM article
|
||||||
|
WHERE id = ${params.id}
|
||||||
|
`
|
||||||
|
).map(({ data }) => data)[0]
|
||||||
|
|
||||||
|
if (article === undefined) {
|
||||||
|
throw error(404, `Article ${params.id} non trouvé`)
|
||||||
|
}
|
||||||
|
return { article }
|
||||||
|
}
|
33
src/routes/article/[id]/+page.svelte
Normal file
33
src/routes/article/[id]/+page.svelte
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import {
|
||||||
|
summarizeArticleProperties,
|
||||||
|
summarizeLegalObject,
|
||||||
|
} from "$lib/summaries"
|
||||||
|
|
||||||
|
import type { PageData } from "./$types"
|
||||||
|
|
||||||
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ article } = data)
|
||||||
|
|
||||||
|
$: summary = summarizeLegalObject({ key: "article" }, "article", article)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="prose my-6 max-w-full">
|
||||||
|
<h2>ARTICLE</h2>
|
||||||
|
{#if summary !== undefined}
|
||||||
|
<h1>
|
||||||
|
<SummaryView {summary} />
|
||||||
|
</h1>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<TreeView
|
||||||
|
access={{ key: "article" }}
|
||||||
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeArticleProperties}
|
||||||
|
value={article}
|
||||||
|
/>
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { DossierLegislatif } from "$lib/legal"
|
import type { DossierLegislatif } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset } = query
|
const { limit, offset } = query
|
||||||
|
|
||||||
|
@ -66,8 +59,6 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
`
|
`
|
||||||
).map(({ data }) => data)
|
).map(({ data }) => data)
|
||||||
return {
|
return {
|
||||||
body: {
|
dossier_legislatif: dossiersLegislatifs,
|
||||||
dossier_legislatif: dossiersLegislatifs as unknown as JSONObject[],
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,14 +4,14 @@
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
// import { page } from "$app/stores"
|
// import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import type { DossierLegislatif } from "$lib/legal"
|
|
||||||
import { summarizeDossierLegislatifProperties } from "$lib/summaries"
|
import { summarizeDossierLegislatifProperties } from "$lib/summaries"
|
||||||
|
|
||||||
let dossiersLegislatifs: DossierLegislatif[]
|
import type { PageData } from "./$types"
|
||||||
export { dossiersLegislatifs as dossier_legislatif }
|
|
||||||
export let error: unknown
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ dossier_legislatif: dossiersLegislatifs } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -51,18 +51,12 @@
|
||||||
</div>
|
</div>
|
||||||
</form> -->
|
</form> -->
|
||||||
|
|
||||||
{#if error != null}
|
<TreeView
|
||||||
<ErrorAlert {error} />
|
access={{ key: "dossier_legislatif" }}
|
||||||
{/if}
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeDossierLegislatifProperties}
|
||||||
|
value={dossiersLegislatifs}
|
||||||
|
/>
|
||||||
|
|
||||||
{#if error == null}
|
<Pagination currentPageCount={dossiersLegislatifs?.length ?? 0} />
|
||||||
<TreeView
|
|
||||||
access={{ key: "dossier_legislatif" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeDossierLegislatifProperties}
|
|
||||||
value={dossiersLegislatifs}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Pagination currentPageCount={dossiersLegislatifs.length ?? 0} />
|
|
||||||
{/if}
|
|
|
@ -1,43 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
|
||||||
|
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import type { DossierLegislatif } from "$lib/legal"
|
|
||||||
import {
|
|
||||||
summarizeDossierLegislatifProperties,
|
|
||||||
summarizeLegalObject,
|
|
||||||
} from "$lib/summaries"
|
|
||||||
|
|
||||||
export let error: unknown
|
|
||||||
let dossierLegislatif: DossierLegislatif
|
|
||||||
export { dossierLegislatif as dossier_legislatif }
|
|
||||||
|
|
||||||
const summary = summarizeLegalObject(
|
|
||||||
{ key: "dossier_legislatif" },
|
|
||||||
"dossier_legislatif",
|
|
||||||
dossierLegislatif,
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
|
||||||
<h2>DOSSIER_LEGISLATIF</h2>
|
|
||||||
{#if summary !== undefined}
|
|
||||||
<h1>
|
|
||||||
<SummaryView {summary} />
|
|
||||||
</h1>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if error != null}
|
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null}
|
|
||||||
<TreeView
|
|
||||||
access={{ key: "dossier_legislatif" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeDossierLegislatifProperties}
|
|
||||||
value={dossierLegislatif}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
|
@ -1,10 +1,11 @@
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import type { DossierLegislatif } from "$lib/legal"
|
import type { DossierLegislatif } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
const dossierLegislatif = (
|
const dossierLegislatif = (
|
||||||
await db<{ data: DossierLegislatif }[]>`
|
await db<{ data: DossierLegislatif }[]>`
|
||||||
SELECT data FROM dossier_legislatif
|
SELECT data FROM dossier_legislatif
|
||||||
|
@ -13,9 +14,7 @@ export const GET: RequestHandler = async ({ params }) => {
|
||||||
).map(({ data }) => data)[0]
|
).map(({ data }) => data)[0]
|
||||||
|
|
||||||
if (dossierLegislatif === undefined) {
|
if (dossierLegislatif === undefined) {
|
||||||
return { status: 404 }
|
throw error(404, `Dossier législatif ${params.id} non trouvé`)
|
||||||
}
|
|
||||||
return {
|
|
||||||
body: { dossier_legislatif: dossierLegislatif as unknown as JSONObject },
|
|
||||||
}
|
}
|
||||||
|
return { dossier_legislatif: dossierLegislatif }
|
||||||
}
|
}
|
37
src/routes/dossier_legislatif/[id]/+page.svelte
Normal file
37
src/routes/dossier_legislatif/[id]/+page.svelte
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import {
|
||||||
|
summarizeDossierLegislatifProperties,
|
||||||
|
summarizeLegalObject,
|
||||||
|
} from "$lib/summaries"
|
||||||
|
|
||||||
|
import type { PageData } from "./$types"
|
||||||
|
|
||||||
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ dossier_legislatif: dossierLegislatif } = data)
|
||||||
|
|
||||||
|
$: summary = summarizeLegalObject(
|
||||||
|
{ key: "dossier_legislatif" },
|
||||||
|
"dossier_legislatif",
|
||||||
|
dossierLegislatif,
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="prose my-6 max-w-full">
|
||||||
|
<h2>DOSSIER_LEGISLATIF</h2>
|
||||||
|
{#if summary !== undefined}
|
||||||
|
<h1>
|
||||||
|
<SummaryView {summary} />
|
||||||
|
</h1>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<TreeView
|
||||||
|
access={{ key: "dossier_legislatif" }}
|
||||||
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeDossierLegislatifProperties}
|
||||||
|
value={dossierLegislatif}
|
||||||
|
/>
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { IdWrapper } from "$lib/legal"
|
import type { IdWrapper } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset } = query
|
const { limit, offset } = query
|
||||||
|
|
||||||
|
@ -63,7 +56,5 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
OFFSET ${offset}
|
OFFSET ${offset}
|
||||||
LIMIT ${limit}
|
LIMIT ${limit}
|
||||||
`
|
`
|
||||||
return {
|
return { id: idsWrapper }
|
||||||
body: { id: idsWrapper as unknown as JSONObject[] },
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,14 +4,14 @@
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
// import { page } from "$app/stores"
|
// import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import type { IdWrapper } from "$lib/legal"
|
|
||||||
import { summarizeIdWrapperProperties } from "$lib/summaries"
|
import { summarizeIdWrapperProperties } from "$lib/summaries"
|
||||||
|
|
||||||
let idsWrapper: IdWrapper[]
|
import type { PageData } from "./$types"
|
||||||
export { idsWrapper as id }
|
|
||||||
export let error: unknown
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ id: idsWrapper } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -51,18 +51,12 @@
|
||||||
</div>
|
</div>
|
||||||
</form> -->
|
</form> -->
|
||||||
|
|
||||||
{#if error != null}
|
<TreeView
|
||||||
<ErrorAlert {error} />
|
access={{ key: "id" }}
|
||||||
{/if}
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeIdWrapperProperties}
|
||||||
|
value={idsWrapper}
|
||||||
|
/>
|
||||||
|
|
||||||
{#if error == null}
|
<Pagination currentPageCount={idsWrapper?.length ?? 0} />
|
||||||
<TreeView
|
|
||||||
access={{ key: "id" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeIdWrapperProperties}
|
|
||||||
value={idsWrapper}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Pagination currentPageCount={idsWrapper.length ?? 0} />
|
|
||||||
{/if}
|
|
|
@ -1,39 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
|
||||||
|
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import type { IdWrapper } from "$lib/legal"
|
|
||||||
import {
|
|
||||||
summarizeIdWrapperProperties,
|
|
||||||
summarizeLegalObject,
|
|
||||||
} from "$lib/summaries"
|
|
||||||
|
|
||||||
export let error: unknown
|
|
||||||
let idWrapper: IdWrapper
|
|
||||||
export { idWrapper as id }
|
|
||||||
|
|
||||||
const summary = summarizeLegalObject({ key: "id" }, "id", idWrapper)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
|
||||||
<h2>ID</h2>
|
|
||||||
{#if summary !== undefined}
|
|
||||||
<h1>
|
|
||||||
<SummaryView {summary} />
|
|
||||||
</h1>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if error != null}
|
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null}
|
|
||||||
<TreeView
|
|
||||||
access={{ key: "article" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeIdWrapperProperties}
|
|
||||||
value={idWrapper}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
|
@ -1,21 +0,0 @@
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import type { IdWrapper } from "$lib/legal"
|
|
||||||
import { db } from "$lib/server/database"
|
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
|
||||||
const idWrapper = (
|
|
||||||
await db<{ data: IdWrapper }[]>`
|
|
||||||
SELECT eli, id FROM id
|
|
||||||
WHERE eli = ${params.eli}
|
|
||||||
`
|
|
||||||
)[0]
|
|
||||||
|
|
||||||
if (idWrapper === undefined) {
|
|
||||||
return { status: 404 }
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
body: { id: idWrapper as unknown as JSONObject },
|
|
||||||
}
|
|
||||||
}
|
|
20
src/routes/id/[...eli]/+page.server.ts
Normal file
20
src/routes/id/[...eli]/+page.server.ts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import { error } from "@sveltejs/kit"
|
||||||
|
|
||||||
|
import type { IdWrapper } from "$lib/legal"
|
||||||
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
|
const idWrapper = (
|
||||||
|
await db<{ data: IdWrapper }[]>`
|
||||||
|
SELECT eli, id FROM id
|
||||||
|
WHERE eli = ${params.eli}
|
||||||
|
`
|
||||||
|
)[0]
|
||||||
|
|
||||||
|
if (idWrapper === undefined) {
|
||||||
|
throw error(404, `ELI ${params.eli} non trouvé`)
|
||||||
|
}
|
||||||
|
return { id: idWrapper }
|
||||||
|
}
|
33
src/routes/id/[...eli]/+page.svelte
Normal file
33
src/routes/id/[...eli]/+page.svelte
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import {
|
||||||
|
summarizeIdWrapperProperties,
|
||||||
|
summarizeLegalObject,
|
||||||
|
} from "$lib/summaries"
|
||||||
|
|
||||||
|
import type { PageData } from "./$types"
|
||||||
|
|
||||||
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ id: idWrapper } = data)
|
||||||
|
|
||||||
|
$: summary = summarizeLegalObject({ key: "id" }, "id", idWrapper)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="prose my-6 max-w-full">
|
||||||
|
<h2>ID</h2>
|
||||||
|
{#if summary !== undefined}
|
||||||
|
<h1>
|
||||||
|
<SummaryView {summary} />
|
||||||
|
</h1>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<TreeView
|
||||||
|
access={{ key: "article" }}
|
||||||
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeIdWrapperProperties}
|
||||||
|
value={idWrapper}
|
||||||
|
/>
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { Idcc } from "$lib/legal"
|
import type { Idcc } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset } = query
|
const { limit, offset } = query
|
||||||
|
|
||||||
|
@ -65,7 +58,5 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
LIMIT ${limit}
|
LIMIT ${limit}
|
||||||
`
|
`
|
||||||
).map(({ data }) => data)
|
).map(({ data }) => data)
|
||||||
return {
|
return { idcc: idccArray }
|
||||||
body: { idcc: idccArray as unknown as JSONObject[] },
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,14 +4,14 @@
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
// import { page } from "$app/stores"
|
// import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import type { Idcc } from "$lib/legal"
|
|
||||||
import { summarizeIdccProperties } from "$lib/summaries"
|
import { summarizeIdccProperties } from "$lib/summaries"
|
||||||
|
|
||||||
export let error: unknown
|
import type { PageData } from "./$types"
|
||||||
let idccArray: Idcc[]
|
|
||||||
export { idccArray as idcc }
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ idcc: idccArray } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -51,18 +51,12 @@
|
||||||
</div>
|
</div>
|
||||||
</form> -->
|
</form> -->
|
||||||
|
|
||||||
{#if error != null}
|
<TreeView
|
||||||
<ErrorAlert {error} />
|
access={{ key: "idcc" }}
|
||||||
{/if}
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeIdccProperties}
|
||||||
|
value={idccArray}
|
||||||
|
/>
|
||||||
|
|
||||||
{#if error == null}
|
<Pagination currentPageCount={idccArray?.length ?? 0} />
|
||||||
<TreeView
|
|
||||||
access={{ key: "idcc" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeIdccProperties}
|
|
||||||
value={idccArray}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Pagination currentPageCount={idccArray.length ?? 0} />
|
|
||||||
{/if}
|
|
|
@ -1,35 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
|
||||||
|
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import type { Idcc } from "$lib/legal"
|
|
||||||
import { summarizeIdccProperties, summarizeLegalObject } from "$lib/summaries"
|
|
||||||
|
|
||||||
export let error: unknown
|
|
||||||
export let idcc: Idcc
|
|
||||||
|
|
||||||
const summary = summarizeLegalObject({ key: "idcc" }, "idcc", idcc)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
|
||||||
<h2>IDCC</h2>
|
|
||||||
{#if summary !== undefined}
|
|
||||||
<h1>
|
|
||||||
<SummaryView {summary} />
|
|
||||||
</h1>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if error != null}
|
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null}
|
|
||||||
<TreeView
|
|
||||||
access={{ key: "idcc" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeIdccProperties}
|
|
||||||
value={idcc}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
|
@ -1,21 +0,0 @@
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import type { Idcc } from "$lib/legal"
|
|
||||||
import { db } from "$lib/server/database"
|
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
|
||||||
const idcc = (
|
|
||||||
await db<{ data: Idcc }[]>`
|
|
||||||
SELECT data FROM idcc
|
|
||||||
WHERE id = ${params.id}
|
|
||||||
`
|
|
||||||
).map(({ data }) => data)[0]
|
|
||||||
|
|
||||||
if (idcc === undefined) {
|
|
||||||
return { status: 404 }
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
body: { idcc: idcc as unknown as JSONObject },
|
|
||||||
}
|
|
||||||
}
|
|
20
src/routes/idcc/[id]/+page.server.ts
Normal file
20
src/routes/idcc/[id]/+page.server.ts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import { error } from "@sveltejs/kit"
|
||||||
|
|
||||||
|
import type { Idcc } from "$lib/legal"
|
||||||
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
|
const idcc = (
|
||||||
|
await db<{ data: Idcc }[]>`
|
||||||
|
SELECT data FROM idcc
|
||||||
|
WHERE id = ${params.id}
|
||||||
|
`
|
||||||
|
).map(({ data }) => data)[0]
|
||||||
|
|
||||||
|
if (idcc === undefined) {
|
||||||
|
throw error(404, `IDCC ${params.id} non trouvé`)
|
||||||
|
}
|
||||||
|
return { idcc }
|
||||||
|
}
|
30
src/routes/idcc/[id]/+page.svelte
Normal file
30
src/routes/idcc/[id]/+page.svelte
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import { summarizeIdccProperties, summarizeLegalObject } from "$lib/summaries"
|
||||||
|
|
||||||
|
import type { PageData } from "./$types"
|
||||||
|
|
||||||
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ idcc } = data)
|
||||||
|
|
||||||
|
$: summary = summarizeLegalObject({ key: "idcc" }, "idcc", idcc)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="prose my-6 max-w-full">
|
||||||
|
<h2>IDCC</h2>
|
||||||
|
{#if summary !== undefined}
|
||||||
|
<h1>
|
||||||
|
<SummaryView {summary} />
|
||||||
|
</h1>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<TreeView
|
||||||
|
access={{ key: "idcc" }}
|
||||||
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeIdccProperties}
|
||||||
|
value={idcc}
|
||||||
|
/>
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { Jo } from "$lib/legal"
|
import type { Jo } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset } = query
|
const { limit, offset } = query
|
||||||
|
|
||||||
|
@ -65,7 +58,5 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
LIMIT ${limit}
|
LIMIT ${limit}
|
||||||
`
|
`
|
||||||
).map(({ data }) => data)
|
).map(({ data }) => data)
|
||||||
return {
|
return { jo: jos }
|
||||||
body: { jo: jos as unknown as JSONObject[] },
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,14 +4,14 @@
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
// import { page } from "$app/stores"
|
// import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import type { Jo } from "$lib/legal"
|
|
||||||
import { summarizeJoProperties } from "$lib/summaries"
|
import { summarizeJoProperties } from "$lib/summaries"
|
||||||
|
|
||||||
export let error: unknown
|
import type { PageData } from "./$types"
|
||||||
let jos: Jo[]
|
|
||||||
export { jos as jo }
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ jo: jos } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -51,18 +51,12 @@
|
||||||
</div>
|
</div>
|
||||||
</form> -->
|
</form> -->
|
||||||
|
|
||||||
{#if error != null}
|
<TreeView
|
||||||
<ErrorAlert {error} />
|
access={{ key: "jo" }}
|
||||||
{/if}
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeJoProperties}
|
||||||
|
value={jos}
|
||||||
|
/>
|
||||||
|
|
||||||
{#if error == null}
|
<Pagination currentPageCount={jos?.length ?? 0} />
|
||||||
<TreeView
|
|
||||||
access={{ key: "jo" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeJoProperties}
|
|
||||||
value={jos}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Pagination currentPageCount={jos.length ?? 0} />
|
|
||||||
{/if}
|
|
|
@ -1,35 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
|
||||||
|
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import type { Jo } from "$lib/legal"
|
|
||||||
import { summarizeJoProperties, summarizeLegalObject } from "$lib/summaries"
|
|
||||||
|
|
||||||
export let error: unknown
|
|
||||||
export let jo: Jo
|
|
||||||
|
|
||||||
const summary = summarizeLegalObject({ key: "jo" }, "jo", jo)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
|
||||||
<h2>JO</h2>
|
|
||||||
{#if summary !== undefined}
|
|
||||||
<h1>
|
|
||||||
<SummaryView {summary} />
|
|
||||||
</h1>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if error != null}
|
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null}
|
|
||||||
<TreeView
|
|
||||||
access={{ key: "jo" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeJoProperties}
|
|
||||||
value={jo}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
|
@ -1,21 +0,0 @@
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import type { Jo } from "$lib/legal"
|
|
||||||
import { db } from "$lib/server/database"
|
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
|
||||||
const jo = (
|
|
||||||
await db<{ data: Jo }[]>`
|
|
||||||
SELECT data FROM jo
|
|
||||||
WHERE id = ${params.id}
|
|
||||||
`
|
|
||||||
).map(({ data }) => data)[0]
|
|
||||||
|
|
||||||
if (jo === undefined) {
|
|
||||||
return { status: 404 }
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
body: { jo: jo as unknown as JSONObject },
|
|
||||||
}
|
|
||||||
}
|
|
20
src/routes/jo/[id]/+page.server.ts
Normal file
20
src/routes/jo/[id]/+page.server.ts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import { error } from "@sveltejs/kit"
|
||||||
|
|
||||||
|
import type { Jo } from "$lib/legal"
|
||||||
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
|
const jo = (
|
||||||
|
await db<{ data: Jo }[]>`
|
||||||
|
SELECT data FROM jo
|
||||||
|
WHERE id = ${params.id}
|
||||||
|
`
|
||||||
|
).map(({ data }) => data)[0]
|
||||||
|
|
||||||
|
if (jo === undefined) {
|
||||||
|
throw error(404, `JO ${params.id} non trouvé`)
|
||||||
|
}
|
||||||
|
return { jo }
|
||||||
|
}
|
30
src/routes/jo/[id]/+page.svelte
Normal file
30
src/routes/jo/[id]/+page.svelte
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import { summarizeJoProperties, summarizeLegalObject } from "$lib/summaries"
|
||||||
|
|
||||||
|
import type { PageData } from "./$types"
|
||||||
|
|
||||||
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ jo } = data)
|
||||||
|
|
||||||
|
$: summary = summarizeLegalObject({ key: "jo" }, "jo", jo)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="prose my-6 max-w-full">
|
||||||
|
<h2>JO</h2>
|
||||||
|
{#if summary !== undefined}
|
||||||
|
<h1>
|
||||||
|
<SummaryView {summary} />
|
||||||
|
</h1>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<TreeView
|
||||||
|
access={{ key: "jo" }}
|
||||||
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeJoProperties}
|
||||||
|
value={jo}
|
||||||
|
/>
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { Article } from "$lib/legal"
|
import type { Article } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset, q } = query
|
const { limit, offset, q } = query
|
||||||
|
|
||||||
|
@ -73,10 +66,8 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
WHERE id = ${articleId}
|
WHERE id = ${articleId}
|
||||||
`
|
`
|
||||||
).map(({ data }) => data)
|
).map(({ data }) => data)
|
||||||
return {
|
return { articles, q }
|
||||||
body: { articles: articles as unknown as JSONObject[], q },
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { body: {} }
|
return {}
|
||||||
}
|
}
|
|
@ -4,13 +4,14 @@
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
import { page } from "$app/stores"
|
import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import { summarizeArticleProperties } from "$lib/summaries"
|
import { summarizeArticleProperties } from "$lib/summaries"
|
||||||
|
|
||||||
export let articles: unknown[]
|
import type { PageData } from "./$types"
|
||||||
export let error: unknown
|
|
||||||
export let q: string | undefined
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ articles, q } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -33,11 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{#if error != null}
|
{#if q !== undefined}
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null && q !== undefined}
|
|
||||||
{#if articles === undefined}
|
{#if articles === undefined}
|
||||||
<p>Aucun article trouvé</p>
|
<p>Aucun article trouvé</p>
|
||||||
{:else}
|
{:else}
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { SectionTa } from "$lib/legal"
|
import type { SectionTa } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset } = query
|
const { limit, offset } = query
|
||||||
|
|
||||||
|
@ -65,7 +58,5 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
LIMIT ${limit}
|
LIMIT ${limit}
|
||||||
`
|
`
|
||||||
).map(({ data }) => data)
|
).map(({ data }) => data)
|
||||||
return {
|
return { section_ta: sectionTaArray }
|
||||||
body: { section_ta: sectionTaArray as unknown as JSONObject[] },
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,14 +4,14 @@
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
// import { page } from "$app/stores"
|
// import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import type { SectionTa } from "$lib/legal"
|
|
||||||
import { summarizeSectionTaProperties } from "$lib/summaries"
|
import { summarizeSectionTaProperties } from "$lib/summaries"
|
||||||
|
|
||||||
export let error: unknown
|
import type { PageData } from "./$types"
|
||||||
let sectionTaArray: SectionTa[]
|
|
||||||
export { sectionTaArray as section_ta }
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ section_ta: sectionTaArray } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -51,18 +51,12 @@
|
||||||
</div>
|
</div>
|
||||||
</form> -->
|
</form> -->
|
||||||
|
|
||||||
{#if error != null}
|
<TreeView
|
||||||
<ErrorAlert {error} />
|
access={{ key: "section_ta" }}
|
||||||
{/if}
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeSectionTaProperties}
|
||||||
|
value={sectionTaArray}
|
||||||
|
/>
|
||||||
|
|
||||||
{#if error == null}
|
<Pagination currentPageCount={sectionTaArray?.length ?? 0} />
|
||||||
<TreeView
|
|
||||||
access={{ key: "section_ta" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeSectionTaProperties}
|
|
||||||
value={sectionTaArray}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Pagination currentPageCount={sectionTaArray.length ?? 0} />
|
|
||||||
{/if}
|
|
|
@ -1,43 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
|
||||||
|
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import type { SectionTa } from "$lib/legal"
|
|
||||||
import {
|
|
||||||
summarizeSectionTaProperties,
|
|
||||||
summarizeLegalObject,
|
|
||||||
} from "$lib/summaries"
|
|
||||||
|
|
||||||
export let error: unknown
|
|
||||||
let sectionTa: SectionTa
|
|
||||||
export { sectionTa as section_ta }
|
|
||||||
|
|
||||||
const summary = summarizeLegalObject(
|
|
||||||
{ key: "section_ta" },
|
|
||||||
"section_ta",
|
|
||||||
sectionTa,
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
|
||||||
<h2>SECTION_TA</h2>
|
|
||||||
{#if summary !== undefined}
|
|
||||||
<h1>
|
|
||||||
<SummaryView {summary} />
|
|
||||||
</h1>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if error != null}
|
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null}
|
|
||||||
<TreeView
|
|
||||||
access={{ key: "section_ta" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeSectionTaProperties}
|
|
||||||
value={sectionTa}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
|
@ -1,10 +1,11 @@
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import type { SectionTa } from "$lib/legal"
|
import type { SectionTa } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
const sectionTa = (
|
const sectionTa = (
|
||||||
await db<{ data: SectionTa }[]>`
|
await db<{ data: SectionTa }[]>`
|
||||||
SELECT data FROM section_ta
|
SELECT data FROM section_ta
|
||||||
|
@ -13,9 +14,7 @@ export const GET: RequestHandler = async ({ params }) => {
|
||||||
).map(({ data }) => data)[0]
|
).map(({ data }) => data)[0]
|
||||||
|
|
||||||
if (sectionTa === undefined) {
|
if (sectionTa === undefined) {
|
||||||
return { status: 404 }
|
throw error(404, `Section TA ${params.id} non trouvée`)
|
||||||
}
|
|
||||||
return {
|
|
||||||
body: { section_ta: sectionTa as unknown as JSONObject },
|
|
||||||
}
|
}
|
||||||
|
return { section_ta: sectionTa }
|
||||||
}
|
}
|
37
src/routes/section_ta/[id]/+page.svelte
Normal file
37
src/routes/section_ta/[id]/+page.svelte
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import {
|
||||||
|
summarizeSectionTaProperties,
|
||||||
|
summarizeLegalObject,
|
||||||
|
} from "$lib/summaries"
|
||||||
|
|
||||||
|
import type { PageData } from "./$types"
|
||||||
|
|
||||||
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ section_ta: sectionTa } = data)
|
||||||
|
|
||||||
|
$: summary = summarizeLegalObject(
|
||||||
|
{ key: "section_ta" },
|
||||||
|
"section_ta",
|
||||||
|
sectionTa,
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="prose my-6 max-w-full">
|
||||||
|
<h2>SECTION_TA</h2>
|
||||||
|
{#if summary !== undefined}
|
||||||
|
<h1>
|
||||||
|
<SummaryView {summary} />
|
||||||
|
</h1>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<TreeView
|
||||||
|
access={{ key: "section_ta" }}
|
||||||
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeSectionTaProperties}
|
||||||
|
value={sectionTa}
|
||||||
|
/>
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { TexteVersion } from "$lib/legal"
|
import type { TexteVersion } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset } = query
|
const { limit, offset } = query
|
||||||
|
|
||||||
|
@ -65,7 +58,5 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
LIMIT ${limit}
|
LIMIT ${limit}
|
||||||
`
|
`
|
||||||
).map(({ data }) => data)
|
).map(({ data }) => data)
|
||||||
return {
|
return { texte_version: texteVersionArray }
|
||||||
body: { texte_version: texteVersionArray as unknown as JSONObject[] },
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,14 +4,14 @@
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
// import { page } from "$app/stores"
|
// import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import type { TexteVersion } from "$lib/legal"
|
|
||||||
import { summarizeTexteVersionProperties } from "$lib/summaries"
|
import { summarizeTexteVersionProperties } from "$lib/summaries"
|
||||||
|
|
||||||
export let error: unknown
|
import type { PageData } from "./$types"
|
||||||
let texteVersionArray: TexteVersion[]
|
|
||||||
export { texteVersionArray as texte_version }
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ texte_version: texteVersionArray } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -51,18 +51,12 @@
|
||||||
</div>
|
</div>
|
||||||
</form> -->
|
</form> -->
|
||||||
|
|
||||||
{#if error != null}
|
<TreeView
|
||||||
<ErrorAlert {error} />
|
access={{ key: "texte_version" }}
|
||||||
{/if}
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeTexteVersionProperties}
|
||||||
|
value={texteVersionArray}
|
||||||
|
/>
|
||||||
|
|
||||||
{#if error == null}
|
<Pagination currentPageCount={texteVersionArray?.length ?? 0} />
|
||||||
<TreeView
|
|
||||||
access={{ key: "texte_version" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeTexteVersionProperties}
|
|
||||||
value={texteVersionArray}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Pagination currentPageCount={texteVersionArray.length ?? 0} />
|
|
||||||
{/if}
|
|
|
@ -1,43 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
|
||||||
|
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import type { TexteVersion } from "$lib/legal"
|
|
||||||
import {
|
|
||||||
summarizeTexteVersionProperties,
|
|
||||||
summarizeLegalObject,
|
|
||||||
} from "$lib/summaries"
|
|
||||||
|
|
||||||
export let error: unknown
|
|
||||||
let texteVersion: TexteVersion
|
|
||||||
export { texteVersion as texte_version }
|
|
||||||
|
|
||||||
const summary = summarizeLegalObject(
|
|
||||||
{ key: "texte_version" },
|
|
||||||
"texte_version",
|
|
||||||
texteVersion,
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
|
||||||
<h2>TEXTE_VERSION</h2>
|
|
||||||
{#if summary !== undefined}
|
|
||||||
<h1>
|
|
||||||
<SummaryView {summary} />
|
|
||||||
</h1>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if error != null}
|
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null}
|
|
||||||
<TreeView
|
|
||||||
access={{ key: "texte_version" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeTexteVersionProperties}
|
|
||||||
value={texteVersion}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
|
@ -1,10 +1,11 @@
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import type { TexteVersion } from "$lib/legal"
|
import type { TexteVersion } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
const texteVersion = (
|
const texteVersion = (
|
||||||
await db<{ data: TexteVersion }[]>`
|
await db<{ data: TexteVersion }[]>`
|
||||||
SELECT data FROM texte_version
|
SELECT data FROM texte_version
|
||||||
|
@ -13,9 +14,7 @@ export const GET: RequestHandler = async ({ params }) => {
|
||||||
).map(({ data }) => data)[0]
|
).map(({ data }) => data)[0]
|
||||||
|
|
||||||
if (texteVersion === undefined) {
|
if (texteVersion === undefined) {
|
||||||
return { status: 404 }
|
throw error(404, `Texte version ${params.id} non trouvé`)
|
||||||
}
|
|
||||||
return {
|
|
||||||
body: { texte_version: texteVersion as unknown as JSONObject },
|
|
||||||
}
|
}
|
||||||
|
return { texte_version: texteVersion }
|
||||||
}
|
}
|
37
src/routes/texte_version/[id]/+page.svelte
Normal file
37
src/routes/texte_version/[id]/+page.svelte
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import {
|
||||||
|
summarizeTexteVersionProperties,
|
||||||
|
summarizeLegalObject,
|
||||||
|
} from "$lib/summaries"
|
||||||
|
|
||||||
|
import type { PageData } from "./$types"
|
||||||
|
|
||||||
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ texte_version: texteVersion } = data)
|
||||||
|
|
||||||
|
$: summary = summarizeLegalObject(
|
||||||
|
{ key: "texte_version" },
|
||||||
|
"texte_version",
|
||||||
|
texteVersion,
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="prose my-6 max-w-full">
|
||||||
|
<h2>TEXTE_VERSION</h2>
|
||||||
|
{#if summary !== undefined}
|
||||||
|
<h1>
|
||||||
|
<SummaryView {summary} />
|
||||||
|
</h1>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<TreeView
|
||||||
|
access={{ key: "texte_version" }}
|
||||||
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeTexteVersionProperties}
|
||||||
|
value={texteVersion}
|
||||||
|
/>
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { Textekali } from "$lib/legal"
|
import type { Textekali } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset } = query
|
const { limit, offset } = query
|
||||||
|
|
||||||
|
@ -65,7 +58,5 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
LIMIT ${limit}
|
LIMIT ${limit}
|
||||||
`
|
`
|
||||||
).map(({ data }) => data)
|
).map(({ data }) => data)
|
||||||
return {
|
return { textekali: textekaliArray }
|
||||||
body: { textekali: textekaliArray as unknown as JSONObject[] },
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,17 +1,21 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
throw new Error(
|
||||||
|
"@migration task: Add data prop (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292707)",
|
||||||
|
)
|
||||||
|
|
||||||
// import Icon from "@iconify/svelte"
|
// import Icon from "@iconify/svelte"
|
||||||
// import searchIcon from "@iconify-icons/codicon/search"
|
// import searchIcon from "@iconify-icons/codicon/search"
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
// import { page } from "$app/stores"
|
// import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import type { Textekali } from "$lib/legal"
|
|
||||||
import { summarizeTextekaliProperties } from "$lib/summaries"
|
import { summarizeTextekaliProperties } from "$lib/summaries"
|
||||||
|
|
||||||
export let error: unknown
|
import type { PageData } from "./$types"
|
||||||
let textekaliArray: Textekali[]
|
|
||||||
export { textekaliArray as textekali }
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ textekali: textekaliArray } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -51,18 +55,12 @@
|
||||||
</div>
|
</div>
|
||||||
</form> -->
|
</form> -->
|
||||||
|
|
||||||
{#if error != null}
|
<TreeView
|
||||||
<ErrorAlert {error} />
|
access={{ key: "textekali" }}
|
||||||
{/if}
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeTextekaliProperties}
|
||||||
|
value={textekaliArray}
|
||||||
|
/>
|
||||||
|
|
||||||
{#if error == null}
|
<Pagination currentPageCount={textekaliArray?.length ?? 0} />
|
||||||
<TreeView
|
|
||||||
access={{ key: "textekali" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeTextekaliProperties}
|
|
||||||
value={textekaliArray}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Pagination currentPageCount={textekaliArray.length ?? 0} />
|
|
||||||
{/if}
|
|
|
@ -1,42 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
|
||||||
|
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import type { Textekali } from "$lib/legal"
|
|
||||||
import {
|
|
||||||
summarizeTextekaliProperties,
|
|
||||||
summarizeLegalObject,
|
|
||||||
} from "$lib/summaries"
|
|
||||||
|
|
||||||
export let error: unknown
|
|
||||||
export let textekali: Textekali
|
|
||||||
|
|
||||||
const summary = summarizeLegalObject(
|
|
||||||
{ key: "textekali" },
|
|
||||||
"textekali",
|
|
||||||
textekali,
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
|
||||||
<h2>TEXTEKALI</h2>
|
|
||||||
{#if summary !== undefined}
|
|
||||||
<h1>
|
|
||||||
<SummaryView {summary} />
|
|
||||||
</h1>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if error != null}
|
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null}
|
|
||||||
<TreeView
|
|
||||||
access={{ key: "textekali" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeTextekaliProperties}
|
|
||||||
value={textekali}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
|
@ -1,10 +1,11 @@
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import type { Textekali } from "$lib/legal"
|
import type { Textekali } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
const textekali = (
|
const textekali = (
|
||||||
await db<{ data: Textekali }[]>`
|
await db<{ data: Textekali }[]>`
|
||||||
SELECT data FROM textekali
|
SELECT data FROM textekali
|
||||||
|
@ -13,9 +14,7 @@ export const GET: RequestHandler = async ({ params }) => {
|
||||||
).map(({ data }) => data)[0]
|
).map(({ data }) => data)[0]
|
||||||
|
|
||||||
if (textekali === undefined) {
|
if (textekali === undefined) {
|
||||||
return { status: 404 }
|
throw error(404, `Texte KALI ${params.id} non trouvé`)
|
||||||
}
|
|
||||||
return {
|
|
||||||
body: { textekali: textekali as unknown as JSONObject },
|
|
||||||
}
|
}
|
||||||
|
return { textekali }
|
||||||
}
|
}
|
37
src/routes/textekali/[id]/+page.svelte
Normal file
37
src/routes/textekali/[id]/+page.svelte
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import {
|
||||||
|
summarizeTextekaliProperties,
|
||||||
|
summarizeLegalObject,
|
||||||
|
} from "$lib/summaries"
|
||||||
|
|
||||||
|
import type { PageData } from "./$types"
|
||||||
|
|
||||||
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ textekali } = data)
|
||||||
|
|
||||||
|
$: summary = summarizeLegalObject(
|
||||||
|
{ key: "textekali" },
|
||||||
|
"textekali",
|
||||||
|
textekali,
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="prose my-6 max-w-full">
|
||||||
|
<h2>TEXTEKALI</h2>
|
||||||
|
{#if summary !== undefined}
|
||||||
|
<h1>
|
||||||
|
<SummaryView {summary} />
|
||||||
|
</h1>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<TreeView
|
||||||
|
access={{ key: "textekali" }}
|
||||||
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeTextekaliProperties}
|
||||||
|
value={textekali}
|
||||||
|
/>
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { Textelr } from "$lib/legal"
|
import type { Textelr } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset } = query
|
const { limit, offset } = query
|
||||||
|
|
||||||
|
@ -65,7 +58,5 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
LIMIT ${limit}
|
LIMIT ${limit}
|
||||||
`
|
`
|
||||||
).map(({ data }) => data)
|
).map(({ data }) => data)
|
||||||
return {
|
return { textelr: textelrArray }
|
||||||
body: { textelr: textelrArray as unknown as JSONObject[] },
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,14 +4,14 @@
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
// import { page } from "$app/stores"
|
// import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import type { Textelr } from "$lib/legal"
|
|
||||||
import { summarizeTextelrProperties } from "$lib/summaries"
|
import { summarizeTextelrProperties } from "$lib/summaries"
|
||||||
|
|
||||||
export let error: unknown
|
import type { PageData } from "./$types"
|
||||||
let textelrArray: Textelr[]
|
|
||||||
export { textelrArray as textelr }
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ textelr: textelrArray } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -51,18 +51,12 @@
|
||||||
</div>
|
</div>
|
||||||
</form> -->
|
</form> -->
|
||||||
|
|
||||||
{#if error != null}
|
<TreeView
|
||||||
<ErrorAlert {error} />
|
access={{ key: "textelr" }}
|
||||||
{/if}
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeTextelrProperties}
|
||||||
|
value={textelrArray}
|
||||||
|
/>
|
||||||
|
|
||||||
{#if error == null}
|
<Pagination currentPageCount={textelrArray?.length ?? 0} />
|
||||||
<TreeView
|
|
||||||
access={{ key: "textelr" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeTextelrProperties}
|
|
||||||
value={textelrArray}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Pagination currentPageCount={textelrArray.length ?? 0} />
|
|
||||||
{/if}
|
|
|
@ -1,38 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
|
||||||
|
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import type { Textelr } from "$lib/legal"
|
|
||||||
import {
|
|
||||||
summarizeTextelrProperties,
|
|
||||||
summarizeLegalObject,
|
|
||||||
} from "$lib/summaries"
|
|
||||||
|
|
||||||
export let error: unknown
|
|
||||||
export let textelr: Textelr
|
|
||||||
|
|
||||||
const summary = summarizeLegalObject({ key: "textelr" }, "textelr", textelr)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
|
||||||
<h2>TEXTELR</h2>
|
|
||||||
{#if summary !== undefined}
|
|
||||||
<h1>
|
|
||||||
<SummaryView {summary} />
|
|
||||||
</h1>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if error != null}
|
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null}
|
|
||||||
<TreeView
|
|
||||||
access={{ key: "textelr" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeTextelrProperties}
|
|
||||||
value={textelr}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
|
@ -1,21 +0,0 @@
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import type { Textelr } from "$lib/legal"
|
|
||||||
import { db } from "$lib/server/database"
|
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
|
||||||
const textelr = (
|
|
||||||
await db<{ data: Textelr }[]>`
|
|
||||||
SELECT data FROM textelr
|
|
||||||
WHERE id = ${params.id}
|
|
||||||
`
|
|
||||||
).map(({ data }) => data)[0]
|
|
||||||
|
|
||||||
if (textelr === undefined) {
|
|
||||||
return { status: 404 }
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
body: { textelr: textelr as unknown as JSONObject },
|
|
||||||
}
|
|
||||||
}
|
|
20
src/routes/textelr/[id]/+page.server.ts
Normal file
20
src/routes/textelr/[id]/+page.server.ts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import { error } from "@sveltejs/kit"
|
||||||
|
|
||||||
|
import type { Textelr } from "$lib/legal"
|
||||||
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
|
const textelr = (
|
||||||
|
await db<{ data: Textelr }[]>`
|
||||||
|
SELECT data FROM textelr
|
||||||
|
WHERE id = ${params.id}
|
||||||
|
`
|
||||||
|
).map(({ data }) => data)[0]
|
||||||
|
|
||||||
|
if (textelr === undefined) {
|
||||||
|
throw error(404, `Texte LR ${params.id} non trouvé`)
|
||||||
|
}
|
||||||
|
return { textelr: textelr }
|
||||||
|
}
|
33
src/routes/textelr/[id]/+page.svelte
Normal file
33
src/routes/textelr/[id]/+page.svelte
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import {
|
||||||
|
summarizeTextelrProperties,
|
||||||
|
summarizeLegalObject,
|
||||||
|
} from "$lib/summaries"
|
||||||
|
|
||||||
|
import type { PageData } from "./$types"
|
||||||
|
|
||||||
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ textelr: textelr } = data)
|
||||||
|
|
||||||
|
$: summary = summarizeLegalObject({ key: "textelr" }, "textelr", textelr)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="prose my-6 max-w-full">
|
||||||
|
<h2>TEXTELR</h2>
|
||||||
|
{#if summary !== undefined}
|
||||||
|
<h1>
|
||||||
|
<SummaryView {summary} />
|
||||||
|
</h1>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<TreeView
|
||||||
|
access={{ key: "textelr" }}
|
||||||
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeTextelrProperties}
|
||||||
|
value={textelr}
|
||||||
|
/>
|
|
@ -1,11 +1,12 @@
|
||||||
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
import { type Audit, auditSetNullish, cleanAudit } from "@auditors/core"
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
import { auditSearchQueryContent } from "$lib/auditors/queries"
|
||||||
import type { VersionsWrapper } from "$lib/legal"
|
import type { VersionsWrapper } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export function auditQuery(
|
export function auditQuery(
|
||||||
audit: Audit,
|
audit: Audit,
|
||||||
query: URLSearchParams,
|
query: URLSearchParams,
|
||||||
|
@ -33,7 +34,7 @@ export function auditQuery(
|
||||||
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
return audit.reduceRemaining(data, errors, remainingKeys, auditSetNullish({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const load: PageServerLoad = async ({ url }) => {
|
||||||
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
const [query, queryError] = auditQuery(cleanAudit, url.searchParams) as [
|
||||||
{ limit: number; offset: number; q?: string },
|
{ limit: number; offset: number; q?: string },
|
||||||
unknown,
|
unknown,
|
||||||
|
@ -46,15 +47,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
2,
|
2,
|
||||||
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
)}\n\nError:\n${JSON.stringify(queryError, null, 2)}`,
|
||||||
)
|
)
|
||||||
return {
|
throw error(400, JSON.stringify(queryError, null, 2))
|
||||||
// status: 400,
|
|
||||||
|
|
||||||
body: {
|
|
||||||
error: {
|
|
||||||
query: queryError as unknown as JSONObject,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const { limit, offset } = query
|
const { limit, offset } = query
|
||||||
|
|
||||||
|
@ -63,7 +56,5 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
OFFSET ${offset}
|
OFFSET ${offset}
|
||||||
LIMIT ${limit}
|
LIMIT ${limit}
|
||||||
`
|
`
|
||||||
return {
|
return { versions: versionsWrapper }
|
||||||
body: { versions: versionsWrapper as unknown as JSONObject[] },
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,14 +4,14 @@
|
||||||
import { TreeView } from "augmented-data-viewer"
|
import { TreeView } from "augmented-data-viewer"
|
||||||
|
|
||||||
// import { page } from "$app/stores"
|
// import { page } from "$app/stores"
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import Pagination from "$lib/components/Pagination.svelte"
|
import Pagination from "$lib/components/Pagination.svelte"
|
||||||
import type { VersionsWrapper } from "$lib/legal"
|
|
||||||
import { summarizeVersionsWrapperProperties } from "$lib/summaries"
|
import { summarizeVersionsWrapperProperties } from "$lib/summaries"
|
||||||
|
|
||||||
let versionsWrapper: VersionsWrapper[]
|
import type { PageData } from "./$types"
|
||||||
export { versionsWrapper as versions }
|
|
||||||
export let error: unknown
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ versions: versionsWrapper } = data)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
<header class="prose my-6 max-w-full">
|
||||||
|
@ -51,18 +51,12 @@
|
||||||
</div>
|
</div>
|
||||||
</form> -->
|
</form> -->
|
||||||
|
|
||||||
{#if error != null}
|
<TreeView
|
||||||
<ErrorAlert {error} />
|
access={{ key: "versions" }}
|
||||||
{/if}
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeVersionsWrapperProperties}
|
||||||
|
value={versionsWrapper}
|
||||||
|
/>
|
||||||
|
|
||||||
{#if error == null}
|
<Pagination currentPageCount={versionsWrapper.length ?? 0} />
|
||||||
<TreeView
|
|
||||||
access={{ key: "versions" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeVersionsWrapperProperties}
|
|
||||||
value={versionsWrapper}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Pagination currentPageCount={versionsWrapper.length ?? 0} />
|
|
||||||
{/if}
|
|
|
@ -1,43 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
|
||||||
|
|
||||||
import ErrorAlert from "$lib/components/errors/ErrorAlert.svelte"
|
|
||||||
import type { VersionsWrapper } from "$lib/legal"
|
|
||||||
import {
|
|
||||||
summarizeVersionsWrapperProperties,
|
|
||||||
summarizeLegalObject,
|
|
||||||
} from "$lib/summaries"
|
|
||||||
|
|
||||||
export let error: unknown
|
|
||||||
let versionsWrapper: VersionsWrapper
|
|
||||||
export { versionsWrapper as versions }
|
|
||||||
|
|
||||||
const summary = summarizeLegalObject(
|
|
||||||
{ key: "versions" },
|
|
||||||
"versions",
|
|
||||||
versionsWrapper,
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="prose my-6 max-w-full">
|
|
||||||
<h2>VERSIONS</h2>
|
|
||||||
{#if summary !== undefined}
|
|
||||||
<h1>
|
|
||||||
<SummaryView {summary} />
|
|
||||||
</h1>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if error != null}
|
|
||||||
<ErrorAlert {error} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if error == null}
|
|
||||||
<TreeView
|
|
||||||
access={{ key: "article" }}
|
|
||||||
frame={false}
|
|
||||||
open
|
|
||||||
summarize={summarizeVersionsWrapperProperties}
|
|
||||||
value={versionsWrapper}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
|
@ -1,10 +1,11 @@
|
||||||
import type { RequestHandler } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { JSONObject } from "@sveltejs/kit/types/private"
|
|
||||||
|
|
||||||
import type { VersionsWrapper } from "$lib/legal"
|
import type { VersionsWrapper } from "$lib/legal"
|
||||||
import { db } from "$lib/server/database"
|
import { db } from "$lib/server/database"
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
import type { PageServerLoad } from "./$types"
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
const versionsWrapper = (
|
const versionsWrapper = (
|
||||||
await db<{ data: VersionsWrapper }[]>`
|
await db<{ data: VersionsWrapper }[]>`
|
||||||
SELECT eli, id, data FROM versions
|
SELECT eli, id, data FROM versions
|
||||||
|
@ -13,9 +14,7 @@ export const GET: RequestHandler = async ({ params }) => {
|
||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
if (versionsWrapper === undefined) {
|
if (versionsWrapper === undefined) {
|
||||||
return { status: 404 }
|
throw error(404, `Versions ${params.eli} non trouvé`)
|
||||||
}
|
|
||||||
return {
|
|
||||||
body: { versions: versionsWrapper as unknown as JSONObject },
|
|
||||||
}
|
}
|
||||||
|
return { versions: versionsWrapper }
|
||||||
}
|
}
|
37
src/routes/versions/[...eli]/+page.svelte
Normal file
37
src/routes/versions/[...eli]/+page.svelte
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import {
|
||||||
|
summarizeVersionsWrapperProperties,
|
||||||
|
summarizeLegalObject,
|
||||||
|
} from "$lib/summaries"
|
||||||
|
|
||||||
|
import type { PageData } from "./$types"
|
||||||
|
|
||||||
|
export let data: PageData
|
||||||
|
|
||||||
|
$: ({ versions: versionsWrapper } = data)
|
||||||
|
|
||||||
|
$: summary = summarizeLegalObject(
|
||||||
|
{ key: "versions" },
|
||||||
|
"versions",
|
||||||
|
versionsWrapper,
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="prose my-6 max-w-full">
|
||||||
|
<h2>VERSIONS</h2>
|
||||||
|
{#if summary !== undefined}
|
||||||
|
<h1>
|
||||||
|
<SummaryView {summary} />
|
||||||
|
</h1>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<TreeView
|
||||||
|
access={{ key: "article" }}
|
||||||
|
frame={false}
|
||||||
|
open
|
||||||
|
summarize={summarizeVersionsWrapperProperties}
|
||||||
|
value={versionsWrapper}
|
||||||
|
/>
|
|
@ -4,6 +4,7 @@ const typography = require("@tailwindcss/typography")
|
||||||
const config = {
|
const config = {
|
||||||
content: [
|
content: [
|
||||||
"./src/**/*.{html,js,svelte,ts}",
|
"./src/**/*.{html,js,svelte,ts}",
|
||||||
|
"./node_modules/@tricoteuses/explorer-tools/**/*.{html,js,svelte,ts}",
|
||||||
"./node_modules/augmented-data-viewer/**/*.{html,js,svelte,ts}",
|
"./node_modules/augmented-data-viewer/**/*.{html,js,svelte,ts}",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue