import from unified repo

This commit is contained in:
2021-10-03 16:24:20 +02:00
commit 79d1df4cf3
50 changed files with 21269 additions and 0 deletions

40
ent/schema/player.go Normal file
View File

@@ -0,0 +1,40 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"time"
)
// Player holds the schema definition for the Player entity.
type Player struct {
ent.Schema
}
// Fields of the Player.
func (Player) Fields() []ent.Field {
return []ent.Field{
field.Uint64("steamid").Unique().Immutable().StructTag(`json:",string"`),
field.String("name").Optional(),
field.String("avatar_url").Optional(),
field.String("vanity_url").Optional(),
field.String("vanity_url_real").Optional(),
field.Bool("vac").Default(false),
field.Time("vac_date").Optional(),
field.Int("vac_count").Optional(),
field.Time("steam_updated").Default(func() time.Time {
return time.Now().UTC()
}).StructTag(`json:"-"`),
field.Time("sharecode_updated").Optional().StructTag(`json:"-"`),
field.String("auth_code").Optional().Sensitive(),
}
}
// Edges of the Player.
func (Player) Edges() []ent.Edge {
return []ent.Edge{
edge.To("stats", Stats.Type),
edge.To("matches", Match.Type),
}
}