Move RAG repository from rag-api to rag-data — consolidate data layer ownership

- Move IRagRepository, EfRagRepository, and VectorSerializer from rag-api/Data to rag-data/Repositories
- Add rag-api-models ProjectReference to rag-data.csproj for model type availability
- Delete rag-api/Data folder (no longer needed; all data access is now in rag-data)
- This aligns RAG with email-api and other services: all data code in the data project

Pattern: rag-api (API logic) → rag-data (repository, EF entities, migrations)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 09:38:25 +03:00
parent 36759d8fee
commit 487924e345
25 changed files with 125 additions and 57 deletions
@@ -1,5 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using MyAi.Data;
#nullable disable
@@ -12,11 +13,11 @@ namespace MyAi.Data.Migrations
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "myAi");
name: MigrationConstants.SchemaName);
migrationBuilder.CreateTable(
name: "Templates",
schema: "myAi",
schema: MigrationConstants.SchemaName,
columns: table => new
{
Key = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
@@ -36,7 +37,7 @@ namespace MyAi.Data.Migrations
private static void Seed(MigrationBuilder m)
{
void Row(string key, string lang, string value, string description = "")
=> m.InsertData("Templates", ["Key", "Language", "Value", "Description"], [key, lang, value, description], "myAi");
=> m.InsertData("Templates", ["Key", "Language", "Value", "Description"], [key, lang, value, description], MigrationConstants.SchemaName);
// Match result email — subject
Row("email.match.subject", "en", "MyAi.ro CV Match: {{score}}% - {{jobLabel}}", "Subject for the CV match result email");
@@ -107,7 +108,7 @@ namespace MyAi.Data.Migrations
{
migrationBuilder.DropTable(
name: "Templates",
schema: "myAi");
schema: MigrationConstants.SchemaName);
}
}
}
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore.Migrations;
using MyAi.Data;
#nullable disable
@@ -12,7 +13,7 @@ namespace MyAi.Data.Migrations
{
void Update(string key, string lang, string value)
=> migrationBuilder.UpdateData("Templates", ["Key", "Language"], [key, lang],
["Value"], [value], "myAi");
["Value"], [value], MigrationConstants.SchemaName);
// email.match.body — en
Update("email.match.body", "en",
@@ -120,7 +121,7 @@ namespace MyAi.Data.Migrations
{
void Update(string key, string lang, string value)
=> migrationBuilder.UpdateData("Templates", ["Key", "Language"], [key, lang],
["Value"], [value], "myAi");
["Value"], [value], MigrationConstants.SchemaName);
Update("email.match.body", "en",
"CV Matcher result\n\nCV Document ID: {{cvDocumentId}}\nJob: {{jobLabel}}\nJob URL: {{jobUrl}}\nScore: {{score}}%\n\nSummary:\n{{summary}}\n\nStrengths:\n{{strengths}}\n\nGaps:\n{{gaps}}\n\nRecommendations:\n{{recommendations}}");
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore.Migrations;
using MyAi.Data;
#nullable disable
@@ -10,8 +11,8 @@ namespace MyAi.Data.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("DELETE FROM [myAi].[Templates] WHERE [Key] LIKE 'email.%'");
migrationBuilder.Sql("DELETE FROM [myAi].[Templates] WHERE [Key] LIKE 'ai.%'");
migrationBuilder.Sql($"DELETE FROM [{MigrationConstants.SchemaName}].[Templates] WHERE [Key] LIKE 'email.%'");
migrationBuilder.Sql($"DELETE FROM [{MigrationConstants.SchemaName}].[Templates] WHERE [Key] LIKE 'ai.%'");
}
/// <inheritdoc />