From 96c5b4d196bae67b05f7f46029bb25f140e20c82 Mon Sep 17 00:00:00 2001 From: beo3000 Date: Sat, 3 Jan 2026 14:39:40 +0100 Subject: [PATCH] K6: add cashbook DTOs - BookingCategoryDto, CreateBookingCategoryDto, UpdateBookingCategoryDto - CashBookEntryDto, CreateCashBookEntryDto, UpdateCashBookEntryDto - CashBookReportDto, CategorySummaryDto, CreateMembershipFeesDto --- docs/IMPLEMENTATION_PLAN.md | 2 +- .../DTOs/BookingCategoryDto.cs | 43 ++++++++++++++++ .../DTOs/CashBookEntryDto.cs | 49 +++++++++++++++++++ .../DTOs/CashBookReportDto.cs | 38 ++++++++++++++ 4 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 src/Koogle.Application/DTOs/BookingCategoryDto.cs create mode 100644 src/Koogle.Application/DTOs/CashBookEntryDto.cs create mode 100644 src/Koogle.Application/DTOs/CashBookReportDto.cs diff --git a/docs/IMPLEMENTATION_PLAN.md b/docs/IMPLEMENTATION_PLAN.md index 63acc71..fdce0cf 100644 --- a/docs/IMPLEMENTATION_PLAN.md +++ b/docs/IMPLEMENTATION_PLAN.md @@ -1704,7 +1704,7 @@ public enum CashBookEntryType { Income = 0, Expense = 1 } | ✓ | K3 | Infrastructure | Migration | - | | ✓ | K4 | Security | Kassenwart Role + Policy | 4 | | ✓ | K5 | Infrastructure | Repositories | 5 | -| ☐ | K6 | Application | DTOs | 3 | +| ✓ | K6 | Application | DTOs | 3 | | ☐ | K7 | Application | Service Interfaces | 2 | | ☐ | K8 | Application | Service Implementations | 4 | | ☐ | K9 | Application | Category Seeder | 1 | diff --git a/src/Koogle.Application/DTOs/BookingCategoryDto.cs b/src/Koogle.Application/DTOs/BookingCategoryDto.cs new file mode 100644 index 0000000..75e19f7 --- /dev/null +++ b/src/Koogle.Application/DTOs/BookingCategoryDto.cs @@ -0,0 +1,43 @@ +using Koogle.Domain.Enums; + +namespace Koogle.Application.DTOs; + +/// +/// Data transfer object representing a booking category. +/// +public record BookingCategoryDto +{ + public Guid Id { get; init; } + public string Name { get; init; } = string.Empty; + public string? Description { get; init; } + public BookingCategoryType CategoryType { get; init; } + public bool IsSystemCategory { get; init; } + public string? Color { get; init; } + public string? Icon { get; init; } + public bool IsActive { get; init; } +} + +/// +/// Data transfer object for creating a new booking category. +/// +public record CreateBookingCategoryDto +{ + public string Name { get; init; } = string.Empty; + public string? Description { get; init; } + public BookingCategoryType CategoryType { get; init; } + public string? Color { get; init; } + public string? Icon { get; init; } +} + +/// +/// Data transfer object for updating an existing booking category. +/// +public record UpdateBookingCategoryDto +{ + public Guid Id { get; init; } + public string Name { get; init; } = string.Empty; + public string? Description { get; init; } + public string? Color { get; init; } + public string? Icon { get; init; } + public bool IsActive { get; init; } +} diff --git a/src/Koogle.Application/DTOs/CashBookEntryDto.cs b/src/Koogle.Application/DTOs/CashBookEntryDto.cs new file mode 100644 index 0000000..5e92176 --- /dev/null +++ b/src/Koogle.Application/DTOs/CashBookEntryDto.cs @@ -0,0 +1,49 @@ +using Koogle.Domain.Enums; + +namespace Koogle.Application.DTOs; + +/// +/// Data transfer object representing a cash book entry. +/// +public record CashBookEntryDto +{ + public Guid Id { get; init; } + public Guid CategoryId { get; init; } + public string CategoryName { get; init; } = string.Empty; + public CashBookEntryType EntryType { get; init; } + public decimal Amount { get; init; } + public DateTime BookingDate { get; init; } + public string? Comment { get; init; } + public string? ReceiptReference { get; init; } + public Guid? DayId { get; init; } + public Guid? PersonId { get; init; } + public string? PersonName { get; init; } + public DateTime CreatedAt { get; init; } +} + +/// +/// Data transfer object for creating a new cash book entry. +/// +public record CreateCashBookEntryDto +{ + public Guid CategoryId { get; init; } + public CashBookEntryType EntryType { get; init; } + public decimal Amount { get; init; } + public DateTime BookingDate { get; init; } + public string? Comment { get; init; } + public string? ReceiptReference { get; init; } + public Guid? PersonId { get; init; } +} + +/// +/// Data transfer object for updating an existing cash book entry. +/// +public record UpdateCashBookEntryDto +{ + public Guid Id { get; init; } + public Guid CategoryId { get; init; } + public decimal Amount { get; init; } + public DateTime BookingDate { get; init; } + public string? Comment { get; init; } + public string? ReceiptReference { get; init; } +} diff --git a/src/Koogle.Application/DTOs/CashBookReportDto.cs b/src/Koogle.Application/DTOs/CashBookReportDto.cs new file mode 100644 index 0000000..157c639 --- /dev/null +++ b/src/Koogle.Application/DTOs/CashBookReportDto.cs @@ -0,0 +1,38 @@ +namespace Koogle.Application.DTOs; + +/// +/// Data transfer object for a cash book report. +/// +public record CashBookReportDto +{ + public DateTime ReportStart { get; init; } + public DateTime ReportEnd { get; init; } + public decimal OpeningBalance { get; init; } + public decimal ClosingBalance { get; init; } + public decimal TotalIncome { get; init; } + public decimal TotalExpense { get; init; } + public List IncomeByCategory { get; init; } = []; + public List ExpenseByCategory { get; init; } = []; + public List Entries { get; init; } = []; +} + +/// +/// Summary of entries for a specific category. +/// +public record CategorySummaryDto +{ + public Guid CategoryId { get; init; } + public string CategoryName { get; init; } = string.Empty; + public decimal Total { get; init; } + public int Count { get; init; } +} + +/// +/// Data transfer object for creating membership fee entries. +/// +public record CreateMembershipFeesDto +{ + public int Year { get; init; } + public int Month { get; init; } + public decimal? OverrideAmount { get; init; } +}