feat: split Templates table into 3 purpose-specific tables + email-api-data project #24

Closed
opened 2026-05-27 13:55:25 +00:00 by gelu · 0 comments
Owner

What

Split the single myAi.Templates table (which mixes email, AI prompt, and HTML page templates) into 3 tables each owned by the service that uses them. Add a proper data layer to email-api. Move HtmlShellStart/HtmlShellEnd into the DB. Replace config-based Contact:ToEmail operator-copy with a DB column.

Why

  • cv-matcher-api reads AI prompts from the wrong schema (myAi)
  • email-api has no DB — its HTML shell is a hardcoded constant
  • email-api has no repository pattern (unlike cv-matcher-api)
  • Operator copy address (Contact:ToEmail) requires a config change + redeploy to update

Scope

  • New email-api-data: EmailApiDbContext (emailApi schema), EmailTemplates table, IEmailTemplateRepository/EfEmailTemplateRepository, IEmailTemplateService/EmailTemplateService
  • New OperatorCopy column on EmailTemplates: seeded with contact@myai.ro; new rows default "" and inherit at runtime from first non-empty entry
  • email-api: wire email-api-data; load html shell from DB templates; remove hardcoded constants
  • api: add IEmailTemplateService; use it in EmailApiEmailSender for email.* + operator copy
  • cv-search-job: add IEmailTemplateService; remove MyAiDbContext; remove Contact:ToEmail config
  • cv-matcher-data: new AiPrompts table + IAiPromptsRepository/EfAiPromptsRepository in cv-matcher-api; cv-matcher-api removes MyAiDbContext
  • myai-data: cleanup migration removes email.* + ai.* rows

Success criteria

  1. dotnet build myAi.sln — 0 errors
  2. cv-matcher-api.csproj has no myai-data reference
  3. email-api has no hardcoded HTML constants
  4. cv-search-job docker-compose has no Contact__ToEmail env var
## What Split the single `myAi.Templates` table (which mixes email, AI prompt, and HTML page templates) into 3 tables each owned by the service that uses them. Add a proper data layer to `email-api`. Move `HtmlShellStart`/`HtmlShellEnd` into the DB. Replace config-based `Contact:ToEmail` operator-copy with a DB column. ## Why - `cv-matcher-api` reads AI prompts from the wrong schema (`myAi`) - `email-api` has no DB — its HTML shell is a hardcoded constant - `email-api` has no repository pattern (unlike `cv-matcher-api`) - Operator copy address (`Contact:ToEmail`) requires a config change + redeploy to update ## Scope - **New `email-api-data`**: `EmailApiDbContext` (`emailApi` schema), `EmailTemplates` table, `IEmailTemplateRepository`/`EfEmailTemplateRepository`, `IEmailTemplateService`/`EmailTemplateService` - **New `OperatorCopy` column** on `EmailTemplates`: seeded with `contact@myai.ro`; new rows default `""` and inherit at runtime from first non-empty entry - **`email-api`**: wire `email-api-data`; load html shell from DB templates; remove hardcoded constants - **`api`**: add `IEmailTemplateService`; use it in `EmailApiEmailSender` for `email.*` + operator copy - **`cv-search-job`**: add `IEmailTemplateService`; remove `MyAiDbContext`; remove `Contact:ToEmail` config - **`cv-matcher-data`**: new `AiPrompts` table + `IAiPromptsRepository`/`EfAiPromptsRepository` in `cv-matcher-api`; `cv-matcher-api` removes `MyAiDbContext` - **`myai-data`**: cleanup migration removes `email.*` + `ai.*` rows ## Success criteria 1. `dotnet build myAi.sln` — 0 errors 2. `cv-matcher-api.csproj` has no `myai-data` reference 3. `email-api` has no hardcoded HTML constants 4. `cv-search-job` docker-compose has no `Contact__ToEmail` env var
gelu closed this issue 2026-05-28 05:57:16 +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#24