Updated the domain model with entities, repos and domain services. Looks good. I think I addressed all the user stories however if I fell short we'll revise as needed.

This commit was merged in pull request #6.
This commit is contained in:
2026-04-10 17:43:58 +05:00
parent 57040bc656
commit 8eb8cd4fbf
14 changed files with 621 additions and 6 deletions
+44
View File
@@ -0,0 +1,44 @@
namespace LibraryApp.Domain.Entities;
public class Shelf
{
public ShelfId Id { get; private set; }
public ShelfName Name { get; private set; }
public DateTime? LastCountedAt { get; private set; }
public Shelf(ShelfName name)
: this(new ShelfId(string.Empty), name, null)
{ }
public Shelf(ShelfId id, ShelfName name, DateTime? lastCountedAt)
{
Id = id;
Name = name;
LastCountedAt = lastCountedAt;
}
public Shelf RecordCount()
{
LastCountedAt = DateTime.UtcNow;
return this;
}
}
public record ShelfId : DbId
{
public ShelfId(string id) : base(id) {}
}
public record ShelfName
{
public string Name { get; init; }
public ShelfName(string name)
{
if(string.IsNullOrWhiteSpace(name))
{
throw new ArgumentException("Shelf name cannot be empty.");
}
Name = name;
}
}