import from unified repo
This commit is contained in:
40
ent/schema/player.go
Normal file
40
ent/schema/player.go
Normal 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),
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user