feat: add archive item options (#122)

Add archive option feature. Archived items can only be seen on the items page when including archived is selected. Archived items are excluded from the count and from other views
This commit is contained in:
Hayden 2022-10-31 23:30:42 -08:00 committed by GitHub
parent c722495fdd
commit a886fa86ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 325 additions and 38 deletions

View file

@ -121,6 +121,20 @@ func (iu *ItemUpdate) SetNillableInsured(b *bool) *ItemUpdate {
return iu
}
// SetArchived sets the "archived" field.
func (iu *ItemUpdate) SetArchived(b bool) *ItemUpdate {
iu.mutation.SetArchived(b)
return iu
}
// SetNillableArchived sets the "archived" field if the given value is not nil.
func (iu *ItemUpdate) SetNillableArchived(b *bool) *ItemUpdate {
if b != nil {
iu.SetArchived(*b)
}
return iu
}
// SetSerialNumber sets the "serial_number" field.
func (iu *ItemUpdate) SetSerialNumber(s string) *ItemUpdate {
iu.mutation.SetSerialNumber(s)
@ -795,6 +809,13 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
Column: item.FieldInsured,
})
}
if value, ok := iu.mutation.Archived(); ok {
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
Type: field.TypeBool,
Value: value,
Column: item.FieldArchived,
})
}
if value, ok := iu.mutation.SerialNumber(); ok {
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
Type: field.TypeString,
@ -1387,6 +1408,20 @@ func (iuo *ItemUpdateOne) SetNillableInsured(b *bool) *ItemUpdateOne {
return iuo
}
// SetArchived sets the "archived" field.
func (iuo *ItemUpdateOne) SetArchived(b bool) *ItemUpdateOne {
iuo.mutation.SetArchived(b)
return iuo
}
// SetNillableArchived sets the "archived" field if the given value is not nil.
func (iuo *ItemUpdateOne) SetNillableArchived(b *bool) *ItemUpdateOne {
if b != nil {
iuo.SetArchived(*b)
}
return iuo
}
// SetSerialNumber sets the "serial_number" field.
func (iuo *ItemUpdateOne) SetSerialNumber(s string) *ItemUpdateOne {
iuo.mutation.SetSerialNumber(s)
@ -2091,6 +2126,13 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
Column: item.FieldInsured,
})
}
if value, ok := iuo.mutation.Archived(); ok {
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
Type: field.TypeBool,
Value: value,
Column: item.FieldArchived,
})
}
if value, ok := iuo.mutation.SerialNumber(); ok {
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
Type: field.TypeString,