Per hive/agents/god/OWNERSHIP-residency.md (Julian): "Clan kleine Chaoten"
is the wife's own Zucht. Classify each animal:
(a) RESIDENT if zuchtCanon contains 'kleinechaote' (separator/declension-
insensitive: "v.d. Kleinen Chaoten", "Clan-Kleine-Chaoten", …); OR
(b) PARENT EXCEPTION — a parent of a Clan offspring is resident even if its
own Zuchtname is foreign (you can only breed a Clan litter if the parents
were in your care). Runs AFTER the parentRefs→litter linking.
Otherwise EXTERNAL (pedigree ancestor, not living stock — kept, not deleted).
Stored as a dedicated Gerbil.IsResident bool (distinct from Status/Abgabe —
origin/identity, not current location), defaulting true (own stock unless
marked external; DB HasDefaultValue(true)). Additive migration
AddGerbilResidency; has-pending-model-changes clean. Round-trips in
GerbilDto/GerbilInput and is Gridify-filterable (isResident==true) so Kevin
can build a "nur Bestand" filter. ImportService computes it at (re-)import
and refreshes existing rows on the idempotent sweep. ResidencySummary added
to the import report.
Projected on real data: 306 loadable → 227 resident (188 rule a, +39 via
parent exception), 79 external ancestors.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
107 lines
3.5 KiB
C#
107 lines
3.5 KiB
C#
using GerbilManagerWebAPI.Models;
|
|
|
|
namespace GerbilManagerWebAPI.Dtos
|
|
{
|
|
// Response DTOs ----------------------------------------------------------
|
|
// Enums serialise as string names; JSON property names are camelCase (configured
|
|
// globally in Program.cs). FK references are FLAT ids (no nested objects) per the
|
|
// frontend contract (Kelly's pedigree + Oscar's filters depend on this).
|
|
|
|
public record GerbilDto(
|
|
Guid Id,
|
|
string Name,
|
|
Gender Gender,
|
|
GerbilStatus Status,
|
|
Guid? LitterId,
|
|
Guid? OriginContactId,
|
|
Guid? ReceiverContactId,
|
|
Guid? EnclosureId,
|
|
Guid? ColorVarietyId,
|
|
DateOnly? DateOfBirth,
|
|
DateOnly? DateOfDeath,
|
|
string? CauseOfDeath,
|
|
DateOnly? GoHomeDate,
|
|
string? Genotype,
|
|
string? Notes,
|
|
string? ImportSource,
|
|
string? ExternalRef,
|
|
string? OriginBreeder,
|
|
List<string> CharacterTraits,
|
|
string? CharacterNote,
|
|
bool? IsDeaf,
|
|
bool IsResident);
|
|
|
|
public record LitterDto(
|
|
Guid Id,
|
|
string Name,
|
|
DateOnly Date,
|
|
int? TotalBorn,
|
|
Guid? FatherId,
|
|
Guid? MotherId,
|
|
DateOnly? ExpectedGoHomeDate,
|
|
string? Notes);
|
|
|
|
public record ContactDto(Guid Id, string Name, string? Email, string? Phone, string? Address, string? Notes);
|
|
|
|
public record EnclosureDto(Guid Id, string Name, string? Notes);
|
|
|
|
public record ColorVarietyDto(Guid Id, string Name, string? CanonicalGenotype, int SortOrder);
|
|
|
|
public record HealthRecordDto(
|
|
Guid Id, Guid GerbilId, DateOnly Date, HealthRecordType Type,
|
|
string Description, string? Veterinarian, DateTimeOffset CreatedAt);
|
|
|
|
public record WeightRecordDto(
|
|
Guid Id, Guid GerbilId, DateOnly Date, int WeightGrams, string? Notes);
|
|
|
|
public record PhotoDto(Guid Id, string FileName, string? Caption, int SortOrder, string Url);
|
|
|
|
// Request DTOs -----------------------------------------------------------
|
|
|
|
public record GerbilInput(
|
|
string Name,
|
|
Gender Gender,
|
|
GerbilStatus? Status,
|
|
Guid? LitterId,
|
|
Guid? OriginContactId,
|
|
Guid? ReceiverContactId,
|
|
Guid? EnclosureId,
|
|
Guid? ColorVarietyId,
|
|
DateOnly? DateOfBirth,
|
|
DateOnly? DateOfDeath,
|
|
string? CauseOfDeath,
|
|
DateOnly? GoHomeDate,
|
|
string? Genotype,
|
|
string? Notes,
|
|
string? ImportSource,
|
|
string? ExternalRef,
|
|
string? OriginBreeder,
|
|
List<string>? CharacterTraits,
|
|
string? CharacterNote,
|
|
bool? IsDeaf,
|
|
bool? IsResident);
|
|
|
|
public record LitterInput(
|
|
string Name,
|
|
DateOnly Date,
|
|
int? TotalBorn,
|
|
Guid? FatherId,
|
|
Guid? MotherId,
|
|
DateOnly? ExpectedGoHomeDate,
|
|
string? Notes);
|
|
|
|
public record ContactInput(string Name, string? Email, string? Phone, string? Address, string? Notes);
|
|
|
|
public record EnclosureInput(string Name, string? Notes);
|
|
|
|
public record ColorVarietyInput(string Name, string? CanonicalGenotype, int? SortOrder);
|
|
|
|
public record HealthRecordInput(
|
|
Guid GerbilId, DateOnly Date, HealthRecordType Type, string Description, string? Veterinarian);
|
|
|
|
public record WeightRecordInput(Guid GerbilId, DateOnly Date, int WeightGrams, string? Notes);
|
|
|
|
/// <summary>Hypothetical pairing request for POST /genetics/test-inbreeding.</summary>
|
|
public record TestInbreedingDto(Guid? FatherId, Guid? MotherId);
|
|
}
|