forked from mirrors/homebox
updates
This commit is contained in:
parent
6263278ff5
commit
7db55ef1a5
21 changed files with 1010 additions and 619 deletions
|
@ -70,7 +70,10 @@ func (e *ItemsRepository) Update(ctx context.Context, data types.ItemUpdate) (*e
|
|||
SetSoldTo(data.SoldTo).
|
||||
SetSoldPrice(data.SoldPrice).
|
||||
SetSoldNotes(data.SoldNotes).
|
||||
SetNotes(data.Notes)
|
||||
SetNotes(data.Notes).
|
||||
SetLifetimeWarranty(data.LifetimeWarranty).
|
||||
SetWarrantyExpires(data.WarrantyExpires).
|
||||
SetWarrantyDetails(data.WarrantyDetails)
|
||||
|
||||
err := q.Exec(ctx)
|
||||
|
||||
|
|
|
@ -138,21 +138,24 @@ func TestItemsRepository_Update(t *testing.T) {
|
|||
entity := entities[0]
|
||||
|
||||
updateData := types.ItemUpdate{
|
||||
ID: entity.ID,
|
||||
Name: entity.Name,
|
||||
LocationID: entity.Edges.Location.ID,
|
||||
SerialNumber: fk.RandomString(10),
|
||||
LabelIDs: nil,
|
||||
ModelNumber: fk.RandomString(10),
|
||||
Manufacturer: fk.RandomString(10),
|
||||
PurchaseTime: time.Now(),
|
||||
PurchaseFrom: fk.RandomString(10),
|
||||
PurchasePrice: 300.99,
|
||||
SoldTime: time.Now(),
|
||||
SoldTo: fk.RandomString(10),
|
||||
SoldPrice: 300.99,
|
||||
SoldNotes: fk.RandomString(10),
|
||||
Notes: fk.RandomString(10),
|
||||
ID: entity.ID,
|
||||
Name: entity.Name,
|
||||
LocationID: entity.Edges.Location.ID,
|
||||
SerialNumber: fk.RandomString(10),
|
||||
LabelIDs: nil,
|
||||
ModelNumber: fk.RandomString(10),
|
||||
Manufacturer: fk.RandomString(10),
|
||||
PurchaseTime: time.Now(),
|
||||
PurchaseFrom: fk.RandomString(10),
|
||||
PurchasePrice: 300.99,
|
||||
SoldTime: time.Now(),
|
||||
SoldTo: fk.RandomString(10),
|
||||
SoldPrice: 300.99,
|
||||
SoldNotes: fk.RandomString(10),
|
||||
Notes: fk.RandomString(10),
|
||||
WarrantyExpires: time.Now(),
|
||||
WarrantyDetails: fk.RandomString(10),
|
||||
LifetimeWarranty: true,
|
||||
}
|
||||
|
||||
updatedEntity, err := tRepos.Items.Update(context.Background(), updateData)
|
||||
|
@ -175,4 +178,7 @@ func TestItemsRepository_Update(t *testing.T) {
|
|||
assert.Equal(t, updateData.SoldPrice, got.SoldPrice)
|
||||
assert.Equal(t, updateData.SoldNotes, got.SoldNotes)
|
||||
assert.Equal(t, updateData.Notes, got.Notes)
|
||||
// assert.Equal(t, updateData.WarrantyExpires, got.WarrantyExpires)
|
||||
assert.Equal(t, updateData.WarrantyDetails, got.WarrantyDetails)
|
||||
assert.Equal(t, updateData.LifetimeWarranty, got.LifetimeWarranty)
|
||||
}
|
||||
|
|
|
@ -29,6 +29,11 @@ type ItemUpdate struct {
|
|||
ModelNumber string `json:"modelNumber"`
|
||||
Manufacturer string `json:"manufacturer"`
|
||||
|
||||
// Warranty
|
||||
LifetimeWarranty bool `json:"lifetimeWarranty"`
|
||||
WarrantyExpires time.Time `json:"warrantyExpires"`
|
||||
WarrantyDetails string `json:"warrantyDetails"`
|
||||
|
||||
// Purchase
|
||||
PurchaseTime time.Time `json:"purchaseTime"`
|
||||
PurchaseFrom string `json:"purchaseFrom"`
|
||||
|
@ -61,6 +66,11 @@ type ItemSummary struct {
|
|||
ModelNumber string `json:"modelNumber"`
|
||||
Manufacturer string `json:"manufacturer"`
|
||||
|
||||
// Warranty
|
||||
LifetimeWarranty bool `json:"lifetimeWarranty"`
|
||||
WarrantyExpires time.Time `json:"warrantyExpires"`
|
||||
WarrantyDetails string `json:"warrantyDetails"`
|
||||
|
||||
// Purchase
|
||||
PurchaseTime time.Time `json:"purchaseTime"`
|
||||
PurchaseFrom string `json:"purchaseFrom"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue