Initial commit: Fahrrad Verschleißteile Tracker
- Next.js SPA mit Bun Runtime - Prisma mit SQLite Datenbank - Vollständige CRUD-Operationen für Fahrräder, Verschleißteile und Wartungshistorie - Warnsystem für bevorstehende Wartungen - Statistik-Features (Gesamtkosten, durchschnittliche Lebensdauer) - Zod-Validierung für alle API-Requests - Umfassende Test-Suite (41 Tests)
This commit is contained in:
55
prisma/schema.prisma
Normal file
55
prisma/schema.prisma
Normal file
@@ -0,0 +1,55 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = "file:./dev.db"
|
||||
}
|
||||
|
||||
model Bike {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
brand String?
|
||||
model String?
|
||||
purchaseDate DateTime?
|
||||
notes String?
|
||||
wearParts WearPart[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model WearPart {
|
||||
id String @id @default(cuid())
|
||||
bikeId String
|
||||
bike Bike @relation(fields: [bikeId], references: [id], onDelete: Cascade)
|
||||
type String // CHAIN, BRAKE_PADS, TIRE, CASSETTE, CHAINRING, DERAILLEUR, etc.
|
||||
brand String?
|
||||
model String?
|
||||
installDate DateTime
|
||||
installMileage Int @default(0)
|
||||
serviceInterval Int // in km
|
||||
status String @default("ACTIVE") // ACTIVE, NEEDS_SERVICE, REPLACED, INACTIVE
|
||||
cost Float?
|
||||
notes String?
|
||||
maintenanceHistory MaintenanceHistory[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model MaintenanceHistory {
|
||||
id String @id @default(cuid())
|
||||
wearPartId String
|
||||
wearPart WearPart @relation(fields: [wearPartId], references: [id], onDelete: Cascade)
|
||||
date DateTime
|
||||
mileage Int
|
||||
action String // INSTALL, REPLACE, SERVICE, CHECK, ADJUST
|
||||
notes String?
|
||||
cost Float?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user