summaryrefslogtreecommitdiff
path: root/internal/api/database/models.go
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2025-04-18 21:25:32 +0200
committerSanto Cariotti <santo@dcariotti.me>2025-04-18 21:25:32 +0200
commit42d68aa99d59339dbdf928a54c28242635728daa (patch)
tree98dadfd64a0fc05d1fb6f6ddbc9a3e8963fbf1dd /internal/api/database/models.go
parent7c5a6176b27b6b0c0c3ef8a4aedbdec871391a80 (diff)
Restore a game
Diffstat (limited to 'internal/api/database/models.go')
-rw-r--r--internal/api/database/models.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/internal/api/database/models.go b/internal/api/database/models.go
index cd0d12d..4acbca5 100644
--- a/internal/api/database/models.go
+++ b/internal/api/database/models.go
@@ -11,15 +11,16 @@ type User struct {
}
type Game struct {
- ID int `json:"id"`
- Player1ID int `json:"-"`
- Player1 User `gorm:"foreignKey:Player1ID" json:"player1"`
- Player2ID *int `json:"-"`
- Player2 *User `gorm:"foreignKey:Player2ID;null" json:"player2"`
- Name string `json:"name"`
- IP1 string `json:"ip1"`
- IP2 string `json:"ip2"`
- Outcome string `json:"outcome"`
- CreatedAt time.Time `json:"created_at"`
- UpdatedAt time.Time `json:"updated_at"`
+ ID int `json:"id"`
+ Player1ID int `json:"-"`
+ Player1 User `gorm:"foreignKey:Player1ID" json:"player1"`
+ Player2ID *int `json:"-"`
+ Player2 *User `gorm:"foreignKey:Player2ID;null" json:"player2"`
+ Name string `json:"name"`
+ IP1 string `json:"ip1"`
+ IP2 string `json:"ip2"`
+ Outcome string `json:"outcome"`
+ LastPlayer int `json:"last_player"` // Last player entered in game
+ CreatedAt time.Time `json:"created_at"`
+ UpdatedAt time.Time `json:"updated_at"`
}