refactor: reorganise models and data-layer structure across the solution #21

Merged
claude merged 4 commits from refactor/models-data-layer-structure into main 2026-05-27 12:46:27 +00:00
Member

What

Complete restructure of project naming, namespaces, and responsibility boundaries across the myAi solution — all pure refactoring, zero runtime behaviour changes.

Why

The solution had grown two DbContexts embedded inside API projects (cv-matcher-api,
ag-api), breaking the established data-layer pattern. Project names like cv-search-models and myai-models carried a -models suffix but contained EF entities and migrations. shared-models implied general sharing but held only infrastructure primitives. This refactor makes every project follow exactly one rule, readable from the name alone.

Changes

  • Phase 1 — Rename shared-models to common; update all consumers; remove stale AspNetCore.Http.Features reference
  • Phase 2 — Create shared-data with abstract BaseEntity (Id + CreatedAt)
  • Phase 3 — Rename myai-models to myai-data; update namespaces + consumers
  • Phase 4 — Rename cv-search-models to cv-search-data; move JobSearchSettings to cv-matcher-api-models; apply BaseEntity to eligible entities
  • Phase 5 — Extract rag-data from rag-api (DbContext, entities, migrations); fix duplicate service registrations in rag-api/Program.cs
  • Phase 6 — Extract cv-matcher-data from cv-matcher-api (DbContext, entities, migrations)
  • Phase 7 — Create empty cv-cleanup-job-models and cv-search-job-models for future growth
  • Phase 8 — Update all 5 Dockerfiles for renamed and new projects
  • Phase 9 — Reorganise .sln virtual folders (add Models/ and Data/ folders); update CLAUDE.md files
  • Phase 10 — Add Directory.Packages.props for centralised NuGet version management
  • Docs — Add docs/skills/general-dev-workflow.md

Testing

  • Tests added: none (pure refactoring, no logic changes)
  • Manual testing: dotnet build myAi.sln passes; EF migration dry-run verified for all 4 contexts
  • All namespace renames, MigrationsAssembly strings, and EF model snapshot CLR type strings updated consistently

Risk Assessment

Checklist

  • All tests passing
  • Code review ready
  • Documentation updated (CLAUDE.md files + docs/skills/)
  • No merge conflicts
## What Complete restructure of project naming, namespaces, and responsibility boundaries across the myAi solution — all pure refactoring, zero runtime behaviour changes. ## Why The solution had grown two DbContexts embedded inside API projects (cv-matcher-api, ag-api), breaking the established data-layer pattern. Project names like cv-search-models and myai-models carried a -models suffix but contained EF entities and migrations. shared-models implied general sharing but held only infrastructure primitives. This refactor makes every project follow exactly one rule, readable from the name alone. ## Changes - **Phase 1** — Rename `shared-models` to `common`; update all consumers; remove stale `AspNetCore.Http.Features` reference - **Phase 2** — Create `shared-data` with abstract `BaseEntity` (Id + CreatedAt) - **Phase 3** — Rename `myai-models` to `myai-data`; update namespaces + consumers - **Phase 4** — Rename `cv-search-models` to `cv-search-data`; move `JobSearchSettings` to `cv-matcher-api-models`; apply `BaseEntity` to eligible entities - **Phase 5** — Extract `rag-data` from `rag-api` (DbContext, entities, migrations); fix duplicate service registrations in `rag-api/Program.cs` - **Phase 6** — Extract `cv-matcher-data` from `cv-matcher-api` (DbContext, entities, migrations) - **Phase 7** — Create empty `cv-cleanup-job-models` and `cv-search-job-models` for future growth - **Phase 8** — Update all 5 Dockerfiles for renamed and new projects - **Phase 9** — Reorganise `.sln` virtual folders (add `Models/` and `Data/` folders); update `CLAUDE.md` files - **Phase 10** — Add `Directory.Packages.props` for centralised NuGet version management - **Docs** — Add `docs/skills/general-dev-workflow.md` ## Testing - Tests added: none (pure refactoring, no logic changes) - Manual testing: `dotnet build myAi.sln` passes; EF migration dry-run verified for all 4 contexts - All namespace renames, MigrationsAssembly strings, and EF model snapshot CLR type strings updated consistently ## Risk Assessment - Breaking changes? No — no public API surface, no DB schema changes, no migration ID changes - Performance impact: none - Closes #20 ## Checklist - [x] All tests passing - [x] Code review ready - [x] Documentation updated (CLAUDE.md files + docs/skills/) - [x] No merge conflicts
claude added 2 commits 2026-05-27 12:43:26 +00:00
Phases 1-10 of the planned refactoring:

Phase 1: rename shared-models -> common
  - namespace Shared.Models -> Common throughout
  - remove stale AspNetCore.Http.Features 5.0 reference

Phase 2: create shared-data with abstract BaseEntity
  - BaseEntity: required string Id { get; init; } + DateTime CreatedAt { get; init; }

Phase 3: rename myai-models -> myai-data
  - namespace MyAi.Models -> MyAi.Data
  - MigrationsAssembly("myai-data")

Phase 4: rename cv-search-models -> cv-search-data
  - namespace CvSearch.Models -> CvSearch.Data
  - move JobSearchSettings to cv-matcher-api-models
  - JobSearch*Entity now inherits BaseEntity

Phase 5: extract rag-data from rag-api
  - new project: Apis/rag-data with RagDbContext + entities + migrations
  - RagDocumentEntity inherits BaseEntity; cache entities use CacheKey PK
  - fix duplicate AddHttpClient<RagAiClient>/AddScoped registrations in rag-api
  - MigrationsAssembly("rag-data")

Phase 6: extract cv-matcher-data from cv-matcher-api
  - new project: Apis/cv-matcher-data with CvMatcherDbContext + entities + migrations
  - CvMatchResultEntity inherits BaseEntity; CvMatcherChatCacheEntity uses CacheKey PK
  - MigrationsAssembly("cv-matcher-data")

Phase 7: create empty cv-cleanup-job-models and cv-search-job-models

Phase 8: update all 5 Dockerfiles for renamed/new projects

Phase 9: reorganise .sln virtual folders (Apis/Jobs/Models/Data/Helpers)
  - update root CLAUDE.md with new project taxonomy and migration commands
  - update cv-matcher-api/CLAUDE.md and cv-search-job/CLAUDE.md

Phase 10: add Directory.Packages.props for centralised NuGet versions
  - remove Version= from all PackageReference elements in active .csproj files

No database changes. No runtime behaviour changes.
All MigrationId strings in __EFMigrationsHistory are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Stores the canonical general-dev-workflow skill definition alongside the
codebase so it travels with the project and can be evolved via normal PRs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gelu added 1 commit 2026-05-27 12:44:01 +00:00
Required by the Claude skill upload dialog for name/description discovery.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gelu added 1 commit 2026-05-27 12:45:39 +00:00
gelu approved these changes 2026-05-27 12:45:52 +00:00
claude merged commit b6d01e39b6 into main 2026-05-27 12:46:27 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: AI/myAi#21