diff --git a/app/[legislature]/dossier/[id]/page.tsx b/app/[legislature]/dossier/[id]/page.tsx
index 8e135fe..cf0bd8c 100644
--- a/app/[legislature]/dossier/[id]/page.tsx
+++ b/app/[legislature]/dossier/[id]/page.tsx
@@ -10,6 +10,9 @@ export default async function Page({
params: { legislature: string; id: string };
}) {
const dossier = await getDossier(params.legislature, params.id);
- console.log({ params, dossier });
- return ;
+
+ if (dossier === undefined) {
+ return
Dossier Not Found
;
+ }
+ return ;
}
diff --git a/components/folders/PreviewTab.tsx b/components/folders/PreviewTab.tsx
index 5a551d3..52bafd0 100644
--- a/components/folders/PreviewTab.tsx
+++ b/components/folders/PreviewTab.tsx
@@ -13,7 +13,8 @@ import { SpeakingTime } from "@/components/folders/SpeakingTime";
import Container from "@mui/material/Container";
import Stack from "@mui/material/Stack";
-export const PreviewTab = () => {
+export const PreviewTab = (props) => {
+ console.log(props);
return (
{
-
+
diff --git a/components/folders/TimelineCard.tsx b/components/folders/TimelineCard.tsx
index c09dfd3..667fc47 100644
--- a/components/folders/TimelineCard.tsx
+++ b/components/folders/TimelineCard.tsx
@@ -14,7 +14,10 @@ import Stack from "@mui/material/Stack";
import { CardLayout } from "@/components/folders/CardLayout";
import StatusChip from "@/components/StatusChip";
-export const TimelineCard = () => {
+export const TimelineCard = ({ acts }) => {
+ // console.log(acts.map((act) => act.dateActe));
+ console.log(acts);
+
return (
{
},
}}
>
+ {acts.map((act) => {
+ const title = act.nomCanonique || act.codeActe;
+
+ return (
+
+
+
+ {act.dateActe
+ ? act.dateActe.toLocaleDateString("fr-FR", {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
+ })
+ : "?"}
+
+
+
+
+
+
+
+
+
+ {title}
+
+
+ {act.texteAdopteRefUid && (
+
+
+ text: {act.texteAdopteRefUid}
+
+
+
+ )}
+ {act.texteAssocieRefUid && (
+
+ Text associé: {act.texteAssocieRefUid}
+
+ )}
+
+
+
+ );
+ })}
diff --git a/repository/database.ts b/repository/database.ts
index 958087c..daab1d7 100644
--- a/repository/database.ts
+++ b/repository/database.ts
@@ -30,6 +30,56 @@ export interface DossierRow {
organeRefUid: string | null;
}
+export interface ActLegislatif {
+ uid: string;
+ codeActe: string;
+ nomCanonique: string;
+ libelleCourtActe: string;
+ xsiType: string;
+ dateActe: Date | null;
+ organeRefUid: string;
+ organeProvenanceRefUid: string | null;
+ famCodeStatutConclusion: string | null;
+ libelleStatutConclusion: string | null;
+ famCodeCasSaisine: string | null;
+ libelleCasSaisine: string | null;
+ anneeDecisionConseilConstitutionnel: string | null;
+ urlConclusionConseilConstitutionnel: string | null;
+ motifConseilConstitutionnel: string | null;
+ numDecisionConseilConstitutionnel: string | null;
+ auteurMotionRefUid: string | null;
+ famCodeTypeMotion: string | null;
+ libelleTypeMotion: string | null;
+ famCodeTypeMotionCensure: string | null;
+ libelleTypeMotionCensure: string | null;
+ famCodeDecision: string | null;
+ libelleDecision: string | null;
+ formuleDecision: string | null;
+ codeLoiRefUid: string | null;
+ dateJo: string | null;
+ numJo: string | null;
+ referenceNor: string | null;
+ typeJo: string | null;
+ urlLegifrance: string | null;
+ titreLoi: string | null;
+ urlEcheancierLoi: string | null;
+ dateFermetureContributionInternaute: string | null;
+ dateOuvertureContributionInternaute: string | null;
+ dateJoce: string | null;
+ refJoce: string | null;
+ titreTexteEuropeen: string | null;
+ typeTexteEuropeen: string | null;
+ odjRefUid: string | null;
+ reunionRefUid: string | null;
+ famCodeStatutAdoption: string | null;
+ libelleStatutAdoption: string | null;
+ texteAdopteRefUid: string | null;
+ texteAssocieRefUid: string;
+ famCodeStatutTypeDeclaration: string | null;
+ libelleStatutTypeDeclaration: string | null;
+ dossierRefUid: string;
+}
+
export async function getDossiers(
{ legislature = 16 },
limit = 10
@@ -50,15 +100,25 @@ export async function getDossiers(
export async function getDossier(
legislature: string,
id: string
-): Promise {
+): Promise<{ dossier: DossierRow; acts: ActLegislatif[] } | undefined> {
try {
- const rows = await db
+ const dossiers = await db
.select("*")
.from("Dossier")
.where("legislature", "=", legislature)
.where("uid", "=", id);
- return rows[0];
+ const dossier = dossiers[0];
+ if (dossier === undefined) {
+ return undefined;
+ }
+
+ const acts = await db
+ .select("*")
+ .from("ActeLegislatif")
+ .where("dossierRefUid", "=", dossier.uid);
+
+ return { dossier, acts };
} catch (error) {
console.error("Error fetching rows from Dossier:", error);
throw error;