import from unified repo
This commit is contained in:
45
ent/schema/match.go
Normal file
45
ent/schema/match.go
Normal file
@@ -0,0 +1,45 @@
|
||||
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("match_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_expired").Default(false),
|
||||
field.Bool("demo_parsed").Default(false),
|
||||
field.JSON("eco", struct {
|
||||
Rounds []*struct {
|
||||
Team int `json:"team"`
|
||||
Bank int `json:"bank"`
|
||||
Equipment int `json:"equipment"`
|
||||
} `json:"rounds"`
|
||||
}{}).Optional(),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Match.
|
||||
func (Match) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.To("stats", Stats.Type),
|
||||
edge.From("players", Player.Type).Ref("matches"),
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user