mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 21:33:02 +01:00
Compare commits
4 Commits
v0.14.1
...
katos/purc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
809b0db5e5 | ||
|
|
ae8f568bfa | ||
|
|
87725348be | ||
|
|
da78f13513 |
@@ -2145,6 +2145,9 @@
|
||||
"purchaseFrom": {
|
||||
"type": "string"
|
||||
},
|
||||
"purchaseFrom": {
|
||||
"type": "string"
|
||||
},
|
||||
"purchasePrice": {
|
||||
"type": "string",
|
||||
"example": "0"
|
||||
|
||||
@@ -170,6 +170,8 @@ definitions:
|
||||
x-omitempty: true
|
||||
purchaseFrom:
|
||||
type: string
|
||||
purchaseMethod:
|
||||
type: string
|
||||
purchasePrice:
|
||||
example: "0"
|
||||
type: string
|
||||
|
||||
@@ -203,6 +203,7 @@ func (s *IOSheet) ReadItems(ctx context.Context, items []repo.ItemOut, GID uuid.
|
||||
Archived: item.Archived,
|
||||
|
||||
PurchasePrice: item.PurchasePrice,
|
||||
PurchaseMethod: item.PurchaseMethod,
|
||||
PurchaseFrom: item.PurchaseFrom,
|
||||
PurchaseTime: item.PurchaseTime,
|
||||
|
||||
|
||||
@@ -298,6 +298,7 @@ func (svc *ItemService) CsvImport(ctx context.Context, GID uuid.UUID, data io.Re
|
||||
Archived: row.Archived,
|
||||
|
||||
PurchasePrice: row.PurchasePrice,
|
||||
PurchaseFrom: row.PurchaseMethod,
|
||||
PurchaseFrom: row.PurchaseFrom,
|
||||
PurchaseTime: row.PurchaseTime,
|
||||
|
||||
|
||||
@@ -76,6 +76,8 @@ func (Item) Fields() []ent.Field {
|
||||
|
||||
// ------------------------------------
|
||||
// item purchase
|
||||
field.String("purchase_method").
|
||||
Optional(),
|
||||
field.Time("purchase_time").
|
||||
Optional(),
|
||||
field.String("purchase_from").
|
||||
|
||||
@@ -17,7 +17,7 @@ CREATE INDEX `documenttoken_token` ON `document_tokens` (`token`);
|
||||
-- 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 "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` ON `items` (`name`);
|
||||
-- create index "item_manufacturer" to table: "items"
|
||||
|
||||
@@ -91,6 +91,7 @@ type (
|
||||
WarrantyDetails string `json:"warrantyDetails"`
|
||||
|
||||
// Purchase
|
||||
PurchaseMethod string `json:"purchaseMethod"`
|
||||
PurchaseTime types.Date `json:"purchaseTime"`
|
||||
PurchaseFrom string `json:"purchaseFrom"`
|
||||
PurchasePrice float64 `json:"purchasePrice,string"`
|
||||
@@ -147,6 +148,7 @@ type (
|
||||
WarrantyDetails string `json:"warrantyDetails"`
|
||||
|
||||
// Purchase
|
||||
PurchaseMethod string `json:"purchaseMethod"`
|
||||
PurchaseTime types.Date `json:"purchaseTime"`
|
||||
PurchaseFrom string `json:"purchaseFrom"`
|
||||
|
||||
|
||||
@@ -236,6 +236,7 @@ func TestItemsRepository_Update(t *testing.T) {
|
||||
ModelNumber: fk.Str(10),
|
||||
Manufacturer: fk.Str(10),
|
||||
PurchaseTime: types.DateFromTime(time.Now()),
|
||||
PurchaseMethod: fk.Str(10),
|
||||
PurchaseFrom: fk.Str(10),
|
||||
PurchasePrice: 300.99,
|
||||
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.PurchaseTime, got.PurchaseTime)
|
||||
assert.Equal(t, updateData.PurchaseFrom, got.PurchaseFrom)
|
||||
assert.Equal(t, updateData.PurchaseMethod, got.PurchaseMethod)
|
||||
assert.InDelta(t, updateData.PurchasePrice, got.PurchasePrice, 0.01)
|
||||
// assert.Equal(t, updateData.SoldTime, got.SoldTime)
|
||||
assert.Equal(t, updateData.SoldTo, got.SoldTo)
|
||||
|
||||
@@ -2140,6 +2140,9 @@
|
||||
"x-nullable": true,
|
||||
"x-omitempty": true
|
||||
},
|
||||
"purchaseMethod": {
|
||||
"type": "string"
|
||||
},
|
||||
"purchaseFrom": {
|
||||
"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.manufacturer | String | Manufacturer of the item |
|
||||
| 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_price | Float64 | |
|
||||
| HB.purchase_time | Date | Date the item was purchased |
|
||||
|
||||
@@ -16,6 +16,7 @@ type ImportObj = {
|
||||
[`HB.manufacturer`]: string;
|
||||
[`HB.notes`]: string;
|
||||
[`HB.purchase_price`]: number;
|
||||
[`HB.purchase_method`]: string;
|
||||
[`HB.purchase_from`]: string;
|
||||
[`HB.purchase_time`]: string;
|
||||
[`HB.lifetime_warranty`]: boolean;
|
||||
@@ -62,6 +63,7 @@ function importFileGenerator(entries: number): ImportObj[] {
|
||||
[`HB.manufacturer`]: faker.string.alphanumeric(5),
|
||||
[`HB.notes`]: "",
|
||||
[`HB.purchase_from`]: faker.person.fullName(),
|
||||
[`HB.purchase_method`]: faker.string.alphanumeric(5),
|
||||
[`HB.purchase_price`]: faker.number.int(100),
|
||||
[`HB.purchase_time`]: faker.date.past().toDateString(),
|
||||
[`HB.lifetime_warranty`]: half > i,
|
||||
|
||||
11968
frontend/pnpm-lock.yaml
generated
11968
frontend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user