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 { TypeEvenement } from "./TypeEvenement";
export type EvenementFamille = {
export type EvenementFamille = Readonly<{
notionId: string;
notionIdFamille: string;
Évènement: string;
Date: Date | null;
Type: TypeEvenement;
"Enfants concernés": string;
};
}>;
export function isProcedurePenale(evenement: EvenementFamille): boolean {
return categorieEvenement[evenement.Type] === "Procédure Pénale";

View file

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

View file

@ -49,7 +49,7 @@ function checkFamilyDataConsistency(family: Famille): ConsistencyReport {
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({
familyId: family.Titre,
issueType: "Date Intégration > date Sortie ",