42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/edge"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// Match holds the schema definition for the Match entity.
|
|
type Match struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the Match.
|
|
func (Match) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Uint64("id").Unique().Immutable().StructTag(`json:"match_id,string"`),
|
|
field.String("share_code"),
|
|
field.String("map").Optional(),
|
|
field.Time("date"),
|
|
field.Int("score_team_a"),
|
|
field.Int("score_team_b"),
|
|
field.String("replay_url").Optional().StructTag(`json:"-"`),
|
|
field.Int("duration"),
|
|
field.Int("match_result"),
|
|
field.Int("max_rounds"),
|
|
field.Bool("demo_parsed").Default(false),
|
|
field.Bool("vac_present").Default(false),
|
|
field.Bool("gameban_present").Default(false),
|
|
field.Bytes("decryption_key").Optional(),
|
|
field.Float("tick_rate").Optional(),
|
|
}
|
|
}
|
|
|
|
// Edges of the Match.
|
|
func (Match) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
edge.To("stats", MatchPlayer.Type),
|
|
edge.From("players", Player.Type).Ref("matches"),
|
|
}
|
|
}
|