Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette committed Dec 19, 2023
1 parent c34904a commit 122a30a
Show file tree
Hide file tree
Showing 5 changed files with 114,560 additions and 160 deletions.
2 changes: 1 addition & 1 deletion components/folders/HeroSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Breadcrumbs from "@mui/material/Breadcrumbs";
import EnergyIcon from "@/icons/EnergyIcon";
import LabelChip from "@/components/LabelChip";
import StatusChip from "@/components/StatusChip";
import { getCurrentStatus, statusInfo } from "@/repository/dataTransform";
import { getCurrentStatus, statusInfo } from "@/domain/dataTransform";

const breadcrumbs = [
<Link key="1" href="/">
Expand Down
7 changes: 3 additions & 4 deletions components/folders/TimelineCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@ import Stack from "@mui/material/Stack";

import { CardLayout } from "@/components/folders/CardLayout";
import StatusChip from "@/components/StatusChip";
import { ActLegislatif, Document } from "@/repository/database";
import { ActeLegislatif, Document } from "@/repository/types";
import { Link } from "@mui/material";
import { getDocumentURL } from "@/repository/dataTransform";
import { getDocumentURL } from "@/domain/dataTransform";

export const TimelineCard = ({
acts,
documents,
}: {
acts: ActLegislatif[];
acts: ActeLegislatif[];
documents: Record<string, Document>;
}) => {

return (
<CardLayout title="Chronologie du dossier">
<Timeline
Expand Down
4 changes: 2 additions & 2 deletions repository/dataTransform.ts → domain/dataTransform.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Status } from "@/components/StatusChip";
import { ActLegislatif, Document } from "./database";
import { ActeLegislatif, Document } from "../repository/types";

export function getDocumentURL(document?: Document) {
if (!document || !document?.legislature || !document.numNotice) {
Expand Down Expand Up @@ -28,7 +28,7 @@ export const statusInfo: Record<string, { label: string; status: Status }> = {
PROM: { label: "Promulguée", status: "validated" },
};

export function getCurrentStatus(acts: ActLegislatif[]) {
export function getCurrentStatus(acts: ActeLegislatif[]) {
const codes = acts.map((act) => act.codeActe);

for (let i = 0; i < statusOrder.length; i += 1) {
Expand Down
158 changes: 5 additions & 153 deletions repository/database.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import knex from "knex";
import config from "./knexfile";
import { AN1_COM_FOND, ActeLegislatif, AN1_COM_FOND_NOMIN } from "./Acts";
import { AN1_COM_FOND, AN1_COM_FOND_NOMIN } from "./Acts";
import { Dossier, ActeLegislatif, Organe, Acteur } from "./types";

const db = knex(config.development);

Expand All @@ -16,156 +17,10 @@ export async function listTables() {
}
}

export interface DossierRow {
uid: string;
xsiType: string;
legislature: string;
senatChemin: string;
titre: string;
titreChemin: string;
theme: string | null;
codeProcedure: string;
libelleProcedure: string;
causeFusionDossier: string | null;
dossierAbsorbantRefUid: string | null;
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 type Document = {
titrePrincipal: string;
titrePrincipalCourt: string;
uid: string;
classeCode: string;
classeLibelle: string;
texteDeLoi: boolean;
depotCode: string;
depotLibelle: string;
especeCode: string;
especeLibelle: string;
sousTypeCode: string;
sousTypeLibelle: string;
sousTypeLibelleEdition: string;
statutAdoption: null | string;
niveauCorrection: null | string;
typeCorrection: null | string;
dateCreation: Date;
dateDepot: Date;
datePublication: Date;
datePublicationWeb: Date;
denominationStructurelle: string;
amendable: null | string;
dian: null | string;
isbn: null | string;
nbPage: null | string;
prix: null | string;
legislature: string;
adoptionConforme: boolean;
formule: string;
numNotice: string;
provenance: string;
xsiType: string;
auteurUid: string;
documentParentRefUid: null;
};

export type Organe = {
uid: string;
codeType: string;
libelle: string;
libelleEdition: string;
libelleAbrege: string;
libelleAbrev: string;
organeParentRefUid: null | string;
regime: null | string;
legislature: null | string;
secretaire01: null | string;
secretaire02: null | string;
regimeJuridique: null | string;
siteInternet: null | string;
nombreReunionsAnnuelles: null | string;
positionPolitique: null | string;
preseance: null | string;
couleurAssociee: null | string;
dateDebut: null | Date;
dateAgrement: null | Date;
dateFin: null | Date;
xsiType: string;
};

export type Acteur = {
uid: string;
prenom: string;
nom: string;
civ: string;
dateNais: Date;
dateDeces: null;
villeNais: string;
depNais: string;
paysNais: string;
profession: string;
catSocPro: string;
famSocPro: string;
slug: string;
uriHatvp: null | string;
deputeActif: boolean;
deputeGroupeParlementaireUid: null | string;
mandatPrincipalUid: null | string;
};

export async function getDossiers(
{ legislature = 16 },
limit = 10
): Promise<DossierRow[]> {
): Promise<Dossier[]> {
try {
const rows = await db
.select("*")
Expand All @@ -184,7 +39,7 @@ export async function getDossier(
id: string
): Promise<
| {
dossier: DossierRow;
dossier: Dossier;
/**
* uid de la commission saisie sur le fond.
* Données à ércupérer dans organes.
Expand Down Expand Up @@ -322,10 +177,7 @@ export async function getDossier(
}
}

export async function getTable(
table: string,
limit = 10
): Promise<DossierRow[]> {
export async function getTable(table: string, limit = 10): Promise<Dossier[]> {
try {
const rows = await db
.select("*")
Expand Down
Loading

0 comments on commit 122a30a

Please # to comment.