refactor: restructure solution into -models/-data/-api project taxonomy #20

Closed
opened 2026-05-27 12:30:03 +00:00 by claude · 0 comments
Member

What

Full restructure of the myAi solution project layout across 10 phases, separating concerns cleanly into executables, domain-contracts, data-layer, and shared-primitive projects.

Why

Three structural problems existed:

  1. Two DbContexts were embedded in API projects (CvMatcherDbContext in cv-matcher-api, RagDbContext in
    ag-api), making the migration host unintuitive.
  2. Projects named -models (e.g. cv-search-models, myai-models) actually contained EF entities, DbContexts, and migrations — the name implied pure DTOs.
  3. shared-models was misnamed — it held only infrastructure/technical primitives, not general domain types.

Project taxonomy (target state)

Category Naming Contains EF dependency
Executable {name}-api, {name}-job Controllers, Services, Program.cs Via ProjectReference to a -data project
Domain contracts {name}-models, {name}-api-models DTOs, Refit interfaces, Settings No
Data layer {name}-data DbContext, EF entities, Migrations Yes
Common contracts common Infrastructure/technical primitives only No
Common base entities shared-data Abstract BaseEntity (Id + CreatedAt) No

Changes

Phase 1 — Rename shared-models → common; namespace Shared.Models → Common

Phase 2 — Create shared-data with abstract BaseEntity (
equired string Id { get; init; } + DateTime CreatedAt)

Phase 3 — Rename myai-models → myai-data; namespace MyAi.Models → MyAi.Data; MigrationsAssembly("myai-data")

Phase 4 — Rename cv-search-models → cv-search-data; move JobSearchSettings to cv-matcher-api-models; entities inherit BaseEntity

Phase 5 — Extract
ag-data from
ag-api (RagDbContext + entities + migrations); fix duplicate service registrations; MigrationsAssembly("rag-data")

Phase 6 — Extract cv-matcher-data from cv-matcher-api (CvMatcherDbContext + entities + migrations); MigrationsAssembly("cv-matcher-data")

Phase 7 — Create empty cv-cleanup-job-models and cv-search-job-models (proactive)

Phase 8 — Update all 5 Dockerfiles for renamed/new projects

Phase 9 — Add Models/ and Data/ virtual solution folders in .sln; update root CLAUDE.md, cv-matcher-api/CLAUDE.md, cv-search-job/CLAUDE.md

Phase 10 — Add Directory.Packages.props for central NuGet version management; remove Version= from all elements

Testing

  • dotnet build myAi.sln passes with 0 errors after each phase
  • No database changes; __EFMigrationsHistory MigrationId strings unaffected by namespace changes

Commit

95ed36 on branch
efactor/models-data-layer-structure — 105 files changed

## What Full restructure of the myAi solution project layout across 10 phases, separating concerns cleanly into executables, domain-contracts, data-layer, and shared-primitive projects. ## Why Three structural problems existed: 1. Two DbContexts were embedded in API projects (CvMatcherDbContext in cv-matcher-api, RagDbContext in ag-api), making the migration host unintuitive. 2. Projects named -models (e.g. cv-search-models, myai-models) actually contained EF entities, DbContexts, and migrations — the name implied pure DTOs. 3. shared-models was misnamed — it held only infrastructure/technical primitives, not general domain types. ## Project taxonomy (target state) | Category | Naming | Contains | EF dependency | |---|---|---|---| | Executable | {name}-api, {name}-job | Controllers, Services, Program.cs | Via ProjectReference to a -data project | | Domain contracts | {name}-models, {name}-api-models | DTOs, Refit interfaces, Settings | No | | Data layer | {name}-data | DbContext, EF entities, Migrations | Yes | | Common contracts | common | Infrastructure/technical primitives only | No | | Common base entities | shared-data | Abstract BaseEntity (Id + CreatedAt) | No | ## Changes **Phase 1** — Rename shared-models → common; namespace Shared.Models → Common **Phase 2** — Create shared-data with abstract BaseEntity ( equired string Id { get; init; } + DateTime CreatedAt) **Phase 3** — Rename myai-models → myai-data; namespace MyAi.Models → MyAi.Data; MigrationsAssembly("myai-data") **Phase 4** — Rename cv-search-models → cv-search-data; move JobSearchSettings to cv-matcher-api-models; entities inherit BaseEntity **Phase 5** — Extract ag-data from ag-api (RagDbContext + entities + migrations); fix duplicate service registrations; MigrationsAssembly("rag-data") **Phase 6** — Extract cv-matcher-data from cv-matcher-api (CvMatcherDbContext + entities + migrations); MigrationsAssembly("cv-matcher-data") **Phase 7** — Create empty cv-cleanup-job-models and cv-search-job-models (proactive) **Phase 8** — Update all 5 Dockerfiles for renamed/new projects **Phase 9** — Add Models/ and Data/ virtual solution folders in .sln; update root CLAUDE.md, cv-matcher-api/CLAUDE.md, cv-search-job/CLAUDE.md **Phase 10** — Add Directory.Packages.props for central NuGet version management; remove Version= from all <PackageReference> elements ## Testing - dotnet build myAi.sln passes with 0 errors after each phase - No database changes; __EFMigrationsHistory MigrationId strings unaffected by namespace changes ## Commit 95ed36 on branch efactor/models-data-layer-structure — 105 files changed
claude changed title from test to refactor: restructure solution into -models/-data/-api project taxonomy 2026-05-27 12:30:28 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: AI/myAi#20