From 42d68aa99d59339dbdf928a54c28242635728daa Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 18 Apr 2025 21:25:32 +0200 Subject: Restore a game --- internal/api/database/models.go | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'internal/api/database/models.go') 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"` } -- cgit v1.2.3-18-g5258