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
+2 -2
View File
@@ -5,8 +5,8 @@ namespace EmailApi.Data;
public sealed class EmailApiDbContext : DbContext
{
public const string SchemaName = "emailApi";
public const string MigrationTableName = "_Migrations";
public const string SchemaName = MigrationConstants.SchemaName;
public const string MigrationTableName = MigrationConstants.MigrationTableName;
public EmailApiDbContext(DbContextOptions<EmailApiDbContext> options) : base(options) { }
+11
View File
@@ -0,0 +1,11 @@
namespace EmailApi.Data;
/// <summary>
/// Schema constants used by EmailApiDbContext and migrations.
/// Centralized to avoid hardcoded strings and ensure consistency.
/// </summary>
public static class MigrationConstants
{
public const string SchemaName = "emailApi";
public const string MigrationTableName = "_Migrations";
}
@@ -1,5 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using EmailApi.Data;
#nullable disable
@@ -11,11 +12,11 @@ namespace EmailApi.Data.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(name: "emailApi");
migrationBuilder.EnsureSchema(name: MigrationConstants.SchemaName);
migrationBuilder.CreateTable(
name: "EmailTemplates",
schema: "emailApi",
schema: MigrationConstants.SchemaName,
columns: table => new
{
Key = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
@@ -39,7 +40,7 @@ namespace EmailApi.Data.Migrations
=> m.InsertData("EmailTemplates",
["Key", "Language", "Value", "Description", "OperatorCopy"],
[key, lang, value, description, operatorCopy],
"emailApi");
MigrationConstants.SchemaName);
// ── HTML shell (no operator copy — these are layout fragments, not addressable emails) ──
Row("email.html-shell.start", "*",
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore.Migrations;
using EmailApi.Data;
#nullable disable
@@ -31,7 +32,7 @@ namespace EmailApi.Data.Migrations
=> m.InsertData("EmailTemplates",
["Key", "Language", "Value", "Description", "OperatorCopy"],
[key, lang, value, description, operatorCopy],
"emailApi");
MigrationConstants.SchemaName);
// ── HTML shell (no operator copy — these are layout fragments, not addressable emails) ──
Row("email.html-shell.start", "*",