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:
7
src/Duempelkas.Domain/Duempelkas.Domain.csproj
Normal file
7
src/Duempelkas.Domain/Duempelkas.Domain.csproj
Normal file
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
11
src/Duempelkas.Domain/Entities/Account.cs
Normal file
11
src/Duempelkas.Domain/Entities/Account.cs
Normal 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>();
|
||||
}
|
||||
13
src/Duempelkas.Domain/Entities/AccountYear.cs
Normal file
13
src/Duempelkas.Domain/Entities/AccountYear.cs
Normal 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>();
|
||||
}
|
||||
20
src/Duempelkas.Domain/Entities/Entry.cs
Normal file
20
src/Duempelkas.Domain/Entities/Entry.cs
Normal 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; }
|
||||
}
|
||||
13
src/Duempelkas.Domain/Entities/TransferLink.cs
Normal file
13
src/Duempelkas.Domain/Entities/TransferLink.cs
Normal 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!;
|
||||
}
|
||||
7
src/Duempelkas.Domain/Enums/EntryType.cs
Normal file
7
src/Duempelkas.Domain/Enums/EntryType.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Duempelkas.Domain.Enums;
|
||||
|
||||
public enum EntryType
|
||||
{
|
||||
Income = 0,
|
||||
Expense = 1
|
||||
}
|
||||
Reference in New Issue
Block a user