refactor: introduce domain model classes and mapper layer

Replace ad-hoc inline row casting (snake_case → camelCase) spread across
services, routes, and the indexing pipeline with explicit model classes
(Repository, IndexingJob, RepositoryVersion, Snippet, SearchResult) and
dedicated mapper classes that own the DB → domain conversion.

- Add src/lib/server/models/ with typed model classes for all domain entities
- Add src/lib/server/mappers/ with mapper classes per entity
- Remove duplicated RawRow interfaces and inline map functions from
  job-queue, repository.service, indexing.pipeline, and all API routes
- Add dtoJsonResponse helper to standardise JSON responses via SvelteKit json()
- Add api-contract.integration.test.ts as a regression baseline

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Giancarmine Salucci
2026-03-25 14:29:49 +01:00
parent 7994254e23
commit 215cadf070
39 changed files with 1339 additions and 562 deletions

View File

@@ -1,25 +0,0 @@
{
"permissions": {
"allow": [
"WebFetch(domain:raw.githubusercontent.com)",
"WebFetch(domain:api.github.com)",
"WebFetch(domain:github.com)",
"Bash(git init:*)",
"Bash(git add:*)",
"Bash(git commit:*)",
"Bash(git checkout:*)",
"Bash(DATABASE_URL=./local.db npx drizzle-kit generate 2>&1)",
"Bash(DATABASE_URL=./local.db npx drizzle-kit generate)",
"Bash(npm run:*)",
"Bash(npm test:*)",
"Skill(update-config)",
"Bash(git -C /home/moze/Sources/trueref checkout -b feat/TRUEREF-0002-through-0018)",
"Bash(git:*)"
],
"defaultMode": "bypassPermissions"
},
"enableAllProjectMcpServers": true,
"enabledMcpjsonServers": [
"svelte"
]
}