DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

ref: dbf17ad9d8eeb86bb698a8bba892ff00ca6eb0ff deck-builder/.archived/sdbapi/models/gamedata.go -rw-r--r-- 913 bytes
dbf17ad9Jonni Liljamo chore: generalize mold 1 year, 9 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"`
}