mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 21:33:02 +01:00
Compare commits
4 Commits
v0.14.0
...
katos/purc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
809b0db5e5 | ||
|
|
ae8f568bfa | ||
|
|
87725348be | ||
|
|
da78f13513 |
@@ -2145,6 +2145,9 @@
|
|||||||
"purchaseFrom": {
|
"purchaseFrom": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"purchaseFrom": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"purchasePrice": {
|
"purchasePrice": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "0"
|
"example": "0"
|
||||||
|
|||||||
@@ -170,6 +170,8 @@ definitions:
|
|||||||
x-omitempty: true
|
x-omitempty: true
|
||||||
purchaseFrom:
|
purchaseFrom:
|
||||||
type: string
|
type: string
|
||||||
|
purchaseMethod:
|
||||||
|
type: string
|
||||||
purchasePrice:
|
purchasePrice:
|
||||||
example: "0"
|
example: "0"
|
||||||
type: string
|
type: string
|
||||||
|
|||||||
@@ -202,9 +202,10 @@ func (s *IOSheet) ReadItems(ctx context.Context, items []repo.ItemOut, GID uuid.
|
|||||||
Insured: item.Insured,
|
Insured: item.Insured,
|
||||||
Archived: item.Archived,
|
Archived: item.Archived,
|
||||||
|
|
||||||
PurchasePrice: item.PurchasePrice,
|
PurchasePrice: item.PurchasePrice,
|
||||||
PurchaseFrom: item.PurchaseFrom,
|
PurchaseMethod: item.PurchaseMethod,
|
||||||
PurchaseTime: item.PurchaseTime,
|
PurchaseFrom: item.PurchaseFrom,
|
||||||
|
PurchaseTime: item.PurchaseTime,
|
||||||
|
|
||||||
Manufacturer: item.Manufacturer,
|
Manufacturer: item.Manufacturer,
|
||||||
ModelNumber: item.ModelNumber,
|
ModelNumber: item.ModelNumber,
|
||||||
|
|||||||
@@ -298,6 +298,7 @@ func (svc *ItemService) CsvImport(ctx context.Context, GID uuid.UUID, data io.Re
|
|||||||
Archived: row.Archived,
|
Archived: row.Archived,
|
||||||
|
|
||||||
PurchasePrice: row.PurchasePrice,
|
PurchasePrice: row.PurchasePrice,
|
||||||
|
PurchaseFrom: row.PurchaseMethod,
|
||||||
PurchaseFrom: row.PurchaseFrom,
|
PurchaseFrom: row.PurchaseFrom,
|
||||||
PurchaseTime: row.PurchaseTime,
|
PurchaseTime: row.PurchaseTime,
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ func (Item) Fields() []ent.Field {
|
|||||||
|
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
// item purchase
|
// item purchase
|
||||||
|
field.String("purchase_method").
|
||||||
|
Optional(),
|
||||||
field.Time("purchase_time").
|
field.Time("purchase_time").
|
||||||
Optional(),
|
Optional(),
|
||||||
field.String("purchase_from").
|
field.String("purchase_from").
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ CREATE INDEX `documenttoken_token` ON `document_tokens` (`token`);
|
|||||||
-- create "groups" table
|
-- create "groups" table
|
||||||
CREATE TABLE `groups` (`id` uuid NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `name` text NOT NULL, `currency` text NOT NULL DEFAULT 'usd', PRIMARY KEY (`id`));
|
CREATE TABLE `groups` (`id` uuid NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `name` text NOT NULL, `currency` text NOT NULL DEFAULT 'usd', PRIMARY KEY (`id`));
|
||||||
-- create "items" table
|
-- create "items" table
|
||||||
CREATE TABLE `items` (`id` uuid NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `name` text NOT NULL, `description` text NULL, `import_ref` text NULL, `notes` text NULL, `quantity` integer NOT NULL DEFAULT 1, `insured` bool NOT NULL DEFAULT false, `serial_number` text NULL, `model_number` text NULL, `manufacturer` text NULL, `lifetime_warranty` bool NOT NULL DEFAULT false, `warranty_expires` datetime NULL, `warranty_details` text NULL, `purchase_time` datetime NULL, `purchase_from` text NULL, `purchase_price` real NOT NULL DEFAULT 0, `sold_time` datetime NULL, `sold_to` text NULL, `sold_price` real NOT NULL DEFAULT 0, `sold_notes` text NULL, `group_items` uuid NOT NULL, `location_items` uuid NULL, PRIMARY KEY (`id`), CONSTRAINT `items_groups_items` FOREIGN KEY (`group_items`) REFERENCES `groups` (`id`) ON DELETE CASCADE, CONSTRAINT `items_locations_items` FOREIGN KEY (`location_items`) REFERENCES `locations` (`id`) ON DELETE CASCADE);
|
CREATE TABLE `items` (`id` uuid NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `name` text NOT NULL, `description` text NULL, `import_ref` text NULL, `notes` text NULL, `quantity` integer NOT NULL DEFAULT 1, `insured` bool NOT NULL DEFAULT false, `serial_number` text NULL, `model_number` text NULL, `manufacturer` text NULL, `lifetime_warranty` bool NOT NULL DEFAULT false, `warranty_expires` datetime NULL, `warranty_details` text NULL, `purchase_method` text NULL, `purchase_time` datetime NULL, `purchase_from` text NULL, `purchase_price` real NOT NULL DEFAULT 0, `sold_time` datetime NULL, `sold_to` text NULL, `sold_price` real NOT NULL DEFAULT 0, `sold_notes` text NULL, `group_items` uuid NOT NULL, `location_items` uuid NULL, PRIMARY KEY (`id`), CONSTRAINT `items_groups_items` FOREIGN KEY (`group_items`) REFERENCES `groups` (`id`) ON DELETE CASCADE, CONSTRAINT `items_locations_items` FOREIGN KEY (`location_items`) REFERENCES `locations` (`id`) ON DELETE CASCADE);
|
||||||
-- create index "item_name" to table: "items"
|
-- create index "item_name" to table: "items"
|
||||||
CREATE INDEX `item_name` ON `items` (`name`);
|
CREATE INDEX `item_name` ON `items` (`name`);
|
||||||
-- create index "item_manufacturer" to table: "items"
|
-- create index "item_manufacturer" to table: "items"
|
||||||
|
|||||||
@@ -91,9 +91,10 @@ type (
|
|||||||
WarrantyDetails string `json:"warrantyDetails"`
|
WarrantyDetails string `json:"warrantyDetails"`
|
||||||
|
|
||||||
// Purchase
|
// Purchase
|
||||||
PurchaseTime types.Date `json:"purchaseTime"`
|
PurchaseMethod string `json:"purchaseMethod"`
|
||||||
PurchaseFrom string `json:"purchaseFrom"`
|
PurchaseTime types.Date `json:"purchaseTime"`
|
||||||
PurchasePrice float64 `json:"purchasePrice,string"`
|
PurchaseFrom string `json:"purchaseFrom"`
|
||||||
|
PurchasePrice float64 `json:"purchasePrice,string"`
|
||||||
|
|
||||||
// Sold
|
// Sold
|
||||||
SoldTime types.Date `json:"soldTime"`
|
SoldTime types.Date `json:"soldTime"`
|
||||||
@@ -147,8 +148,9 @@ type (
|
|||||||
WarrantyDetails string `json:"warrantyDetails"`
|
WarrantyDetails string `json:"warrantyDetails"`
|
||||||
|
|
||||||
// Purchase
|
// Purchase
|
||||||
PurchaseTime types.Date `json:"purchaseTime"`
|
PurchaseMethod string `json:"purchaseMethod"`
|
||||||
PurchaseFrom string `json:"purchaseFrom"`
|
PurchaseTime types.Date `json:"purchaseTime"`
|
||||||
|
PurchaseFrom string `json:"purchaseFrom"`
|
||||||
|
|
||||||
// Sold
|
// Sold
|
||||||
SoldTime types.Date `json:"soldTime"`
|
SoldTime types.Date `json:"soldTime"`
|
||||||
@@ -261,8 +263,8 @@ func mapItemOut(item *ent.Item) ItemOut {
|
|||||||
Manufacturer: item.Manufacturer,
|
Manufacturer: item.Manufacturer,
|
||||||
|
|
||||||
// Purchase
|
// Purchase
|
||||||
PurchaseTime: types.DateFromTime(item.PurchaseTime),
|
PurchaseTime: types.DateFromTime(item.PurchaseTime),
|
||||||
PurchaseFrom: item.PurchaseFrom,
|
PurchaseFrom: item.PurchaseFrom,
|
||||||
|
|
||||||
// Sold
|
// Sold
|
||||||
SoldTime: types.DateFromTime(item.SoldTime),
|
SoldTime: types.DateFromTime(item.SoldTime),
|
||||||
|
|||||||
@@ -236,6 +236,7 @@ func TestItemsRepository_Update(t *testing.T) {
|
|||||||
ModelNumber: fk.Str(10),
|
ModelNumber: fk.Str(10),
|
||||||
Manufacturer: fk.Str(10),
|
Manufacturer: fk.Str(10),
|
||||||
PurchaseTime: types.DateFromTime(time.Now()),
|
PurchaseTime: types.DateFromTime(time.Now()),
|
||||||
|
PurchaseMethod: fk.Str(10),
|
||||||
PurchaseFrom: fk.Str(10),
|
PurchaseFrom: fk.Str(10),
|
||||||
PurchasePrice: 300.99,
|
PurchasePrice: 300.99,
|
||||||
SoldTime: types.DateFromTime(time.Now()),
|
SoldTime: types.DateFromTime(time.Now()),
|
||||||
@@ -262,6 +263,7 @@ func TestItemsRepository_Update(t *testing.T) {
|
|||||||
assert.Equal(t, updateData.Manufacturer, got.Manufacturer)
|
assert.Equal(t, updateData.Manufacturer, got.Manufacturer)
|
||||||
// assert.Equal(t, updateData.PurchaseTime, got.PurchaseTime)
|
// assert.Equal(t, updateData.PurchaseTime, got.PurchaseTime)
|
||||||
assert.Equal(t, updateData.PurchaseFrom, got.PurchaseFrom)
|
assert.Equal(t, updateData.PurchaseFrom, got.PurchaseFrom)
|
||||||
|
assert.Equal(t, updateData.PurchaseMethod, got.PurchaseMethod)
|
||||||
assert.InDelta(t, updateData.PurchasePrice, got.PurchasePrice, 0.01)
|
assert.InDelta(t, updateData.PurchasePrice, got.PurchasePrice, 0.01)
|
||||||
// assert.Equal(t, updateData.SoldTime, got.SoldTime)
|
// assert.Equal(t, updateData.SoldTime, got.SoldTime)
|
||||||
assert.Equal(t, updateData.SoldTo, got.SoldTo)
|
assert.Equal(t, updateData.SoldTo, got.SoldTo)
|
||||||
|
|||||||
@@ -2140,6 +2140,9 @@
|
|||||||
"x-nullable": true,
|
"x-nullable": true,
|
||||||
"x-omitempty": true
|
"x-omitempty": true
|
||||||
},
|
},
|
||||||
|
"purchaseMethod": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"purchaseFrom": {
|
"purchaseFrom": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ Specifying import refs also allows you to update existing items via the CSV impo
|
|||||||
| HB.model_number | String | Model of the item |
|
| HB.model_number | String | Model of the item |
|
||||||
| HB.manufacturer | String | Manufacturer of the item |
|
| HB.manufacturer | String | Manufacturer of the item |
|
||||||
| HB.notes | String (1000) | General notes about the product |
|
| HB.notes | String (1000) | General notes about the product |
|
||||||
|
| HB.purchase_method | String | Method of how the item was purchased |
|
||||||
| HB.purchase_from | String | Name of the place the item was purchased from |
|
| HB.purchase_from | String | Name of the place the item was purchased from |
|
||||||
| HB.purchase_price | Float64 | |
|
| HB.purchase_price | Float64 | |
|
||||||
| HB.purchase_time | Date | Date the item was purchased |
|
| HB.purchase_time | Date | Date the item was purchased |
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ type ImportObj = {
|
|||||||
[`HB.manufacturer`]: string;
|
[`HB.manufacturer`]: string;
|
||||||
[`HB.notes`]: string;
|
[`HB.notes`]: string;
|
||||||
[`HB.purchase_price`]: number;
|
[`HB.purchase_price`]: number;
|
||||||
|
[`HB.purchase_method`]: string;
|
||||||
[`HB.purchase_from`]: string;
|
[`HB.purchase_from`]: string;
|
||||||
[`HB.purchase_time`]: string;
|
[`HB.purchase_time`]: string;
|
||||||
[`HB.lifetime_warranty`]: boolean;
|
[`HB.lifetime_warranty`]: boolean;
|
||||||
@@ -62,6 +63,7 @@ function importFileGenerator(entries: number): ImportObj[] {
|
|||||||
[`HB.manufacturer`]: faker.string.alphanumeric(5),
|
[`HB.manufacturer`]: faker.string.alphanumeric(5),
|
||||||
[`HB.notes`]: "",
|
[`HB.notes`]: "",
|
||||||
[`HB.purchase_from`]: faker.person.fullName(),
|
[`HB.purchase_from`]: faker.person.fullName(),
|
||||||
|
[`HB.purchase_method`]: faker.string.alphanumeric(5),
|
||||||
[`HB.purchase_price`]: faker.number.int(100),
|
[`HB.purchase_price`]: faker.number.int(100),
|
||||||
[`HB.purchase_time`]: faker.date.past().toDateString(),
|
[`HB.purchase_time`]: faker.date.past().toDateString(),
|
||||||
[`HB.lifetime_warranty`]: half > i,
|
[`HB.lifetime_warranty`]: half > i,
|
||||||
|
|||||||
12218
frontend/pnpm-lock.yaml
generated
12218
frontend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user