DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

ref: 41561f9db3fc5f278f11e3a0793ca5223a9715cb deck-builder/.archived/sdbapi/models/gamedata.go -rw-r--r-- 913 bytes
41561f9dJonni Liljamo chore: move archived to .archived 1 year, 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * This file is part of sdbapi
 * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
 *
 * Licensed under GPL-3.0-only.
 * See LICENSE for licensing information.
 */

package models

import (
	"time"

	"gorm.io/datatypes"
	"gorm.io/gorm"
)

const (
	GAMETURN_HOST  uint8 = 0
	GAMETURN_GUEST uint8 = 1
)

type GameData struct {
	ID        string         `json:"id" gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
	Actions   []Action       `json:"actions" gorm:"foreignKey:GameDataID"`
	Turn      uint8          `json:"turn" gorm:"type:smallint"`
	// NOTE: These are not final
	HostHand  datatypes.JSON `json:"host_hand"`
	HostDeck  datatypes.JSON `json:"host_deck"`
	GuestHand datatypes.JSON `json:"guest_hand"`
	GuestDeck datatypes.JSON `json:"guest_deck"`
}