chore(docs): completar Fase 2 — requisitos y arquitectura

- Añade/actualiza `docs/requirements.md`, `docs/architecture.md`, `docs/api-integration.md`, `docs/data-model.md`
- Documenta criterios de aceptación y decisiones técnico-arquitectónicas
- Recomendación: añadir `docs/legal-considerations.md` (pendiente)
This commit is contained in:
2026-02-08 10:45:22 +01:00
parent b95c7366be
commit fb4b279db0
21 changed files with 5803 additions and 101 deletions

View File

@@ -21,7 +21,7 @@ Game ↔ PriceHistory (1N)
- `description` (text) — opcional.
- `releaseDate` (DateTime?) — fecha principal.
- `igdbId`, `rawgId`, `thegamesdbId` (Int?) — ids externos.
- `extra` (Json?) — campos flexibles.
- `extra` (String?) — JSON serializado (compatible con SQLite); usar `JSON.parse`/`JSON.stringify` al leer/escribir.
- `createdAt`, `updatedAt`.
### Platform
@@ -30,7 +30,7 @@ Game ↔ PriceHistory (1N)
### RomFile
- `id`, `path`, `filename`, `checksum` (unique), `size` (int), `format`, `hashes` (Json opcional), `status` (active/missing), `addedAt`, `lastSeenAt`, `gameId`.
- `id`, `path`, `filename`, `checksum` (unique), `size` (int), `format`, `hashes` (String? — JSON serializado, ej.: {"crc32":"...","md5":"..."}), `status` (active/missing), `addedAt`, `lastSeenAt`, `gameId`.
### Artwork
@@ -67,7 +67,7 @@ Game ↔ PriceHistory (1N)
```prisma
datasource db {
provider = "postgresql" // para dev puede usarse sqlite
provider = "sqlite" // usar SQLite para desarrollo; cambiar a postgresql en producción si se necesita JSON nativo
url = env("DATABASE_URL")
}
@@ -88,7 +88,7 @@ model Game {
romFiles RomFile[]
artworks Artwork[]
tags Tag[]
extra Json?
extra String? // JSON serializado (usar JSON.parse/JSON.stringify para leer y escribir)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([title])
@@ -109,7 +109,7 @@ model RomFile {
checksum String @unique
size Int
format String
hashes Json?
hashes String? // JSON serializado (ej.: {"crc32":"...","md5":"..."})
game Game? @relation(fields: [gameId], references: [id])
gameId String?
addedAt DateTime @default(now())
@@ -141,6 +141,16 @@ model Purchase {
receiptPath String?
}
model PriceHistory {
id String @id @default(cuid())
game Game @relation(fields: [gameId], references: [id])
gameId String
priceCents Int
currency String
recordedAt DateTime @default(now())
source String?
}
model Tag {
id String @id @default(cuid())
name String @unique
@@ -148,7 +158,7 @@ model Tag {
}
```
> Nota: para monedas se recomienda almacenar `priceCents` (int) para compatibilidad; si se usa Postgres se puede optar por `Decimal`.
> Nota: para monedas se recomienda almacenar `priceCents` (int) para compatibilidad; si se usa Postgres se puede optar por `Decimal`. Nota: SQLite no soporta tipos JSON nativos; en este ejemplo se usan `String` para JSON serializado. Si migras a Postgres, puedes usar `Json`/`JsonB` para campos flexibles.
---