DB-4 (medium): ICU German collation de-x-icu auf deutschen Textspalten Gerbil.Name, Gerbil.NameSearch, Gerbil.OriginBreeder, ColorVariety.Name, Contact.Name. Korrekte ä/ö/ü-Sortierung + locale-aware lower() in Postgres. Nur bei Npgsql (Database.ProviderName check) — SQLite-Testhost kennt keine eigenen Collation-Namen und wuerde EnsureCreated fail lassen. Migration AddGermanCollation (ALTER COLUMN ... TYPE text COLLATE de-x-icu). DB-5 (low): Litter.ExternalRef + filtered unique index + Importer-Anbindung Litter.ExternalRef (string?, nullable) = stable import source id (sl.Id). Filtered unique index WHERE ExternalRef IS NOT NULL (wie DB-1 fuer Gerbil). Migration AddLitterExternalRef. Importer (ImportService.cs): setzt ExternalRef = sl.Id beim Litter-Insert; prueft existingLitterExtRefSet als PRIMAEREN Idempotenz-Key (ExternalRef), Name+Date-Key als Fallback fuer Wuerfe ohne ExternalRef aus frueheren Laeufen. +Test DB5_Litter_ExternalRef_set_and_used_for_idempotency (mutiert den Namen nach erstem Import, prueft dass Re-Import via ExternalRef erkennt). GATE: 140/140 C#, has-pending=No.
35 lines
1.4 KiB
C#
35 lines
1.4 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace GerbilManagerWebAPI.Models
|
|
{
|
|
/// <summary>A litter (Wurf). Parents are gerbils; juveniles are Gerbils linked via Gerbil.LitterId.</summary>
|
|
public class Litter
|
|
{
|
|
[Key]
|
|
public Guid Id { get; set; }
|
|
public required string Name { get; set; }
|
|
public DateOnly Date { get; set; }
|
|
|
|
/// <summary>Total born count (was "Strength").</summary>
|
|
public int? TotalBorn { get; set; }
|
|
|
|
public Guid? FatherId { get; set; }
|
|
public Gerbil? Father { get; set; }
|
|
public Guid? MotherId { get; set; }
|
|
public Gerbil? Mother { get; set; }
|
|
|
|
/// <summary>Computed ~35 days after Date by default; editable.</summary>
|
|
public DateOnly? ExpectedGoHomeDate { get; set; }
|
|
public string? Notes { get; set; }
|
|
|
|
/// <summary>Zuchtnummer der Verpaarung (Wurfchronik col H) — pairing-level code;
|
|
/// litters sharing it are the same Zuchtpaar. Set by the FEAT-8 import.</summary>
|
|
public string? PairingCode { get; set; }
|
|
|
|
/// <summary>DB-5: stable import source id (extract.py litter Id). Unique (filtered,
|
|
/// nulls allowed for manually-entered litters). Primary idempotency key for re-imports;
|
|
/// Name+Date is the fallback for litters created before this column existed.</summary>
|
|
public string? ExternalRef { get; set; }
|
|
}
|
|
}
|