added roundstats with eco info, switched to avatar hash

This commit is contained in:
2021-10-17 03:52:20 +02:00
parent 7f5a2f8956
commit fd8c026a8e
35 changed files with 4187 additions and 160 deletions

29
ent/schema/RoundStats.go Normal file
View File

@@ -0,0 +1,29 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// RoundStats holds the schema definition for the EcoStats entity.
type RoundStats struct {
ent.Schema
}
// Fields of the EcoStats.
func (RoundStats) Fields() []ent.Field {
return []ent.Field{
field.Uint("round"),
field.Uint("bank"),
field.Uint("equipment"),
field.Uint("spent"),
}
}
// Edges of the RoundStats.
func (RoundStats) Edges() []ent.Edge {
return []ent.Edge{
edge.From("stat", Stats.Type).Ref("round_stats").Unique(),
}
}

View File

@@ -17,7 +17,7 @@ func (Player) Fields() []ent.Field {
return []ent.Field{
field.Uint64("id").Unique().Immutable().StructTag(`json:"steamid,string"`),
field.String("name").Optional(),
field.String("avatar_url").Optional(),
field.String("avatar").Optional(),
field.String("vanity_url").Optional(),
field.String("vanity_url_real").Optional(),
field.Bool("vac").Default(false),

View File

@@ -62,5 +62,6 @@ func (Stats) Edges() []ent.Edge {
edge.From("matches", Match.Type).Ref("stats").Unique().Field("match_stats"),
edge.From("players", Player.Type).Ref("stats").Unique().Field("player_stats"),
edge.To("weapon_stats", WeaponStats.Type),
edge.To("round_stats", RoundStats.Type),
}
}