Add domain model with entities and enums

- Account, AccountYear, Entry, TransferLink entities
- EntryType enum (Income/Expense)
- Soft-delete support via IsDeleted flag
This commit is contained in:
2026-03-31 17:12:46 +02:00
parent e589cc170a
commit 8fbb8b8ea2
6 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,11 @@
namespace Duempelkas.Domain.Entities;
public class Account
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public decimal CarryoverBalance { get; set; }
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
public ICollection<Entry> Entries { get; set; } = new List<Entry>();
}

View File

@@ -0,0 +1,13 @@
namespace Duempelkas.Domain.Entities;
public class AccountYear
{
public int Id { get; set; }
public int AccountId { get; set; }
public int Year { get; set; }
public decimal OpeningBalance { get; set; }
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
public Account Account { get; set; } = null!;
public ICollection<Entry> Entries { get; set; } = new List<Entry>();
}

View File

@@ -0,0 +1,20 @@
using Duempelkas.Domain.Enums;
namespace Duempelkas.Domain.Entities;
public class Entry
{
public int Id { get; set; }
public int AccountId { get; set; }
public string DisplayId { get; set; } = string.Empty;
public EntryType Type { get; set; }
public DateTime Date { get; set; }
public string Title { get; set; } = string.Empty;
public decimal Amount { get; set; }
public bool IsDeleted { get; set; }
public int? TransferLinkId { get; set; }
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
public Account Account { get; set; } = null!;
public TransferLink? TransferLink { get; set; }
}

View File

@@ -0,0 +1,13 @@
namespace Duempelkas.Domain.Entities;
public class TransferLink
{
public int Id { get; set; }
public int SourceEntryId { get; set; }
public int TargetEntryId { get; set; }
public string? Note { get; set; }
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
public Entry SourceEntry { get; set; } = null!;
public Entry TargetEntry { get; set; } = null!;
}

View File

@@ -0,0 +1,7 @@
namespace Duempelkas.Domain.Enums;
public enum EntryType
{
Income = 0,
Expense = 1
}