implemented data sources with prisma in go
This commit is contained in:
Executable
BIN
Binary file not shown.
Executable
+60
@@ -0,0 +1,60 @@
|
||||
generator goClient {
|
||||
provider = "go run github.com/steebchen/prisma-client-go"
|
||||
output = "../internal/infrastructure/data/db"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
// User Model
|
||||
model UserDbo {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
email String @unique
|
||||
password String
|
||||
projects ProjectDbo[] // Beziehung zu Projekten
|
||||
timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
// Project Model
|
||||
model ProjectDbo {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
description String?
|
||||
clientId String?
|
||||
tasks ProjectTaskDbo[] // Beziehung zu Aufgaben
|
||||
timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen
|
||||
user UserDbo @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
// TimeEntry Model
|
||||
model TimeEntryDbo {
|
||||
id String @id @default(uuid())
|
||||
startTime DateTime
|
||||
endTime DateTime?
|
||||
description String?
|
||||
user UserDbo @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
project ProjectDbo @relation(fields: [projectId], references: [id])
|
||||
projectId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
// Task Model (optional)
|
||||
model ProjectTaskDbo {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
description String?
|
||||
project ProjectDbo @relation(fields: [projectId], references: [id])
|
||||
projectId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
Reference in New Issue
Block a user