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

View File

@@ -6,6 +6,7 @@ import (
"context"
"csgowtfd/ent/match"
"csgowtfd/ent/player"
"csgowtfd/ent/roundstats"
"csgowtfd/ent/stats"
"csgowtfd/ent/weaponstats"
"errors"
@@ -565,6 +566,21 @@ func (sc *StatsCreate) AddWeaponStats(w ...*WeaponStats) *StatsCreate {
return sc.AddWeaponStatIDs(ids...)
}
// AddRoundStatIDs adds the "round_stats" edge to the RoundStats entity by IDs.
func (sc *StatsCreate) AddRoundStatIDs(ids ...int) *StatsCreate {
sc.mutation.AddRoundStatIDs(ids...)
return sc
}
// AddRoundStats adds the "round_stats" edges to the RoundStats entity.
func (sc *StatsCreate) AddRoundStats(r ...*RoundStats) *StatsCreate {
ids := make([]int, len(r))
for i := range r {
ids[i] = r[i].ID
}
return sc.AddRoundStatIDs(ids...)
}
// Mutation returns the StatsMutation object of the builder.
func (sc *StatsCreate) Mutation() *StatsMutation {
return sc.mutation
@@ -1043,6 +1059,25 @@ func (sc *StatsCreate) createSpec() (*Stats, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := sc.mutation.RoundStatsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: stats.RoundStatsTable,
Columns: []string{stats.RoundStatsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeInt,
Column: roundstats.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
return _node, _spec
}