diff --git a/backend/internal/data/ent/maintenanceentry.go b/backend/internal/data/ent/maintenanceentry.go index 790f456..98301c8 100644 --- a/backend/internal/data/ent/maintenanceentry.go +++ b/backend/internal/data/ent/maintenanceentry.go @@ -34,8 +34,6 @@ type MaintenanceEntry struct { Description string `json:"description,omitempty"` // Cost holds the value of the "cost" field. Cost float64 `json:"cost,omitempty"` - // RemindersEnabled holds the value of the "reminders_enabled" field. - RemindersEnabled bool `json:"reminders_enabled,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the MaintenanceEntryQuery when eager-loading is set. Edges MaintenanceEntryEdges `json:"edges"` @@ -68,8 +66,6 @@ func (*MaintenanceEntry) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { - case maintenanceentry.FieldRemindersEnabled: - values[i] = new(sql.NullBool) case maintenanceentry.FieldCost: values[i] = new(sql.NullFloat64) case maintenanceentry.FieldName, maintenanceentry.FieldDescription: @@ -147,12 +143,6 @@ func (me *MaintenanceEntry) assignValues(columns []string, values []any) error { } else if value.Valid { me.Cost = value.Float64 } - case maintenanceentry.FieldRemindersEnabled: - if value, ok := values[i].(*sql.NullBool); !ok { - return fmt.Errorf("unexpected type %T for field reminders_enabled", values[i]) - } else if value.Valid { - me.RemindersEnabled = value.Bool - } } } return nil @@ -209,9 +199,6 @@ func (me *MaintenanceEntry) String() string { builder.WriteString(", ") builder.WriteString("cost=") builder.WriteString(fmt.Sprintf("%v", me.Cost)) - builder.WriteString(", ") - builder.WriteString("reminders_enabled=") - builder.WriteString(fmt.Sprintf("%v", me.RemindersEnabled)) builder.WriteByte(')') return builder.String() } diff --git a/backend/internal/data/ent/maintenanceentry/maintenanceentry.go b/backend/internal/data/ent/maintenanceentry/maintenanceentry.go index 95a4bac..690a696 100644 --- a/backend/internal/data/ent/maintenanceentry/maintenanceentry.go +++ b/backend/internal/data/ent/maintenanceentry/maintenanceentry.go @@ -29,8 +29,6 @@ const ( FieldDescription = "description" // FieldCost holds the string denoting the cost field in the database. FieldCost = "cost" - // FieldRemindersEnabled holds the string denoting the reminders_enabled field in the database. - FieldRemindersEnabled = "reminders_enabled" // EdgeItem holds the string denoting the item edge name in mutations. EdgeItem = "item" // Table holds the table name of the maintenanceentry in the database. @@ -55,7 +53,6 @@ var Columns = []string{ FieldName, FieldDescription, FieldCost, - FieldRemindersEnabled, } // ValidColumn reports if the column name is valid (part of the table columns). @@ -81,8 +78,6 @@ var ( DescriptionValidator func(string) error // DefaultCost holds the default value on creation for the "cost" field. DefaultCost float64 - // DefaultRemindersEnabled holds the default value on creation for the "reminders_enabled" field. - DefaultRemindersEnabled bool // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) diff --git a/backend/internal/data/ent/maintenanceentry/where.go b/backend/internal/data/ent/maintenanceentry/where.go index 62d32af..798ce63 100644 --- a/backend/internal/data/ent/maintenanceentry/where.go +++ b/backend/internal/data/ent/maintenanceentry/where.go @@ -96,11 +96,6 @@ func Cost(v float64) predicate.MaintenanceEntry { return predicate.MaintenanceEntry(sql.FieldEQ(FieldCost, v)) } -// RemindersEnabled applies equality check predicate on the "reminders_enabled" field. It's identical to RemindersEnabledEQ. -func RemindersEnabled(v bool) predicate.MaintenanceEntry { - return predicate.MaintenanceEntry(sql.FieldEQ(FieldRemindersEnabled, v)) -} - // CreatedAtEQ applies the EQ predicate on the "created_at" field. func CreatedAtEQ(v time.Time) predicate.MaintenanceEntry { return predicate.MaintenanceEntry(sql.FieldEQ(FieldCreatedAt, v)) @@ -481,16 +476,6 @@ func CostLTE(v float64) predicate.MaintenanceEntry { return predicate.MaintenanceEntry(sql.FieldLTE(FieldCost, v)) } -// RemindersEnabledEQ applies the EQ predicate on the "reminders_enabled" field. -func RemindersEnabledEQ(v bool) predicate.MaintenanceEntry { - return predicate.MaintenanceEntry(sql.FieldEQ(FieldRemindersEnabled, v)) -} - -// RemindersEnabledNEQ applies the NEQ predicate on the "reminders_enabled" field. -func RemindersEnabledNEQ(v bool) predicate.MaintenanceEntry { - return predicate.MaintenanceEntry(sql.FieldNEQ(FieldRemindersEnabled, v)) -} - // HasItem applies the HasEdge predicate on the "item" edge. func HasItem() predicate.MaintenanceEntry { return predicate.MaintenanceEntry(func(s *sql.Selector) { diff --git a/backend/internal/data/ent/maintenanceentry_create.go b/backend/internal/data/ent/maintenanceentry_create.go index 4b2e052..da81f9f 100644 --- a/backend/internal/data/ent/maintenanceentry_create.go +++ b/backend/internal/data/ent/maintenanceentry_create.go @@ -118,20 +118,6 @@ func (mec *MaintenanceEntryCreate) SetNillableCost(f *float64) *MaintenanceEntry return mec } -// SetRemindersEnabled sets the "reminders_enabled" field. -func (mec *MaintenanceEntryCreate) SetRemindersEnabled(b bool) *MaintenanceEntryCreate { - mec.mutation.SetRemindersEnabled(b) - return mec -} - -// SetNillableRemindersEnabled sets the "reminders_enabled" field if the given value is not nil. -func (mec *MaintenanceEntryCreate) SetNillableRemindersEnabled(b *bool) *MaintenanceEntryCreate { - if b != nil { - mec.SetRemindersEnabled(*b) - } - return mec -} - // SetID sets the "id" field. func (mec *MaintenanceEntryCreate) SetID(u uuid.UUID) *MaintenanceEntryCreate { mec.mutation.SetID(u) @@ -198,10 +184,6 @@ func (mec *MaintenanceEntryCreate) defaults() { v := maintenanceentry.DefaultCost mec.mutation.SetCost(v) } - if _, ok := mec.mutation.RemindersEnabled(); !ok { - v := maintenanceentry.DefaultRemindersEnabled - mec.mutation.SetRemindersEnabled(v) - } if _, ok := mec.mutation.ID(); !ok { v := maintenanceentry.DefaultID() mec.mutation.SetID(v) @@ -235,9 +217,6 @@ func (mec *MaintenanceEntryCreate) check() error { if _, ok := mec.mutation.Cost(); !ok { return &ValidationError{Name: "cost", err: errors.New(`ent: missing required field "MaintenanceEntry.cost"`)} } - if _, ok := mec.mutation.RemindersEnabled(); !ok { - return &ValidationError{Name: "reminders_enabled", err: errors.New(`ent: missing required field "MaintenanceEntry.reminders_enabled"`)} - } if _, ok := mec.mutation.ItemID(); !ok { return &ValidationError{Name: "item", err: errors.New(`ent: missing required edge "MaintenanceEntry.item"`)} } @@ -304,10 +283,6 @@ func (mec *MaintenanceEntryCreate) createSpec() (*MaintenanceEntry, *sqlgraph.Cr _spec.SetField(maintenanceentry.FieldCost, field.TypeFloat64, value) _node.Cost = value } - if value, ok := mec.mutation.RemindersEnabled(); ok { - _spec.SetField(maintenanceentry.FieldRemindersEnabled, field.TypeBool, value) - _node.RemindersEnabled = value - } if nodes := mec.mutation.ItemIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, diff --git a/backend/internal/data/ent/maintenanceentry_update.go b/backend/internal/data/ent/maintenanceentry_update.go index 98c2ba6..e9ed740 100644 --- a/backend/internal/data/ent/maintenanceentry_update.go +++ b/backend/internal/data/ent/maintenanceentry_update.go @@ -129,20 +129,6 @@ func (meu *MaintenanceEntryUpdate) AddCost(f float64) *MaintenanceEntryUpdate { return meu } -// SetRemindersEnabled sets the "reminders_enabled" field. -func (meu *MaintenanceEntryUpdate) SetRemindersEnabled(b bool) *MaintenanceEntryUpdate { - meu.mutation.SetRemindersEnabled(b) - return meu -} - -// SetNillableRemindersEnabled sets the "reminders_enabled" field if the given value is not nil. -func (meu *MaintenanceEntryUpdate) SetNillableRemindersEnabled(b *bool) *MaintenanceEntryUpdate { - if b != nil { - meu.SetRemindersEnabled(*b) - } - return meu -} - // SetItem sets the "item" edge to the Item entity. func (meu *MaintenanceEntryUpdate) SetItem(i *Item) *MaintenanceEntryUpdate { return meu.SetItemID(i.ID) @@ -255,9 +241,6 @@ func (meu *MaintenanceEntryUpdate) sqlSave(ctx context.Context) (n int, err erro if value, ok := meu.mutation.AddedCost(); ok { _spec.AddField(maintenanceentry.FieldCost, field.TypeFloat64, value) } - if value, ok := meu.mutation.RemindersEnabled(); ok { - _spec.SetField(maintenanceentry.FieldRemindersEnabled, field.TypeBool, value) - } if meu.mutation.ItemCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, @@ -406,20 +389,6 @@ func (meuo *MaintenanceEntryUpdateOne) AddCost(f float64) *MaintenanceEntryUpdat return meuo } -// SetRemindersEnabled sets the "reminders_enabled" field. -func (meuo *MaintenanceEntryUpdateOne) SetRemindersEnabled(b bool) *MaintenanceEntryUpdateOne { - meuo.mutation.SetRemindersEnabled(b) - return meuo -} - -// SetNillableRemindersEnabled sets the "reminders_enabled" field if the given value is not nil. -func (meuo *MaintenanceEntryUpdateOne) SetNillableRemindersEnabled(b *bool) *MaintenanceEntryUpdateOne { - if b != nil { - meuo.SetRemindersEnabled(*b) - } - return meuo -} - // SetItem sets the "item" edge to the Item entity. func (meuo *MaintenanceEntryUpdateOne) SetItem(i *Item) *MaintenanceEntryUpdateOne { return meuo.SetItemID(i.ID) @@ -562,9 +531,6 @@ func (meuo *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *Main if value, ok := meuo.mutation.AddedCost(); ok { _spec.AddField(maintenanceentry.FieldCost, field.TypeFloat64, value) } - if value, ok := meuo.mutation.RemindersEnabled(); ok { - _spec.SetField(maintenanceentry.FieldRemindersEnabled, field.TypeBool, value) - } if meuo.mutation.ItemCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, diff --git a/backend/internal/data/ent/migrate/schema.go b/backend/internal/data/ent/migrate/schema.go index 1ce050a..8d57b5c 100644 --- a/backend/internal/data/ent/migrate/schema.go +++ b/backend/internal/data/ent/migrate/schema.go @@ -328,7 +328,6 @@ var ( {Name: "name", Type: field.TypeString, Size: 255}, {Name: "description", Type: field.TypeString, Nullable: true, Size: 2500}, {Name: "cost", Type: field.TypeFloat64, Default: 0}, - {Name: "reminders_enabled", Type: field.TypeBool, Default: false}, {Name: "item_id", Type: field.TypeUUID}, } // MaintenanceEntriesTable holds the schema information for the "maintenance_entries" table. @@ -339,7 +338,7 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "maintenance_entries_items_maintenance_entries", - Columns: []*schema.Column{MaintenanceEntriesColumns[9]}, + Columns: []*schema.Column{MaintenanceEntriesColumns[8]}, RefColumns: []*schema.Column{ItemsColumns[0]}, OnDelete: schema.Cascade, }, diff --git a/backend/internal/data/ent/mutation.go b/backend/internal/data/ent/mutation.go index cb6c49d..bc38aeb 100644 --- a/backend/internal/data/ent/mutation.go +++ b/backend/internal/data/ent/mutation.go @@ -9002,24 +9002,23 @@ func (m *LocationMutation) ResetEdge(name string) error { // MaintenanceEntryMutation represents an operation that mutates the MaintenanceEntry nodes in the graph. type MaintenanceEntryMutation struct { config - op Op - typ string - id *uuid.UUID - created_at *time.Time - updated_at *time.Time - date *time.Time - scheduled_date *time.Time - name *string - description *string - cost *float64 - addcost *float64 - reminders_enabled *bool - clearedFields map[string]struct{} - item *uuid.UUID - cleareditem bool - done bool - oldValue func(context.Context) (*MaintenanceEntry, error) - predicates []predicate.MaintenanceEntry + op Op + typ string + id *uuid.UUID + created_at *time.Time + updated_at *time.Time + date *time.Time + scheduled_date *time.Time + name *string + description *string + cost *float64 + addcost *float64 + clearedFields map[string]struct{} + item *uuid.UUID + cleareditem bool + done bool + oldValue func(context.Context) (*MaintenanceEntry, error) + predicates []predicate.MaintenanceEntry } var _ ent.Mutation = (*MaintenanceEntryMutation)(nil) @@ -9473,42 +9472,6 @@ func (m *MaintenanceEntryMutation) ResetCost() { m.addcost = nil } -// SetRemindersEnabled sets the "reminders_enabled" field. -func (m *MaintenanceEntryMutation) SetRemindersEnabled(b bool) { - m.reminders_enabled = &b -} - -// RemindersEnabled returns the value of the "reminders_enabled" field in the mutation. -func (m *MaintenanceEntryMutation) RemindersEnabled() (r bool, exists bool) { - v := m.reminders_enabled - if v == nil { - return - } - return *v, true -} - -// OldRemindersEnabled returns the old "reminders_enabled" field's value of the MaintenanceEntry entity. -// If the MaintenanceEntry object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *MaintenanceEntryMutation) OldRemindersEnabled(ctx context.Context) (v bool, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldRemindersEnabled is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldRemindersEnabled requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldRemindersEnabled: %w", err) - } - return oldValue.RemindersEnabled, nil -} - -// ResetRemindersEnabled resets all changes to the "reminders_enabled" field. -func (m *MaintenanceEntryMutation) ResetRemindersEnabled() { - m.reminders_enabled = nil -} - // ClearItem clears the "item" edge to the Item entity. func (m *MaintenanceEntryMutation) ClearItem() { m.cleareditem = true @@ -9569,7 +9532,7 @@ func (m *MaintenanceEntryMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *MaintenanceEntryMutation) Fields() []string { - fields := make([]string, 0, 9) + fields := make([]string, 0, 8) if m.created_at != nil { fields = append(fields, maintenanceentry.FieldCreatedAt) } @@ -9594,9 +9557,6 @@ func (m *MaintenanceEntryMutation) Fields() []string { if m.cost != nil { fields = append(fields, maintenanceentry.FieldCost) } - if m.reminders_enabled != nil { - fields = append(fields, maintenanceentry.FieldRemindersEnabled) - } return fields } @@ -9621,8 +9581,6 @@ func (m *MaintenanceEntryMutation) Field(name string) (ent.Value, bool) { return m.Description() case maintenanceentry.FieldCost: return m.Cost() - case maintenanceentry.FieldRemindersEnabled: - return m.RemindersEnabled() } return nil, false } @@ -9648,8 +9606,6 @@ func (m *MaintenanceEntryMutation) OldField(ctx context.Context, name string) (e return m.OldDescription(ctx) case maintenanceentry.FieldCost: return m.OldCost(ctx) - case maintenanceentry.FieldRemindersEnabled: - return m.OldRemindersEnabled(ctx) } return nil, fmt.Errorf("unknown MaintenanceEntry field %s", name) } @@ -9715,13 +9671,6 @@ func (m *MaintenanceEntryMutation) SetField(name string, value ent.Value) error } m.SetCost(v) return nil - case maintenanceentry.FieldRemindersEnabled: - v, ok := value.(bool) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetRemindersEnabled(v) - return nil } return fmt.Errorf("unknown MaintenanceEntry field %s", name) } @@ -9831,9 +9780,6 @@ func (m *MaintenanceEntryMutation) ResetField(name string) error { case maintenanceentry.FieldCost: m.ResetCost() return nil - case maintenanceentry.FieldRemindersEnabled: - m.ResetRemindersEnabled() - return nil } return fmt.Errorf("unknown MaintenanceEntry field %s", name) } diff --git a/backend/internal/data/ent/runtime.go b/backend/internal/data/ent/runtime.go index 7f3bd24..9edc90b 100644 --- a/backend/internal/data/ent/runtime.go +++ b/backend/internal/data/ent/runtime.go @@ -473,10 +473,6 @@ func init() { maintenanceentryDescCost := maintenanceentryFields[5].Descriptor() // maintenanceentry.DefaultCost holds the default value on creation for the cost field. maintenanceentry.DefaultCost = maintenanceentryDescCost.Default.(float64) - // maintenanceentryDescRemindersEnabled is the schema descriptor for reminders_enabled field. - maintenanceentryDescRemindersEnabled := maintenanceentryFields[6].Descriptor() - // maintenanceentry.DefaultRemindersEnabled holds the default value on creation for the reminders_enabled field. - maintenanceentry.DefaultRemindersEnabled = maintenanceentryDescRemindersEnabled.Default.(bool) // maintenanceentryDescID is the schema descriptor for id field. maintenanceentryDescID := maintenanceentryMixinFields0[0].Descriptor() // maintenanceentry.DefaultID holds the default value on creation for the id field.