diff --git a/backend/internal/data/ent/item_create.go b/backend/internal/data/ent/item_create.go
index 97ed01ea..a9b79cdd 100644
--- a/backend/internal/data/ent/item_create.go
+++ b/backend/internal/data/ent/item_create.go
@@ -159,6 +159,20 @@ func (ic *ItemCreate) SetNillableAssetID(i *int) *ItemCreate {
return ic
}
+// SetSyncChildItemsLocations sets the "sync_child_items_locations" field.
+func (ic *ItemCreate) SetSyncChildItemsLocations(b bool) *ItemCreate {
+ ic.mutation.SetSyncChildItemsLocations(b)
+ return ic
+}
+
+// SetNillableSyncChildItemsLocations sets the "sync_child_items_locations" field if the given value is not nil.
+func (ic *ItemCreate) SetNillableSyncChildItemsLocations(b *bool) *ItemCreate {
+ if b != nil {
+ ic.SetSyncChildItemsLocations(*b)
+ }
+ return ic
+}
+
// SetSerialNumber sets the "serial_number" field.
func (ic *ItemCreate) SetSerialNumber(s string) *ItemCreate {
ic.mutation.SetSerialNumber(s)
@@ -538,6 +552,10 @@ func (ic *ItemCreate) defaults() {
v := item.DefaultAssetID
ic.mutation.SetAssetID(v)
}
+ if _, ok := ic.mutation.SyncChildItemsLocations(); !ok {
+ v := item.DefaultSyncChildItemsLocations
+ ic.mutation.SetSyncChildItemsLocations(v)
+ }
if _, ok := ic.mutation.LifetimeWarranty(); !ok {
v := item.DefaultLifetimeWarranty
ic.mutation.SetLifetimeWarranty(v)
@@ -599,6 +617,9 @@ func (ic *ItemCreate) check() error {
if _, ok := ic.mutation.AssetID(); !ok {
return &ValidationError{Name: "asset_id", err: errors.New(`ent: missing required field "Item.asset_id"`)}
}
+ if _, ok := ic.mutation.SyncChildItemsLocations(); !ok {
+ return &ValidationError{Name: "sync_child_items_locations", err: errors.New(`ent: missing required field "Item.sync_child_items_locations"`)}
+ }
if v, ok := ic.mutation.SerialNumber(); ok {
if err := item.SerialNumberValidator(v); err != nil {
return &ValidationError{Name: "serial_number", err: fmt.Errorf(`ent: validator failed for field "Item.serial_number": %w`, err)}
@@ -711,6 +732,10 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
_spec.SetField(item.FieldAssetID, field.TypeInt, value)
_node.AssetID = value
}
+ if value, ok := ic.mutation.SyncChildItemsLocations(); ok {
+ _spec.SetField(item.FieldSyncChildItemsLocations, field.TypeBool, value)
+ _node.SyncChildItemsLocations = value
+ }
if value, ok := ic.mutation.SerialNumber(); ok {
_spec.SetField(item.FieldSerialNumber, field.TypeString, value)
_node.SerialNumber = value
diff --git a/backend/internal/data/repo/repo_items.go b/backend/internal/data/repo/repo_items.go
index ff3562aa..7cb91553 100644
--- a/backend/internal/data/repo/repo_items.go
+++ b/backend/internal/data/repo/repo_items.go
@@ -55,11 +55,11 @@ type (
}
ItemCreate struct {
- ImportRef string `json:"-"`
- ParentID uuid.UUID `json:"parentId" extensions:"x-nullable"`
- Name string `json:"name" validate:"required,min=1,max=255"`
- Description string `json:"description" validate:"max=1000"`
- AssetID AssetID `json:"-"`
+ ImportRef string `json:"-"`
+ ParentID uuid.UUID `json:"parentId" extensions:"x-nullable"`
+ Name string `json:"name" validate:"required,min=1,max=255"`
+ Description string `json:"description" validate:"max=1000"`
+ AssetID AssetID `json:"-"`
// Edges
LocationID uuid.UUID `json:"locationId"`
@@ -67,11 +67,11 @@ type (
}
ItemUpdate struct {
- ParentID uuid.UUID `json:"parentId" extensions:"x-nullable,x-omitempty"`
+ ParentID uuid.UUID `json:"parentId" extensions:"x-nullable,x-omitempty"`
ID uuid.UUID `json:"id"`
- AssetID AssetID `json:"assetId" swaggertype:"string"`
- Name string `json:"name" validate:"required,min=1,max=255"`
- Description string `json:"description" validate:"max=1000"`
+ AssetID AssetID `json:"assetId" swaggertype:"string"`
+ Name string `json:"name" validate:"required,min=1,max=255"`
+ Description string `json:"description" validate:"max=1000"`
Quantity int `json:"quantity"`
Insured bool `json:"insured"`
Archived bool `json:"archived"`
@@ -93,12 +93,12 @@ type (
// Purchase
PurchaseTime types.Date `json:"purchaseTime"`
- PurchaseFrom string `json:"purchaseFrom" validate:"max=255"`
+ PurchaseFrom string `json:"purchaseFrom" validate:"max=255"`
PurchasePrice float64 `json:"purchasePrice" extensions:"x-nullable,x-omitempty"`
// Sold
SoldTime types.Date `json:"soldTime"`
- SoldTo string `json:"soldTo" validate:"max=255"`
+ SoldTo string `json:"soldTo" validate:"max=255"`
SoldPrice float64 `json:"soldPrice" extensions:"x-nullable,x-omitempty"`
SoldNotes string `json:"soldNotes"`
@@ -651,7 +651,7 @@ func (e *ItemsRepository) UpdateByGroup(ctx context.Context, gid uuid.UUID, data
return ItemOut{}, err
}
- if location != child_location.ID {
+ if location != childLocation.ID {
err = child.Update().SetLocationID(location).Exec(ctx)
if err != nil {
return ItemOut{}, err
diff --git a/frontend/components/Form/Toggle.vue b/frontend/components/Form/Toggle.vue
index 2e68d63e..e22decd5 100644
--- a/frontend/components/Form/Toggle.vue
+++ b/frontend/components/Form/Toggle.vue
@@ -1,36 +1,35 @@
-