feat: domain model, EF Core DbContext, and initial migration #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/domain-and-database"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements the complete domain model, EF Core persistence layer, and initial database migration.
What's included
ApplicationCore — Domain Model
9 strongly typed IDs (readonly record structs implementing
IStronglyTypedId):DoujinId,VariantId,ChapterId,PageId,ImageFileId,TitleId,PersonId,CircleId,TagId4 enums:
TitleKind(Original, Translated, Romaji, Alias)PersonRole(Artist, Writer, Translator, Editor, Scanners, Other)VariantKind(Original, Translated, Reedition, Other)ReadingDirection(LeftToRight, RightToLeft)12 domain entities:
DoujinVariantLanguageCode, independent page listChapterPageChapterIdImageFile/images/{shard}/{uuid}.ext)TitlePersonCircleTagDoujinPersonDoujinCircleDoujinTagPort:
IIdGeneratorinterface (9 methods, one per ID type)Infrastructure — EF Core Layer
DoujinManagerDbContextwith 12DbSet<>propertiesIEntityTypeConfiguration<>classes with Fluent API mapping (no EF attributes in domain)StronglyTypedIdConverterFactory— expression-tree-basedValueConverter<TId, Guid>and nullable variantModelBuilderExtensions—UseStronglyTypedId()helper for entities and nullable FKsGuidIdGenerator— defaultIIdGeneratorimplementationInitialCreatemigration — 12 tables, 15 indexes, all FK constraints with cascade/restrict/set-null rulesSQLitePCLRaw.bundle_e_sqlite33.0.0 pinned (fixes GHSA-2m69-gcr7-jv3q)Server
DbContextregistered withDOUJIN_MANAGER_DB_PATHenv var (default:/app/data/doujin-manager.db)IIdGeneratorregistered as singletonTests (23 total, all passing)
ApplicationCore.Tests (13 tests):
IStronglyTypedIdinterface)Infrastructure.Tests (8 tests, in-memory SQLite):
Verification
dotnet builddotnet testdotnet ef database updategit diff --checkRelated ADRs
🤖 Hermes automated review: no blocking issues found
I reviewed the PR diff for correctness, security, data-loss risks, EF Core mapping/migration issues, and test coverage. I did not find blocking issues to request changes on.
Notes:
dotnet build --no-restorecould not be completed becauseproject.assets.jsonfiles were not present in the checkout; I did not run restore/dependency installation in this cron job. Please rely on CI or rundotnet restore && dotnet build && dotnet testbefore merging.Automated daily review. I never merge PRs.