From 012548e8db0e85645e383846c4ad2011d319162c Mon Sep 17 00:00:00 2001 From: beo3000 Date: Sat, 3 Jan 2026 14:16:59 +0100 Subject: [PATCH] K1: add cashbook domain entities + enums MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - BookingCategoryType enum (Income/Expense) - CashBookEntryType enum (Income/Expense) - BookingCategory entity - CashBookEntry entity - Club: InitialBalance, MonthlyMembershipFee, navigation props 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- docs/IMPLEMENTATION_PLAN.md | 2 +- src/Koogle.Domain/Entities/BookingCategory.cs | 59 +++++++++++++++ src/Koogle.Domain/Entities/CashBookEntry.cs | 74 +++++++++++++++++++ src/Koogle.Domain/Entities/Club.cs | 20 +++++ .../Enums/BookingCategoryType.cs | 17 +++++ src/Koogle.Domain/Enums/CashBookEntryType.cs | 17 +++++ 6 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 src/Koogle.Domain/Entities/BookingCategory.cs create mode 100644 src/Koogle.Domain/Entities/CashBookEntry.cs create mode 100644 src/Koogle.Domain/Enums/BookingCategoryType.cs create mode 100644 src/Koogle.Domain/Enums/CashBookEntryType.cs diff --git a/docs/IMPLEMENTATION_PLAN.md b/docs/IMPLEMENTATION_PLAN.md index 3f84517..a02fb41 100644 --- a/docs/IMPLEMENTATION_PLAN.md +++ b/docs/IMPLEMENTATION_PLAN.md @@ -1699,7 +1699,7 @@ public enum CashBookEntryType { Income = 0, Expense = 1 } | ☐ | Phase | Bereich | Beschreibung | Dateien | |---|-------|---------|--------------|---------| -| ☐ | K1 | Domain | Entities + Enums | 5 | +| ✓ | K1 | Domain | Entities + Enums | 5 | | ☐ | K2 | Infrastructure | EF Configurations | 4 | | ☐ | K3 | Infrastructure | Migration | - | | ☐ | K4 | Security | Kassenwart Role + Policy | 4 | diff --git a/src/Koogle.Domain/Entities/BookingCategory.cs b/src/Koogle.Domain/Entities/BookingCategory.cs new file mode 100644 index 0000000..1971d59 --- /dev/null +++ b/src/Koogle.Domain/Entities/BookingCategory.cs @@ -0,0 +1,59 @@ +using Koogle.Domain.Enums; + +namespace Koogle.Domain.Entities; + +/// +/// Represents a booking category for organizing cash book entries. +/// +public class BookingCategory : BaseEntity +{ + /// + /// Gets or sets the club identifier this category belongs to. + /// + public Guid ClubId { get; set; } + + /// + /// Gets or sets the category name. + /// + public string Name { get; set; } = string.Empty; + + /// + /// Gets or sets the optional description. + /// + public string? Description { get; set; } + + /// + /// Gets or sets the category type (Income or Expense). + /// + public BookingCategoryType CategoryType { get; set; } + + /// + /// Gets or sets whether this is a system category (cannot be deleted). + /// + public bool IsSystemCategory { get; set; } + + /// + /// Gets or sets the hex color code (#RRGGBB). + /// + public string? Color { get; set; } + + /// + /// Gets or sets the MudBlazor icon name. + /// + public string? Icon { get; set; } + + /// + /// Gets or sets whether this category is active (soft-deactivation). + /// + public bool IsActive { get; set; } = true; + + /// + /// Gets or sets the club navigation property. + /// + public Club Club { get; set; } = null!; + + /// + /// Gets or sets the cash book entries in this category. + /// + public ICollection CashBookEntries { get; set; } = []; +} diff --git a/src/Koogle.Domain/Entities/CashBookEntry.cs b/src/Koogle.Domain/Entities/CashBookEntry.cs new file mode 100644 index 0000000..bc7b183 --- /dev/null +++ b/src/Koogle.Domain/Entities/CashBookEntry.cs @@ -0,0 +1,74 @@ +using Koogle.Domain.Enums; + +namespace Koogle.Domain.Entities; + +/// +/// Represents a cash book entry (income or expense transaction). +/// +public class CashBookEntry : BaseEntity +{ + /// + /// Gets or sets the club identifier this entry belongs to. + /// + public Guid ClubId { get; set; } + + /// + /// Gets or sets the booking category identifier. + /// + public Guid CategoryId { get; set; } + + /// + /// Gets or sets the entry type (Income or Expense). + /// + public CashBookEntryType EntryType { get; set; } + + /// + /// Gets or sets the amount (always positive). + /// + public decimal Amount { get; set; } + + /// + /// Gets or sets the booking date (freely selectable). + /// + public DateTime BookingDate { get; set; } + + /// + /// Gets or sets the optional comment. + /// + public string? Comment { get; set; } + + /// + /// Gets or sets the receipt reference. + /// + public string? ReceiptReference { get; set; } + + /// + /// Gets or sets the optional day identifier (for penalty bookings). + /// + public Guid? DayId { get; set; } + + /// + /// Gets or sets the optional person identifier. + /// + public Guid? PersonId { get; set; } + + /// + /// Gets or sets the club navigation property. + /// + public Club Club { get; set; } = null!; + + /// + /// Gets or sets the category navigation property. + /// + public BookingCategory Category { get; set; } = null!; + + /// + /// Gets or sets the optional day navigation property. + /// + public Day? Day { get; set; } + + /// + /// Gets or sets the optional person navigation property. + /// + public Person? Person { get; set; } +} diff --git a/src/Koogle.Domain/Entities/Club.cs b/src/Koogle.Domain/Entities/Club.cs index a8a86af..952005b 100644 --- a/src/Koogle.Domain/Entities/Club.cs +++ b/src/Koogle.Domain/Entities/Club.cs @@ -33,6 +33,16 @@ namespace Koogle.Domain.Entities /// public string? SenderEmail { get; set; } + /// + /// Initial cash book balance (opening balance). + /// + public decimal InitialBalance { get; set; } + + /// + /// Monthly membership fee amount. + /// + public decimal MonthlyMembershipFee { get; set; } + /// /// Persons in this club. /// @@ -62,5 +72,15 @@ namespace Koogle.Domain.Entities /// Tokens for anonymous GIF submissions. /// public ICollection GifSubmissionTokens { get; set; } = new List(); + + /// + /// Booking categories for cash book organization. + /// + public ICollection BookingCategories { get; set; } = new List(); + + /// + /// Cash book entries for this club. + /// + public ICollection CashBookEntries { get; set; } = new List(); } } diff --git a/src/Koogle.Domain/Enums/BookingCategoryType.cs b/src/Koogle.Domain/Enums/BookingCategoryType.cs new file mode 100644 index 0000000..fe2370a --- /dev/null +++ b/src/Koogle.Domain/Enums/BookingCategoryType.cs @@ -0,0 +1,17 @@ +namespace Koogle.Domain.Enums; + +/// +/// Defines the type of booking category for cash book entries. +/// +public enum BookingCategoryType +{ + /// + /// Income category (e.g., game penalties, membership fees). + /// + Income = 0, + + /// + /// Expense category (e.g., lane rental, materials). + /// + Expense = 1 +} diff --git a/src/Koogle.Domain/Enums/CashBookEntryType.cs b/src/Koogle.Domain/Enums/CashBookEntryType.cs new file mode 100644 index 0000000..87e5a86 --- /dev/null +++ b/src/Koogle.Domain/Enums/CashBookEntryType.cs @@ -0,0 +1,17 @@ +namespace Koogle.Domain.Enums; + +/// +/// Defines the type of cash book entry (income or expense). +/// +public enum CashBookEntryType +{ + /// + /// Income entry (money coming in). + /// + Income = 0, + + /// + /// Expense entry (money going out). + /// + Expense = 1 +}