generated from schreifuchs/wails-template
	
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package model
 | 
						|
 | 
						|
import (
 | 
						|
	"gorm.io/gorm"
 | 
						|
)
 | 
						|
 | 
						|
type Game struct {
 | 
						|
	gorm.Model
 | 
						|
	Name string
 | 
						|
}
 | 
						|
 | 
						|
type Participant struct {
 | 
						|
	gorm.Model
 | 
						|
	Name        string
 | 
						|
	IsTemporary bool // only for one tournament
 | 
						|
	IsTeam      bool
 | 
						|
	Tournaments []*Tournament `gorm:"many2many:partcipant_tournaments;"`
 | 
						|
}
 | 
						|
 | 
						|
type Tournament struct {
 | 
						|
	gorm.Model
 | 
						|
	Title           string
 | 
						|
	GameID          int
 | 
						|
	Game            Game `gorm:"foreignKey:GameID"`
 | 
						|
	Size            int  `json:"Size,string,omitempty"` // number of prarticipants
 | 
						|
	TournamentState int
 | 
						|
 | 
						|
	WinnierParticipantID int
 | 
						|
	WinnierParticipant   Participant    `gorm:"foreignKey:WinnierParticipantID"`
 | 
						|
	Participants         []*Participant `gorm:"many2many:partcipant_tournaments;"`
 | 
						|
}
 | 
						|
 | 
						|
type Match struct {
 | 
						|
	gorm.Model
 | 
						|
	TournamentID         int
 | 
						|
	Stage                int
 | 
						|
	Order                int
 | 
						|
	Participant1ID       int
 | 
						|
	Participant1         Participant `gorm:"foreignKey:Participant1ID"`
 | 
						|
	Participant2ID       int
 | 
						|
	Participant2         Participant `gorm:"foreignKey:Participant2ID"`
 | 
						|
	WinnierParticipantID int
 | 
						|
	WinnierParticipant   Participant `gorm:"foreignKey:WinnierParticipantID"`
 | 
						|
}
 |