added vac/gameban marker for matches

This commit is contained in:
2021-10-28 08:47:41 +02:00
parent 25b153900f
commit 37233be336
14 changed files with 371 additions and 10 deletions

View File

@@ -106,6 +106,34 @@ func (mc *MatchCreate) SetNillableDemoParsed(b *bool) *MatchCreate {
return mc
}
// SetVacPresent sets the "vac_present" field.
func (mc *MatchCreate) SetVacPresent(b bool) *MatchCreate {
mc.mutation.SetVacPresent(b)
return mc
}
// SetNillableVacPresent sets the "vac_present" field if the given value is not nil.
func (mc *MatchCreate) SetNillableVacPresent(b *bool) *MatchCreate {
if b != nil {
mc.SetVacPresent(*b)
}
return mc
}
// SetGamebanPresent sets the "gameban_present" field.
func (mc *MatchCreate) SetGamebanPresent(b bool) *MatchCreate {
mc.mutation.SetGamebanPresent(b)
return mc
}
// SetNillableGamebanPresent sets the "gameban_present" field if the given value is not nil.
func (mc *MatchCreate) SetNillableGamebanPresent(b *bool) *MatchCreate {
if b != nil {
mc.SetGamebanPresent(*b)
}
return mc
}
// SetID sets the "id" field.
func (mc *MatchCreate) SetID(u uint64) *MatchCreate {
mc.mutation.SetID(u)
@@ -217,6 +245,14 @@ func (mc *MatchCreate) defaults() {
v := match.DefaultDemoParsed
mc.mutation.SetDemoParsed(v)
}
if _, ok := mc.mutation.VacPresent(); !ok {
v := match.DefaultVacPresent
mc.mutation.SetVacPresent(v)
}
if _, ok := mc.mutation.GamebanPresent(); !ok {
v := match.DefaultGamebanPresent
mc.mutation.SetGamebanPresent(v)
}
}
// check runs all checks and user-defined validators on the builder.
@@ -245,6 +281,12 @@ func (mc *MatchCreate) check() error {
if _, ok := mc.mutation.DemoParsed(); !ok {
return &ValidationError{Name: "demo_parsed", err: errors.New(`ent: missing required field "demo_parsed"`)}
}
if _, ok := mc.mutation.VacPresent(); !ok {
return &ValidationError{Name: "vac_present", err: errors.New(`ent: missing required field "vac_present"`)}
}
if _, ok := mc.mutation.GamebanPresent(); !ok {
return &ValidationError{Name: "gameban_present", err: errors.New(`ent: missing required field "gameban_present"`)}
}
return nil
}
@@ -358,6 +400,22 @@ func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
})
_node.DemoParsed = value
}
if value, ok := mc.mutation.VacPresent(); ok {
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
Type: field.TypeBool,
Value: value,
Column: match.FieldVacPresent,
})
_node.VacPresent = value
}
if value, ok := mc.mutation.GamebanPresent(); ok {
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
Type: field.TypeBool,
Value: value,
Column: match.FieldGamebanPresent,
})
_node.GamebanPresent = value
}
if nodes := mc.mutation.StatsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,