diff --git a/backend/src/main/java/org/raddatz/familienarchiv/exception/ErrorCode.java b/backend/src/main/java/org/raddatz/familienarchiv/exception/ErrorCode.java index bea7cf66..38ff8f98 100644 --- a/backend/src/main/java/org/raddatz/familienarchiv/exception/ErrorCode.java +++ b/backend/src/main/java/org/raddatz/familienarchiv/exception/ErrorCode.java @@ -122,6 +122,8 @@ public enum ErrorCode { CIRCULAR_RELATIONSHIP, /** A relationship with the same (person, relatedPerson, type) already exists. 409 */ DUPLICATE_RELATIONSHIP, + /** A relationship's toDate is before its fromDate. 400 */ + INVALID_RELATIONSHIP_DATES, // --- Geschichten (Stories) --- /** A Geschichte (story) with the given ID does not exist, or is a DRAFT and the caller lacks BLOG_WRITE. 404 */ diff --git a/frontend/messages/de.json b/frontend/messages/de.json index 91bc789d..e09aa9ac 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -651,6 +651,7 @@ "error_invalid_date_range": "Das Enddatum darf nicht vor dem Startdatum liegen.", "error_birth_after_death": "Geburtsdatum muss vor dem Sterbedatum liegen. Tipp: Falls nur das Todesjahr bekannt ist und der Geburtstag spät im selben Jahr lag, bitte das Folgejahr eintragen.", "error_invalid_date_precision": "Datum und Genauigkeit stimmen nicht überein.", + "error_invalid_relationship_dates": "Das Ende-Datum darf nicht vor dem Beginn-Datum liegen.", "validation_last_name_required": "Nachname ist Pflichtfeld.", "validation_first_name_required": "Vorname ist Pflichtfeld.", "error_ocr_service_unavailable": "Der OCR-Dienst ist nicht verfügbar.", diff --git a/frontend/messages/en.json b/frontend/messages/en.json index b9add670..3f8a4132 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -651,6 +651,7 @@ "error_invalid_date_range": "The end date must not be before the start date.", "error_birth_after_death": "Birth date must be before death date. Tip: if only the death year is known and the birthday is late in the same year, enter the following year.", "error_invalid_date_precision": "Date and precision do not match.", + "error_invalid_relationship_dates": "The end date must not be before the start date.", "validation_last_name_required": "Last name is required.", "validation_first_name_required": "First name is required.", "error_ocr_service_unavailable": "The OCR service is not available.", diff --git a/frontend/messages/es.json b/frontend/messages/es.json index f015c6d5..24df3c02 100644 --- a/frontend/messages/es.json +++ b/frontend/messages/es.json @@ -651,6 +651,7 @@ "error_invalid_date_range": "La fecha final no puede ser anterior a la inicial.", "error_birth_after_death": "La fecha de nacimiento debe ser anterior a la de defunción.", "error_invalid_date_precision": "La fecha y la precisión no coinciden.", + "error_invalid_relationship_dates": "La fecha de fin no puede ser anterior a la de inicio.", "validation_last_name_required": "El apellido es obligatorio.", "validation_first_name_required": "El nombre es obligatorio.", "error_ocr_service_unavailable": "El servicio OCR no está disponible.", diff --git a/frontend/src/lib/shared/errors.ts b/frontend/src/lib/shared/errors.ts index 9bd6fd66..41935c7d 100644 --- a/frontend/src/lib/shared/errors.ts +++ b/frontend/src/lib/shared/errors.ts @@ -10,6 +10,7 @@ export type ErrorCode = | 'INVALID_PERSON_TYPE' | 'BIRTH_AFTER_DEATH' | 'INVALID_DATE_PRECISION' + | 'INVALID_RELATIONSHIP_DATES' | 'INVALID_DATE_RANGE' | 'DOCUMENT_NOT_FOUND' | 'DOCUMENT_NO_FILE' @@ -106,6 +107,8 @@ export function getErrorMessage(code: ErrorCode | string | undefined): string { return m.error_birth_after_death(); case 'INVALID_DATE_PRECISION': return m.error_invalid_date_precision(); + case 'INVALID_RELATIONSHIP_DATES': + return m.error_invalid_relationship_dates(); case 'INVALID_DATE_RANGE': return m.error_invalid_date_range(); case 'DOCUMENT_NOT_FOUND':