return color by string, added rounds since maxrounds is not defined in pre-riptide matches

This commit is contained in:
2021-10-08 20:59:14 +02:00
parent cc48365eea
commit cce5c5d072
17 changed files with 283 additions and 18 deletions

View File

@@ -92,6 +92,12 @@ func (mc *MatchCreate) SetMaxRounds(i int) *MatchCreate {
return mc
}
// SetRounds sets the "rounds" field.
func (mc *MatchCreate) SetRounds(i int) *MatchCreate {
mc.mutation.SetRounds(i)
return mc
}
// SetDemoExpired sets the "demo_expired" field.
func (mc *MatchCreate) SetDemoExpired(b bool) *MatchCreate {
mc.mutation.SetDemoExpired(b)
@@ -286,6 +292,9 @@ func (mc *MatchCreate) check() error {
if _, ok := mc.mutation.MaxRounds(); !ok {
return &ValidationError{Name: "max_rounds", err: errors.New(`ent: missing required field "max_rounds"`)}
}
if _, ok := mc.mutation.Rounds(); !ok {
return &ValidationError{Name: "rounds", err: errors.New(`ent: missing required field "rounds"`)}
}
if _, ok := mc.mutation.DemoExpired(); !ok {
return &ValidationError{Name: "demo_expired", err: errors.New(`ent: missing required field "demo_expired"`)}
}
@@ -397,6 +406,14 @@ func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
})
_node.MaxRounds = value
}
if value, ok := mc.mutation.Rounds(); ok {
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
Type: field.TypeInt,
Value: value,
Column: match.FieldRounds,
})
_node.Rounds = value
}
if value, ok := mc.mutation.DemoExpired(); ok {
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
Type: field.TypeBool,