feat: update database schema to use snake_case for table names and add mapping for models

This commit is contained in:
Jose Selesan
2026-09-04 19:02:43 -03:00
parent 1ec6200ffa
commit 0aa5d70101
2 changed files with 13 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ Monorepo web + API para gestión de cobros grupales. Reglas optimizadas para age
## Convenciones repo-específicas
- **Frontend en español**: copy de UI, comentarios y textos en español.
- **Base de datos**: todas las tablas usan **snake_case** vía `@@map` en `prisma/schema.prisma` (p. ej. `User` → `users`, `WaitlistEntry` → `waitlist_entries`). Al agregar un modelo nuevo, incluir siempre `@@map("nombre_tabla")`.
- **Tailwind v4** con tokens en `@theme` dentro de `apps/web/src/index.css` (p. ej. `--color-accent: #1e90ff`). Se usan como clases auto-generadas: `text-accent`, `bg-success-soft`, etc. Radius por defecto `0.75rem` (`rounded-xl`).
- **Router NO es file-based** (aunque `stack.md` lo diga): las rutas se declaran manualmente en `apps/web/src/router.tsx` con `createRoute` + `addChildren` y se registran vía module augmentation. **Cada vista nueva debe añadirse ahí.**
- Nav (Inicio/Grupos/Cobros/Ajustes) vive en `apps/web/src/components/layout/nav-items.ts`; es la fuente única para `BottomNav` (móvil) y `Sidebar` (desktop) — no dupliques la lista.

View File

@@ -24,6 +24,8 @@ model User {
groupsMember Member[]
groupsOwner Group[] @relation("OwnerGroups")
waitlist WaitlistEntry[]
@@map("users")
}
model Account {
@@ -44,6 +46,7 @@ model Account {
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([providerId, providerAccountId])
@@map("accounts")
}
model Session {
@@ -57,6 +60,8 @@ model Session {
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@map("sessions")
}
model Verification {
@@ -68,6 +73,7 @@ model Verification {
updatedAt DateTime @updatedAt
@@unique([identifier, value])
@@map("verifications")
}
// Domain models
@@ -83,6 +89,8 @@ model Group {
members Member[]
students Student[]
payments Payment[]
@@map("groups")
}
model Member {
@@ -96,6 +104,7 @@ model Member {
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([groupId, userId])
@@map("members")
}
enum Role {
@@ -120,6 +129,7 @@ model Student {
payments Payment[]
@@index([groupId])
@@map("students")
}
model Payment {
@@ -139,6 +149,7 @@ model Payment {
@@index([groupId])
@@index([studentId])
@@map("payments")
}
enum PaymentStatus {
@@ -161,6 +172,7 @@ model WaitlistEntry {
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
@@unique([email])
@@map("waitlist_entries")
}
enum WaitlistStatus {