FEAT-13: SaleContract + BreederSettings entities (additive migration, join table justified in code docs), /contracts + /settings/breeder-profile Minimal-API endpoints w/ Abgabe-completion transaction + SQLite-backed endpoint round-trip tests (21/21)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
45
GerbilManagerWebAPI/Models/SaleContract.cs
Normal file
45
GerbilManagerWebAPI/Models/SaleContract.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace GerbilManagerWebAPI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Ein erzeugter Abgabevertrag (FEAT-13). Die .docx liegt wie die Fotos im
|
||||
/// Datei-Root (Contracts:RootPath bzw. contract-storage/), in der DB steht
|
||||
/// nur der Dateiname. Tiere hängen über <see cref="SaleContractAnimal"/>
|
||||
/// (Join-Entity statt uuid[]-Spalte: referenzielle Integrität, „Verträge
|
||||
/// eines Tieres“ bleibt abfragbar, und pro Tier-Zeile ist später Platz für
|
||||
/// Zusatzdaten wie den Einzelpreis).
|
||||
/// </summary>
|
||||
public class SaleContract
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>Abnehmer (Käufer-Block des Vertrags).</summary>
|
||||
public Guid ContactId { get; set; }
|
||||
public Contact? Contact { get; set; }
|
||||
|
||||
/// <summary>Kaufpreis in Euro (gesamt).</summary>
|
||||
public decimal Price { get; set; }
|
||||
|
||||
public DateOnly HandoverDate { get; set; }
|
||||
|
||||
/// <summary>Datum der Unterschriftszeile (Standard: Übergabedatum).</summary>
|
||||
public DateOnly ContractDate { get; set; }
|
||||
|
||||
/// <summary>Dateiname der erzeugten .docx im Vertrags-Dateiroot.</summary>
|
||||
public required string FileName { get; set; }
|
||||
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
|
||||
public List<SaleContractAnimal> Animals { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>Join-Zeile Vertrag ↔ Tier (zusammengesetzter Schlüssel).</summary>
|
||||
public class SaleContractAnimal
|
||||
{
|
||||
public Guid SaleContractId { get; set; }
|
||||
public Guid GerbilId { get; set; }
|
||||
public Gerbil? Gerbil { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user