feat: readonly data

This commit is contained in:
Sébastien Arod 2024-09-06 13:33:16 +02:00
parent e4af267c4f
commit 24d20a4fe0
3 changed files with 5 additions and 5 deletions

View file

@ -2,14 +2,14 @@ import { Period } from "../period/Period";
import { isPeriodContaining } from "../period/isPeriodContaining"; import { isPeriodContaining } from "../period/isPeriodContaining";
import { TypeEvenement } from "./TypeEvenement"; import { TypeEvenement } from "./TypeEvenement";
export type EvenementFamille = { export type EvenementFamille = Readonly<{
notionId: string; notionId: string;
notionIdFamille: string; notionIdFamille: string;
Évènement: string; Évènement: string;
Date: Date | null; Date: Date | null;
Type: TypeEvenement; Type: TypeEvenement;
"Enfants concernés": string; "Enfants concernés": string;
}; }>;
export function isProcedurePenale(evenement: EvenementFamille): boolean { export function isProcedurePenale(evenement: EvenementFamille): boolean {
return categorieEvenement[evenement.Type] === "Procédure Pénale"; return categorieEvenement[evenement.Type] === "Procédure Pénale";

View file

@ -6,7 +6,7 @@ import { ContexteEntreeDC } from "./ContexteEntreeDC";
import { EvenementFamille } from "./EvenementFamille"; import { EvenementFamille } from "./EvenementFamille";
import { StatutFamille } from "./StatutFamille"; import { StatutFamille } from "./StatutFamille";
export type Famille = { export type Famille = Readonly<{
notionId: string; notionId: string;
Titre: string; Titre: string;
Statut: StatutFamille; Statut: StatutFamille;
@ -15,7 +15,7 @@ export type Famille = {
Sortie: Date | null; Sortie: Date | null;
// sorted by date asc // sorted by date asc
Evenements: EvenementFamille[]; Evenements: EvenementFamille[];
}; }>;
export function periodOfResistance( export function periodOfResistance(
family: Famille, family: Famille,

View file

@ -49,7 +49,7 @@ function checkFamilyDataConsistency(family: Famille): ConsistencyReport {
issueType: "Ex résistant.e.s sans date Sortie", issueType: "Ex résistant.e.s sans date Sortie",
}); });
} }
if (family.Integration! > family.Sortie!) { if (family.Integration && family.Sortie && family.Integration > family.Sortie) {
consistencyErrors.push({ consistencyErrors.push({
familyId: family.Titre, familyId: family.Titre,
issueType: "Date Intégration > date Sortie ", issueType: "Date Intégration > date Sortie ",