44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
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("id").Unique().Immutable().StructTag(`json:"steamid,string"`),
|
|
field.String("name").Optional(),
|
|
field.String("avatar").Optional(),
|
|
field.String("vanity_url").Optional(),
|
|
field.String("vanity_url_real").Optional(),
|
|
field.Time("vac_date").Optional(),
|
|
field.Int("vac_count").Optional(),
|
|
field.Time("game_ban_date").Optional(),
|
|
field.Int("game_ban_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(),
|
|
field.Time("profile_created").Optional(),
|
|
field.String("oldest_sharecode_seen").Optional(),
|
|
}
|
|
}
|
|
|
|
// Edges of the Player.
|
|
func (Player) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
edge.To("stats", Stats.Type),
|
|
edge.To("matches", Match.Type),
|
|
}
|
|
}
|