mirror of
https://github.com/Drop-OSS/drop
synced 2026-08-27 14:23:05 -04:00
feat: basic playtime backend
This commit is contained in:
parent
012c218abb
commit
1502ab7263
5 changed files with 96 additions and 4 deletions
|
|
@ -1,7 +1,8 @@
|
|||
enum ClientCapabilities {
|
||||
PeerAPI @map("peerAPI") // other clients can use the HTTP API to P2P with this client
|
||||
UserStatus @map("userStatus") // this client can report this user's status (playing, online, etc etc)
|
||||
CloudSaves @map("cloudSaves") // ability to save to save slots
|
||||
PeerAPI @map("peerAPI") // other clients can use the HTTP API to P2P with this client
|
||||
UserStatus @map("userStatus") // this client can report this user's status (playing, online, etc etc)
|
||||
CloudSaves @map("cloudSaves") // ability to save to save slots
|
||||
TrackPlaytime @map("trackPlaytime") // ability to track user playtime
|
||||
}
|
||||
|
||||
// References a device
|
||||
|
|
@ -18,4 +19,4 @@ model Client {
|
|||
|
||||
lastAccessedSaves SaveSlot[]
|
||||
tokens APIToken[]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ model Game {
|
|||
saves SaveSlot[]
|
||||
screenshots Screenshot[]
|
||||
tags Tag[]
|
||||
playtime Playtime[]
|
||||
|
||||
developers Company[] @relation(name: "developers")
|
||||
publishers Company[] @relation(name: "publishers")
|
||||
|
|
@ -124,6 +125,21 @@ model Screenshot {
|
|||
@@index([userId])
|
||||
}
|
||||
|
||||
model Playtime {
|
||||
gameId String
|
||||
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
seconds Int // seconds user has spent playing the game
|
||||
|
||||
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
||||
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
||||
|
||||
@@id([gameId, userId])
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model Company {
|
||||
id String @id @default(uuid())
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ model User {
|
|||
|
||||
saves SaveSlot[]
|
||||
screenshots Screenshot[]
|
||||
playtime Playtime[]
|
||||
}
|
||||
|
||||
model Notification {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue