mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-29 18:16:35 +00:00
chore: rewrite generator to resolve strange name generation (#612)
* rewrite generator to resolve strange name generation * fix asset id types * ignore errored types * remove depreciated calls * use more random words * random user
This commit is contained in:
parent
b08e52104c
commit
4738a9b131
18 changed files with 139 additions and 1183 deletions
41
Taskfile.yml
41
Taskfile.yml
|
@ -12,15 +12,25 @@ tasks:
|
|||
- cd backend && go mod tidy
|
||||
- cd frontend && pnpm install --shamefully-hoist
|
||||
|
||||
generate:
|
||||
desc: |
|
||||
Generates collateral files from the backend project
|
||||
including swagger docs and typescripts type for the frontend
|
||||
deps:
|
||||
- db:generate
|
||||
swag:
|
||||
desc: Generate swagger docs
|
||||
dir: backend/app/api/static/
|
||||
vars:
|
||||
API: "../"
|
||||
INTERNAL: "../../../internal"
|
||||
PKGS: "../../../pkgs"
|
||||
cmds:
|
||||
- swag fmt --dir={{ .API }}
|
||||
- swag init --dir={{ .API }},{{ .INTERNAL }}/core/services,{{ .INTERNAL }}/data/repo --parseDependency
|
||||
sources:
|
||||
- "./backend/app/api/**/*"
|
||||
- "./backend/internal/data/**"
|
||||
- "./backend/internal/core/services/**/*"
|
||||
- "./backend/app/tools/typegen/main.go"
|
||||
|
||||
typescript-types:
|
||||
desc: Generates typescript types from swagger definition
|
||||
cmds:
|
||||
- cd backend/app/api/static && swag fmt --dir=../
|
||||
- cd backend/app/api/static && swag init --dir=../,../../../internal,../../../pkgs
|
||||
- |
|
||||
npx swagger-typescript-api \
|
||||
--no-client \
|
||||
|
@ -28,12 +38,17 @@ tasks:
|
|||
--path ./backend/app/api/static/docs/swagger.json \
|
||||
--output ./frontend/lib/api/types
|
||||
- go run ./backend/app/tools/typegen/main.go ./frontend/lib/api/types/data-contracts.ts
|
||||
- cp ./backend/app/api/static/docs/swagger.json docs/docs/api/openapi-2.0.json
|
||||
sources:
|
||||
- "./backend/app/api/**/*"
|
||||
- "./backend/internal/data/**"
|
||||
- "./backend/internal/core/services/**/*"
|
||||
- "./backend/app/tools/typegen/main.go"
|
||||
- ./backend/app/tools/typegen/main.go
|
||||
- ./backend/app/api/static/docs/swagger.json
|
||||
|
||||
generate:
|
||||
deps:
|
||||
- db:generate
|
||||
cmds:
|
||||
- task: swag
|
||||
- task: typescript-types
|
||||
- cp ./backend/app/api/static/docs/swagger.json docs/docs/api/openapi-2.0.json
|
||||
|
||||
go:run:
|
||||
desc: Starts the backend api server (depends on generate task)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// Package docs GENERATED BY SWAG; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag
|
||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
|
@ -2038,9 +2037,13 @@ const docTemplate = `{
|
|||
},
|
||||
"location": {
|
||||
"description": "Edges",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
}
|
||||
],
|
||||
"x-nullable": true,
|
||||
"x-omitempty": true,
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
"x-omitempty": true
|
||||
},
|
||||
"manufacturer": {
|
||||
"type": "string"
|
||||
|
@ -2056,9 +2059,13 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"parent": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/repo.ItemSummary"
|
||||
}
|
||||
],
|
||||
"x-nullable": true,
|
||||
"x-omitempty": true,
|
||||
"$ref": "#/definitions/repo.ItemSummary"
|
||||
"x-omitempty": true
|
||||
},
|
||||
"purchaseFrom": {
|
||||
"type": "string"
|
||||
|
@ -2144,9 +2151,13 @@ const docTemplate = `{
|
|||
},
|
||||
"location": {
|
||||
"description": "Edges",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
}
|
||||
],
|
||||
"x-nullable": true,
|
||||
"x-omitempty": true,
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
"x-omitempty": true
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
|
@ -2170,7 +2181,8 @@ const docTemplate = `{
|
|||
"type": "boolean"
|
||||
},
|
||||
"assetId": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"example": "0"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
|
@ -2255,7 +2267,6 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"warrantyExpires": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -2429,7 +2440,6 @@ const docTemplate = `{
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"completedDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
},
|
||||
"cost": {
|
||||
|
@ -2446,7 +2456,6 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"scheduledDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -2458,7 +2467,6 @@ const docTemplate = `{
|
|||
],
|
||||
"properties": {
|
||||
"completedDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
},
|
||||
"cost": {
|
||||
|
@ -2472,7 +2480,6 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"scheduledDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -2481,7 +2488,6 @@ const docTemplate = `{
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"completedDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
},
|
||||
"cost": {
|
||||
|
@ -2495,7 +2501,6 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"scheduledDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -2897,6 +2902,8 @@ var SwaggerInfo = &swag.Spec{
|
|||
Description: "Track, Manage, and Organize your Things.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -2030,9 +2030,13 @@
|
|||
},
|
||||
"location": {
|
||||
"description": "Edges",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
}
|
||||
],
|
||||
"x-nullable": true,
|
||||
"x-omitempty": true,
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
"x-omitempty": true
|
||||
},
|
||||
"manufacturer": {
|
||||
"type": "string"
|
||||
|
@ -2048,9 +2052,13 @@
|
|||
"type": "string"
|
||||
},
|
||||
"parent": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/repo.ItemSummary"
|
||||
}
|
||||
],
|
||||
"x-nullable": true,
|
||||
"x-omitempty": true,
|
||||
"$ref": "#/definitions/repo.ItemSummary"
|
||||
"x-omitempty": true
|
||||
},
|
||||
"purchaseFrom": {
|
||||
"type": "string"
|
||||
|
@ -2136,9 +2144,13 @@
|
|||
},
|
||||
"location": {
|
||||
"description": "Edges",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
}
|
||||
],
|
||||
"x-nullable": true,
|
||||
"x-omitempty": true,
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
"x-omitempty": true
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
|
@ -2162,7 +2174,8 @@
|
|||
"type": "boolean"
|
||||
},
|
||||
"assetId": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"example": "0"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
|
@ -2247,7 +2260,6 @@
|
|||
"type": "string"
|
||||
},
|
||||
"warrantyExpires": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -2421,7 +2433,6 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"completedDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
},
|
||||
"cost": {
|
||||
|
@ -2438,7 +2449,6 @@
|
|||
"type": "string"
|
||||
},
|
||||
"scheduledDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -2450,7 +2460,6 @@
|
|||
],
|
||||
"properties": {
|
||||
"completedDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
},
|
||||
"cost": {
|
||||
|
@ -2464,7 +2473,6 @@
|
|||
"type": "string"
|
||||
},
|
||||
"scheduledDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -2473,7 +2481,6 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"completedDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
},
|
||||
"cost": {
|
||||
|
@ -2487,7 +2494,6 @@
|
|||
"type": "string"
|
||||
},
|
||||
"scheduledDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,8 @@ definitions:
|
|||
description: Warranty
|
||||
type: boolean
|
||||
location:
|
||||
$ref: '#/definitions/repo.LocationSummary'
|
||||
allOf:
|
||||
- $ref: '#/definitions/repo.LocationSummary'
|
||||
description: Edges
|
||||
x-nullable: true
|
||||
x-omitempty: true
|
||||
|
@ -156,7 +157,8 @@ definitions:
|
|||
description: Extras
|
||||
type: string
|
||||
parent:
|
||||
$ref: '#/definitions/repo.ItemSummary'
|
||||
allOf:
|
||||
- $ref: '#/definitions/repo.ItemSummary'
|
||||
x-nullable: true
|
||||
x-omitempty: true
|
||||
purchaseFrom:
|
||||
|
@ -216,7 +218,8 @@ definitions:
|
|||
$ref: '#/definitions/repo.LabelSummary'
|
||||
type: array
|
||||
location:
|
||||
$ref: '#/definitions/repo.LocationSummary'
|
||||
allOf:
|
||||
- $ref: '#/definitions/repo.LocationSummary'
|
||||
description: Edges
|
||||
x-nullable: true
|
||||
x-omitempty: true
|
||||
|
@ -235,6 +238,7 @@ definitions:
|
|||
archived:
|
||||
type: boolean
|
||||
assetId:
|
||||
example: "0"
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
|
@ -295,7 +299,6 @@ definitions:
|
|||
warrantyDetails:
|
||||
type: string
|
||||
warrantyExpires:
|
||||
description: Sold
|
||||
type: string
|
||||
type: object
|
||||
repo.LabelCreate:
|
||||
|
@ -410,7 +413,6 @@ definitions:
|
|||
repo.MaintenanceEntry:
|
||||
properties:
|
||||
completedDate:
|
||||
description: Sold
|
||||
type: string
|
||||
cost:
|
||||
example: "0"
|
||||
|
@ -422,13 +424,11 @@ definitions:
|
|||
name:
|
||||
type: string
|
||||
scheduledDate:
|
||||
description: Sold
|
||||
type: string
|
||||
type: object
|
||||
repo.MaintenanceEntryCreate:
|
||||
properties:
|
||||
completedDate:
|
||||
description: Sold
|
||||
type: string
|
||||
cost:
|
||||
example: "0"
|
||||
|
@ -438,7 +438,6 @@ definitions:
|
|||
name:
|
||||
type: string
|
||||
scheduledDate:
|
||||
description: Sold
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
|
@ -446,7 +445,6 @@ definitions:
|
|||
repo.MaintenanceEntryUpdate:
|
||||
properties:
|
||||
completedDate:
|
||||
description: Sold
|
||||
type: string
|
||||
cost:
|
||||
example: "0"
|
||||
|
@ -456,7 +454,6 @@ definitions:
|
|||
name:
|
||||
type: string
|
||||
scheduledDate:
|
||||
description: Sold
|
||||
type: string
|
||||
type: object
|
||||
repo.MaintenanceLog:
|
||||
|
|
|
@ -55,6 +55,7 @@ require (
|
|||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/rogpeppe/go-internal v1.11.0 // indirect
|
||||
github.com/swaggo/files v1.0.1 // indirect
|
||||
github.com/yeqown/reedsolomon v1.0.0 // indirect
|
||||
github.com/zclconf/go-cty v1.13.2 // indirect
|
||||
|
|
1088
backend/go.sum
1088
backend/go.sum
File diff suppressed because it is too large
Load diff
|
@ -67,7 +67,7 @@ type (
|
|||
ItemUpdate struct {
|
||||
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable,x-omitempty"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
AssetID AssetID `json:"assetId"`
|
||||
AssetID AssetID `json:"assetId,string"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Quantity int `json:"quantity"`
|
||||
|
|
|
@ -2030,9 +2030,13 @@
|
|||
},
|
||||
"location": {
|
||||
"description": "Edges",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
}
|
||||
],
|
||||
"x-nullable": true,
|
||||
"x-omitempty": true,
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
"x-omitempty": true
|
||||
},
|
||||
"manufacturer": {
|
||||
"type": "string"
|
||||
|
@ -2048,9 +2052,13 @@
|
|||
"type": "string"
|
||||
},
|
||||
"parent": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/repo.ItemSummary"
|
||||
}
|
||||
],
|
||||
"x-nullable": true,
|
||||
"x-omitempty": true,
|
||||
"$ref": "#/definitions/repo.ItemSummary"
|
||||
"x-omitempty": true
|
||||
},
|
||||
"purchaseFrom": {
|
||||
"type": "string"
|
||||
|
@ -2136,9 +2144,13 @@
|
|||
},
|
||||
"location": {
|
||||
"description": "Edges",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
}
|
||||
],
|
||||
"x-nullable": true,
|
||||
"x-omitempty": true,
|
||||
"$ref": "#/definitions/repo.LocationSummary"
|
||||
"x-omitempty": true
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
|
@ -2162,7 +2174,8 @@
|
|||
"type": "boolean"
|
||||
},
|
||||
"assetId": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"example": "0"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
|
@ -2247,7 +2260,6 @@
|
|||
"type": "string"
|
||||
},
|
||||
"warrantyExpires": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -2421,7 +2433,6 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"completedDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
},
|
||||
"cost": {
|
||||
|
@ -2438,7 +2449,6 @@
|
|||
"type": "string"
|
||||
},
|
||||
"scheduledDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -2450,7 +2460,6 @@
|
|||
],
|
||||
"properties": {
|
||||
"completedDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
},
|
||||
"cost": {
|
||||
|
@ -2464,7 +2473,6 @@
|
|||
"type": "string"
|
||||
},
|
||||
"scheduledDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -2473,7 +2481,6 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"completedDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
},
|
||||
"cost": {
|
||||
|
@ -2487,7 +2494,6 @@
|
|||
"type": "string"
|
||||
},
|
||||
"scheduledDate": {
|
||||
"description": "Sold",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
get() {
|
||||
return state.value[nodeHash.value] ?? false;
|
||||
},
|
||||
set(value) {
|
||||
set(value: boolean) {
|
||||
state.value[nodeHash.value] = value;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ function itemField(id = null): ItemField {
|
|||
type: "text",
|
||||
textValue: faker.lorem.sentence(),
|
||||
booleanValue: false,
|
||||
numberValue: faker.datatype.number(),
|
||||
numberValue: faker.number.int(),
|
||||
timeValue: "",
|
||||
};
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ function user(): UserRegistration {
|
|||
return {
|
||||
email: faker.internet.email(),
|
||||
password: faker.internet.password(),
|
||||
name: faker.name.firstName(),
|
||||
name: faker.person.firstName(),
|
||||
token: "",
|
||||
};
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ function user(): UserRegistration {
|
|||
function location(parentId: string | null = null): LocationCreate {
|
||||
return {
|
||||
parentId,
|
||||
name: faker.address.city(),
|
||||
name: faker.location.city(),
|
||||
description: faker.lorem.sentence(),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { beforeAll, expect } from "vitest";
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { UserClient } from "../user";
|
||||
import { factories } from "./factories";
|
||||
|
||||
|
@ -15,9 +16,9 @@ export async function sharedUserClient(): Promise<UserClient> {
|
|||
return factories.client.user(cache.token);
|
||||
}
|
||||
const testUser = {
|
||||
email: "__test__@__test__.com",
|
||||
name: "__test__",
|
||||
password: "__test__",
|
||||
email: faker.internet.email(),
|
||||
name: faker.person.fullName(),
|
||||
password: faker.internet.password(),
|
||||
token: "",
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ describe("first time user workflow (register, login, join group)", () => {
|
|||
test("user should be able to update group", async () => {
|
||||
const { client } = await factories.client.singleUse();
|
||||
|
||||
const name = faker.name.firstName();
|
||||
const name = faker.person.firstName();
|
||||
|
||||
const { response, data: group } = await client.group.update({
|
||||
name,
|
||||
|
@ -34,7 +34,7 @@ describe("first time user workflow (register, login, join group)", () => {
|
|||
|
||||
for (const currency of currencies) {
|
||||
const { response, data: group } = await client.group.update({
|
||||
name: faker.name.firstName(),
|
||||
name: faker.person.firstName(),
|
||||
currency: currency.code,
|
||||
});
|
||||
|
||||
|
|
|
@ -135,9 +135,9 @@ describe("user should be able to create an item and add an attachment", () => {
|
|||
const { response, data } = await api.items.maintenance.create(item.id, {
|
||||
name: faker.vehicle.model(),
|
||||
description: faker.lorem.paragraph(1),
|
||||
completedDate: faker.date.past(1),
|
||||
completedDate: faker.date.past(),
|
||||
scheduledDate: "null",
|
||||
cost: faker.datatype.number(100).toString(),
|
||||
cost: faker.number.int(100).toString(),
|
||||
});
|
||||
|
||||
expect(response.status).toBe(201);
|
||||
|
|
|
@ -8,8 +8,8 @@ describe("basic notifier workflows", () => {
|
|||
|
||||
// Create Notifier
|
||||
const result = await client.notifiers.create({
|
||||
name: faker.name.firstName(),
|
||||
url: "discord://" + faker.random.alphaNumeric(10),
|
||||
name: faker.word.words(2),
|
||||
url: "discord://" + faker.string.alphanumeric(10),
|
||||
isActive: true,
|
||||
});
|
||||
|
||||
|
@ -22,8 +22,8 @@ describe("basic notifier workflows", () => {
|
|||
// Update Notifier with new URL
|
||||
{
|
||||
const updateData = {
|
||||
name: faker.name.firstName(),
|
||||
url: "discord://" + faker.random.alphaNumeric(10),
|
||||
name: faker.word.words(2),
|
||||
url: "discord://" + faker.string.alphanumeric(10),
|
||||
isActive: true,
|
||||
};
|
||||
|
||||
|
@ -37,7 +37,7 @@ describe("basic notifier workflows", () => {
|
|||
// Update Notifier with empty URL
|
||||
{
|
||||
const updateData = {
|
||||
name: faker.name.firstName(),
|
||||
name: faker.word.words(2),
|
||||
url: null,
|
||||
isActive: true,
|
||||
};
|
||||
|
|
|
@ -40,8 +40,8 @@ function importFileGenerator(entries: number): ImportObj[] {
|
|||
|
||||
const pick = (arr: string[]) => arr[Math.floor(Math.random() * arr.length)];
|
||||
|
||||
const labels = faker.random.words(5).split(" ").join(";");
|
||||
const locations = faker.random.words(3).split(" ");
|
||||
const labels = faker.word.words(5).split(" ").join(";");
|
||||
const locations = faker.word.words(3).split(" ");
|
||||
|
||||
const half = Math.floor(entries / 2);
|
||||
|
||||
|
@ -53,21 +53,21 @@ function importFileGenerator(entries: number): ImportObj[] {
|
|||
[`HB.import_ref`]: faker.database.mongodbObjectId(),
|
||||
[`HB.location`]: pick(locations),
|
||||
[`HB.labels`]: labels,
|
||||
[`HB.quantity`]: Number(faker.random.numeric(2)),
|
||||
[`HB.name`]: faker.random.words(3),
|
||||
[`HB.quantity`]: Number(faker.number.int(2)),
|
||||
[`HB.name`]: faker.word.words(3),
|
||||
[`HB.description`]: "",
|
||||
[`HB.insured`]: faker.datatype.boolean(),
|
||||
[`HB.serial_number`]: faker.random.alphaNumeric(5),
|
||||
[`HB.model_number`]: faker.random.alphaNumeric(5),
|
||||
[`HB.manufacturer`]: faker.random.alphaNumeric(5),
|
||||
[`HB.serial_number`]: faker.string.alphanumeric(5),
|
||||
[`HB.model_number`]: faker.string.alphanumeric(5),
|
||||
[`HB.manufacturer`]: faker.string.alphanumeric(5),
|
||||
[`HB.notes`]: "",
|
||||
[`HB.purchase_from`]: faker.name.fullName(),
|
||||
[`HB.purchase_price`]: faker.datatype.number(100),
|
||||
[`HB.purchase_from`]: faker.person.fullName(),
|
||||
[`HB.purchase_price`]: faker.number.int(100),
|
||||
[`HB.purchase_time`]: faker.date.past().toDateString(),
|
||||
[`HB.lifetime_warranty`]: half > i,
|
||||
[`HB.warranty_details`]: "",
|
||||
[`HB.sold_to`]: faker.name.fullName(),
|
||||
[`HB.sold_price`]: faker.datatype.number(100),
|
||||
[`HB.sold_to`]: faker.person.fullName(),
|
||||
[`HB.sold_price`]: faker.number.int(100),
|
||||
[`HB.sold_time`]: formatDate(faker.date.past()),
|
||||
[`HB.sold_notes`]: "",
|
||||
});
|
||||
|
|
|
@ -141,6 +141,7 @@ export interface ItemSummary {
|
|||
|
||||
export interface ItemUpdate {
|
||||
archived: boolean;
|
||||
/** @example "0" */
|
||||
assetId: string;
|
||||
description: string;
|
||||
fields: ItemField[];
|
||||
|
@ -172,7 +173,6 @@ export interface ItemUpdate {
|
|||
soldTime: Date | string;
|
||||
soldTo: string;
|
||||
warrantyDetails: string;
|
||||
/** Sold */
|
||||
warrantyExpires: Date | string;
|
||||
}
|
||||
|
||||
|
@ -244,36 +244,30 @@ export interface LocationUpdate {
|
|||
}
|
||||
|
||||
export interface MaintenanceEntry {
|
||||
/** Sold */
|
||||
completedDate: Date | string;
|
||||
/** @example "0" */
|
||||
cost: string;
|
||||
description: string;
|
||||
id: string;
|
||||
name: string;
|
||||
/** Sold */
|
||||
scheduledDate: Date | string;
|
||||
}
|
||||
|
||||
export interface MaintenanceEntryCreate {
|
||||
/** Sold */
|
||||
completedDate: Date | string;
|
||||
/** @example "0" */
|
||||
cost: string;
|
||||
description: string;
|
||||
name: string;
|
||||
/** Sold */
|
||||
scheduledDate: Date | string;
|
||||
}
|
||||
|
||||
export interface MaintenanceEntryUpdate {
|
||||
/** Sold */
|
||||
completedDate: Date | string;
|
||||
/** @example "0" */
|
||||
cost: string;
|
||||
description: string;
|
||||
name: string;
|
||||
/** Sold */
|
||||
scheduledDate: Date | string;
|
||||
}
|
||||
|
||||
|
|
|
@ -366,11 +366,13 @@
|
|||
});
|
||||
|
||||
function openDialog(img: Photo) {
|
||||
// @ts-ignore - I don't know why this is happening
|
||||
refDialog.value?.showModal();
|
||||
dialoged.src = img.src;
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
// @ts-ignore - I don't know why this is happening
|
||||
refDialog.value?.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
locationId: item.value.location?.id,
|
||||
labelIds: item.value.labels.map(l => l.id),
|
||||
parentId: parent.value ? parent.value.id : null,
|
||||
assetId: item.value.assetId,
|
||||
};
|
||||
|
||||
const { error } = await api.items.update(itemId.value, payload);
|
||||
|
|
Loading…
Reference in a new issue