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

Former-commit-id: 4738a9b131
This commit is contained in:
Hayden 2023-11-15 20:19:51 -06:00 committed by GitHub
parent f74736b369
commit 742ece7923
18 changed files with 139 additions and 1183 deletions

View file

@ -12,15 +12,25 @@ tasks:
- cd backend && go mod tidy - cd backend && go mod tidy
- cd frontend && pnpm install --shamefully-hoist - cd frontend && pnpm install --shamefully-hoist
generate: swag:
desc: | desc: Generate swagger docs
Generates collateral files from the backend project dir: backend/app/api/static/
including swagger docs and typescripts type for the frontend vars:
deps: API: "../"
- db:generate 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: cmds:
- cd backend/app/api/static && swag fmt --dir=../
- cd backend/app/api/static && swag init --dir=../,../../../internal,../../../pkgs
- | - |
npx swagger-typescript-api \ npx swagger-typescript-api \
--no-client \ --no-client \
@ -28,12 +38,17 @@ tasks:
--path ./backend/app/api/static/docs/swagger.json \ --path ./backend/app/api/static/docs/swagger.json \
--output ./frontend/lib/api/types --output ./frontend/lib/api/types
- go run ./backend/app/tools/typegen/main.go ./frontend/lib/api/types/data-contracts.ts - 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: sources:
- "./backend/app/api/**/*" - ./backend/app/tools/typegen/main.go
- "./backend/internal/data/**" - ./backend/app/api/static/docs/swagger.json
- "./backend/internal/core/services/**/*"
- "./backend/app/tools/typegen/main.go" 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: go:run:
desc: Starts the backend api server (depends on generate task) desc: Starts the backend api server (depends on generate task)

View file

@ -1,5 +1,4 @@
// Package docs GENERATED BY SWAG; DO NOT EDIT // Package docs Code generated by swaggo/swag. DO NOT EDIT
// This file was generated by swaggo/swag
package docs package docs
import "github.com/swaggo/swag" import "github.com/swaggo/swag"
@ -2038,9 +2037,13 @@ const docTemplate = `{
}, },
"location": { "location": {
"description": "Edges", "description": "Edges",
"x-nullable": true, "allOf": [
"x-omitempty": true, {
"$ref": "#/definitions/repo.LocationSummary" "$ref": "#/definitions/repo.LocationSummary"
}
],
"x-nullable": true,
"x-omitempty": true
}, },
"manufacturer": { "manufacturer": {
"type": "string" "type": "string"
@ -2056,9 +2059,13 @@ const docTemplate = `{
"type": "string" "type": "string"
}, },
"parent": { "parent": {
"x-nullable": true, "allOf": [
"x-omitempty": true, {
"$ref": "#/definitions/repo.ItemSummary" "$ref": "#/definitions/repo.ItemSummary"
}
],
"x-nullable": true,
"x-omitempty": true
}, },
"purchaseFrom": { "purchaseFrom": {
"type": "string" "type": "string"
@ -2144,9 +2151,13 @@ const docTemplate = `{
}, },
"location": { "location": {
"description": "Edges", "description": "Edges",
"x-nullable": true, "allOf": [
"x-omitempty": true, {
"$ref": "#/definitions/repo.LocationSummary" "$ref": "#/definitions/repo.LocationSummary"
}
],
"x-nullable": true,
"x-omitempty": true
}, },
"name": { "name": {
"type": "string" "type": "string"
@ -2170,7 +2181,8 @@ const docTemplate = `{
"type": "boolean" "type": "boolean"
}, },
"assetId": { "assetId": {
"type": "string" "type": "string",
"example": "0"
}, },
"description": { "description": {
"type": "string" "type": "string"
@ -2255,7 +2267,6 @@ const docTemplate = `{
"type": "string" "type": "string"
}, },
"warrantyExpires": { "warrantyExpires": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }
@ -2429,7 +2440,6 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"completedDate": { "completedDate": {
"description": "Sold",
"type": "string" "type": "string"
}, },
"cost": { "cost": {
@ -2446,7 +2456,6 @@ const docTemplate = `{
"type": "string" "type": "string"
}, },
"scheduledDate": { "scheduledDate": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }
@ -2458,7 +2467,6 @@ const docTemplate = `{
], ],
"properties": { "properties": {
"completedDate": { "completedDate": {
"description": "Sold",
"type": "string" "type": "string"
}, },
"cost": { "cost": {
@ -2472,7 +2480,6 @@ const docTemplate = `{
"type": "string" "type": "string"
}, },
"scheduledDate": { "scheduledDate": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }
@ -2481,7 +2488,6 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"completedDate": { "completedDate": {
"description": "Sold",
"type": "string" "type": "string"
}, },
"cost": { "cost": {
@ -2495,7 +2501,6 @@ const docTemplate = `{
"type": "string" "type": "string"
}, },
"scheduledDate": { "scheduledDate": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }
@ -2897,6 +2902,8 @@ var SwaggerInfo = &swag.Spec{
Description: "Track, Manage, and Organize your Things.", Description: "Track, Manage, and Organize your Things.",
InfoInstanceName: "swagger", InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate, SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
} }
func init() { func init() {

View file

@ -2030,9 +2030,13 @@
}, },
"location": { "location": {
"description": "Edges", "description": "Edges",
"x-nullable": true, "allOf": [
"x-omitempty": true, {
"$ref": "#/definitions/repo.LocationSummary" "$ref": "#/definitions/repo.LocationSummary"
}
],
"x-nullable": true,
"x-omitempty": true
}, },
"manufacturer": { "manufacturer": {
"type": "string" "type": "string"
@ -2048,9 +2052,13 @@
"type": "string" "type": "string"
}, },
"parent": { "parent": {
"x-nullable": true, "allOf": [
"x-omitempty": true, {
"$ref": "#/definitions/repo.ItemSummary" "$ref": "#/definitions/repo.ItemSummary"
}
],
"x-nullable": true,
"x-omitempty": true
}, },
"purchaseFrom": { "purchaseFrom": {
"type": "string" "type": "string"
@ -2136,9 +2144,13 @@
}, },
"location": { "location": {
"description": "Edges", "description": "Edges",
"x-nullable": true, "allOf": [
"x-omitempty": true, {
"$ref": "#/definitions/repo.LocationSummary" "$ref": "#/definitions/repo.LocationSummary"
}
],
"x-nullable": true,
"x-omitempty": true
}, },
"name": { "name": {
"type": "string" "type": "string"
@ -2162,7 +2174,8 @@
"type": "boolean" "type": "boolean"
}, },
"assetId": { "assetId": {
"type": "string" "type": "string",
"example": "0"
}, },
"description": { "description": {
"type": "string" "type": "string"
@ -2247,7 +2260,6 @@
"type": "string" "type": "string"
}, },
"warrantyExpires": { "warrantyExpires": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }
@ -2421,7 +2433,6 @@
"type": "object", "type": "object",
"properties": { "properties": {
"completedDate": { "completedDate": {
"description": "Sold",
"type": "string" "type": "string"
}, },
"cost": { "cost": {
@ -2438,7 +2449,6 @@
"type": "string" "type": "string"
}, },
"scheduledDate": { "scheduledDate": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }
@ -2450,7 +2460,6 @@
], ],
"properties": { "properties": {
"completedDate": { "completedDate": {
"description": "Sold",
"type": "string" "type": "string"
}, },
"cost": { "cost": {
@ -2464,7 +2473,6 @@
"type": "string" "type": "string"
}, },
"scheduledDate": { "scheduledDate": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }
@ -2473,7 +2481,6 @@
"type": "object", "type": "object",
"properties": { "properties": {
"completedDate": { "completedDate": {
"description": "Sold",
"type": "string" "type": "string"
}, },
"cost": { "cost": {
@ -2487,7 +2494,6 @@
"type": "string" "type": "string"
}, },
"scheduledDate": { "scheduledDate": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }

View file

@ -142,7 +142,8 @@ definitions:
description: Warranty description: Warranty
type: boolean type: boolean
location: location:
$ref: '#/definitions/repo.LocationSummary' allOf:
- $ref: '#/definitions/repo.LocationSummary'
description: Edges description: Edges
x-nullable: true x-nullable: true
x-omitempty: true x-omitempty: true
@ -156,7 +157,8 @@ definitions:
description: Extras description: Extras
type: string type: string
parent: parent:
$ref: '#/definitions/repo.ItemSummary' allOf:
- $ref: '#/definitions/repo.ItemSummary'
x-nullable: true x-nullable: true
x-omitempty: true x-omitempty: true
purchaseFrom: purchaseFrom:
@ -216,7 +218,8 @@ definitions:
$ref: '#/definitions/repo.LabelSummary' $ref: '#/definitions/repo.LabelSummary'
type: array type: array
location: location:
$ref: '#/definitions/repo.LocationSummary' allOf:
- $ref: '#/definitions/repo.LocationSummary'
description: Edges description: Edges
x-nullable: true x-nullable: true
x-omitempty: true x-omitempty: true
@ -235,6 +238,7 @@ definitions:
archived: archived:
type: boolean type: boolean
assetId: assetId:
example: "0"
type: string type: string
description: description:
type: string type: string
@ -295,7 +299,6 @@ definitions:
warrantyDetails: warrantyDetails:
type: string type: string
warrantyExpires: warrantyExpires:
description: Sold
type: string type: string
type: object type: object
repo.LabelCreate: repo.LabelCreate:
@ -410,7 +413,6 @@ definitions:
repo.MaintenanceEntry: repo.MaintenanceEntry:
properties: properties:
completedDate: completedDate:
description: Sold
type: string type: string
cost: cost:
example: "0" example: "0"
@ -422,13 +424,11 @@ definitions:
name: name:
type: string type: string
scheduledDate: scheduledDate:
description: Sold
type: string type: string
type: object type: object
repo.MaintenanceEntryCreate: repo.MaintenanceEntryCreate:
properties: properties:
completedDate: completedDate:
description: Sold
type: string type: string
cost: cost:
example: "0" example: "0"
@ -438,7 +438,6 @@ definitions:
name: name:
type: string type: string
scheduledDate: scheduledDate:
description: Sold
type: string type: string
required: required:
- name - name
@ -446,7 +445,6 @@ definitions:
repo.MaintenanceEntryUpdate: repo.MaintenanceEntryUpdate:
properties: properties:
completedDate: completedDate:
description: Sold
type: string type: string
cost: cost:
example: "0" example: "0"
@ -456,7 +454,6 @@ definitions:
name: name:
type: string type: string
scheduledDate: scheduledDate:
description: Sold
type: string type: string
type: object type: object
repo.MaintenanceLog: repo.MaintenanceLog:

View file

@ -55,6 +55,7 @@ require (
github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // 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/swaggo/files v1.0.1 // indirect
github.com/yeqown/reedsolomon v1.0.0 // indirect github.com/yeqown/reedsolomon v1.0.0 // indirect
github.com/zclconf/go-cty v1.13.2 // indirect github.com/zclconf/go-cty v1.13.2 // indirect

File diff suppressed because it is too large Load diff

View file

@ -67,7 +67,7 @@ type (
ItemUpdate struct { 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"` ID uuid.UUID `json:"id"`
AssetID AssetID `json:"assetId"` AssetID AssetID `json:"assetId,string"`
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
Quantity int `json:"quantity"` Quantity int `json:"quantity"`

View file

@ -2030,9 +2030,13 @@
}, },
"location": { "location": {
"description": "Edges", "description": "Edges",
"x-nullable": true, "allOf": [
"x-omitempty": true, {
"$ref": "#/definitions/repo.LocationSummary" "$ref": "#/definitions/repo.LocationSummary"
}
],
"x-nullable": true,
"x-omitempty": true
}, },
"manufacturer": { "manufacturer": {
"type": "string" "type": "string"
@ -2048,9 +2052,13 @@
"type": "string" "type": "string"
}, },
"parent": { "parent": {
"x-nullable": true, "allOf": [
"x-omitempty": true, {
"$ref": "#/definitions/repo.ItemSummary" "$ref": "#/definitions/repo.ItemSummary"
}
],
"x-nullable": true,
"x-omitempty": true
}, },
"purchaseFrom": { "purchaseFrom": {
"type": "string" "type": "string"
@ -2136,9 +2144,13 @@
}, },
"location": { "location": {
"description": "Edges", "description": "Edges",
"x-nullable": true, "allOf": [
"x-omitempty": true, {
"$ref": "#/definitions/repo.LocationSummary" "$ref": "#/definitions/repo.LocationSummary"
}
],
"x-nullable": true,
"x-omitempty": true
}, },
"name": { "name": {
"type": "string" "type": "string"
@ -2162,7 +2174,8 @@
"type": "boolean" "type": "boolean"
}, },
"assetId": { "assetId": {
"type": "string" "type": "string",
"example": "0"
}, },
"description": { "description": {
"type": "string" "type": "string"
@ -2247,7 +2260,6 @@
"type": "string" "type": "string"
}, },
"warrantyExpires": { "warrantyExpires": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }
@ -2421,7 +2433,6 @@
"type": "object", "type": "object",
"properties": { "properties": {
"completedDate": { "completedDate": {
"description": "Sold",
"type": "string" "type": "string"
}, },
"cost": { "cost": {
@ -2438,7 +2449,6 @@
"type": "string" "type": "string"
}, },
"scheduledDate": { "scheduledDate": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }
@ -2450,7 +2460,6 @@
], ],
"properties": { "properties": {
"completedDate": { "completedDate": {
"description": "Sold",
"type": "string" "type": "string"
}, },
"cost": { "cost": {
@ -2464,7 +2473,6 @@
"type": "string" "type": "string"
}, },
"scheduledDate": { "scheduledDate": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }
@ -2473,7 +2481,6 @@
"type": "object", "type": "object",
"properties": { "properties": {
"completedDate": { "completedDate": {
"description": "Sold",
"type": "string" "type": "string"
}, },
"cost": { "cost": {
@ -2487,7 +2494,6 @@
"type": "string" "type": "string"
}, },
"scheduledDate": { "scheduledDate": {
"description": "Sold",
"type": "string" "type": "string"
} }
} }

View file

@ -22,7 +22,7 @@
get() { get() {
return state.value[nodeHash.value] ?? false; return state.value[nodeHash.value] ?? false;
}, },
set(value) { set(value: boolean) {
state.value[nodeHash.value] = value; state.value[nodeHash.value] = value;
}, },
}); });

View file

@ -15,7 +15,7 @@ function itemField(id = null): ItemField {
type: "text", type: "text",
textValue: faker.lorem.sentence(), textValue: faker.lorem.sentence(),
booleanValue: false, booleanValue: false,
numberValue: faker.datatype.number(), numberValue: faker.number.int(),
timeValue: "", timeValue: "",
}; };
} }
@ -28,7 +28,7 @@ function user(): UserRegistration {
return { return {
email: faker.internet.email(), email: faker.internet.email(),
password: faker.internet.password(), password: faker.internet.password(),
name: faker.name.firstName(), name: faker.person.firstName(),
token: "", token: "",
}; };
} }
@ -36,7 +36,7 @@ function user(): UserRegistration {
function location(parentId: string | null = null): LocationCreate { function location(parentId: string | null = null): LocationCreate {
return { return {
parentId, parentId,
name: faker.address.city(), name: faker.location.city(),
description: faker.lorem.sentence(), description: faker.lorem.sentence(),
}; };
} }

View file

@ -1,4 +1,5 @@
import { beforeAll, expect } from "vitest"; import { beforeAll, expect } from "vitest";
import { faker } from "@faker-js/faker";
import { UserClient } from "../user"; import { UserClient } from "../user";
import { factories } from "./factories"; import { factories } from "./factories";
@ -15,9 +16,9 @@ export async function sharedUserClient(): Promise<UserClient> {
return factories.client.user(cache.token); return factories.client.user(cache.token);
} }
const testUser = { const testUser = {
email: "__test__@__test__.com", email: faker.internet.email(),
name: "__test__", name: faker.person.fullName(),
password: "__test__", password: faker.internet.password(),
token: "", token: "",
}; };

View file

@ -8,7 +8,7 @@ describe("first time user workflow (register, login, join group)", () => {
test("user should be able to update group", async () => { test("user should be able to update group", async () => {
const { client } = await factories.client.singleUse(); const { client } = await factories.client.singleUse();
const name = faker.name.firstName(); const name = faker.person.firstName();
const { response, data: group } = await client.group.update({ const { response, data: group } = await client.group.update({
name, name,
@ -34,7 +34,7 @@ describe("first time user workflow (register, login, join group)", () => {
for (const currency of currencies) { for (const currency of currencies) {
const { response, data: group } = await client.group.update({ const { response, data: group } = await client.group.update({
name: faker.name.firstName(), name: faker.person.firstName(),
currency: currency.code, currency: currency.code,
}); });

View file

@ -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, { const { response, data } = await api.items.maintenance.create(item.id, {
name: faker.vehicle.model(), name: faker.vehicle.model(),
description: faker.lorem.paragraph(1), description: faker.lorem.paragraph(1),
completedDate: faker.date.past(1), completedDate: faker.date.past(),
scheduledDate: "null", scheduledDate: "null",
cost: faker.datatype.number(100).toString(), cost: faker.number.int(100).toString(),
}); });
expect(response.status).toBe(201); expect(response.status).toBe(201);

View file

@ -8,8 +8,8 @@ describe("basic notifier workflows", () => {
// Create Notifier // Create Notifier
const result = await client.notifiers.create({ const result = await client.notifiers.create({
name: faker.name.firstName(), name: faker.word.words(2),
url: "discord://" + faker.random.alphaNumeric(10), url: "discord://" + faker.string.alphanumeric(10),
isActive: true, isActive: true,
}); });
@ -22,8 +22,8 @@ describe("basic notifier workflows", () => {
// Update Notifier with new URL // Update Notifier with new URL
{ {
const updateData = { const updateData = {
name: faker.name.firstName(), name: faker.word.words(2),
url: "discord://" + faker.random.alphaNumeric(10), url: "discord://" + faker.string.alphanumeric(10),
isActive: true, isActive: true,
}; };
@ -37,7 +37,7 @@ describe("basic notifier workflows", () => {
// Update Notifier with empty URL // Update Notifier with empty URL
{ {
const updateData = { const updateData = {
name: faker.name.firstName(), name: faker.word.words(2),
url: null, url: null,
isActive: true, isActive: true,
}; };

View file

@ -40,8 +40,8 @@ function importFileGenerator(entries: number): ImportObj[] {
const pick = (arr: string[]) => arr[Math.floor(Math.random() * arr.length)]; const pick = (arr: string[]) => arr[Math.floor(Math.random() * arr.length)];
const labels = faker.random.words(5).split(" ").join(";"); const labels = faker.word.words(5).split(" ").join(";");
const locations = faker.random.words(3).split(" "); const locations = faker.word.words(3).split(" ");
const half = Math.floor(entries / 2); const half = Math.floor(entries / 2);
@ -53,21 +53,21 @@ function importFileGenerator(entries: number): ImportObj[] {
[`HB.import_ref`]: faker.database.mongodbObjectId(), [`HB.import_ref`]: faker.database.mongodbObjectId(),
[`HB.location`]: pick(locations), [`HB.location`]: pick(locations),
[`HB.labels`]: labels, [`HB.labels`]: labels,
[`HB.quantity`]: Number(faker.random.numeric(2)), [`HB.quantity`]: Number(faker.number.int(2)),
[`HB.name`]: faker.random.words(3), [`HB.name`]: faker.word.words(3),
[`HB.description`]: "", [`HB.description`]: "",
[`HB.insured`]: faker.datatype.boolean(), [`HB.insured`]: faker.datatype.boolean(),
[`HB.serial_number`]: faker.random.alphaNumeric(5), [`HB.serial_number`]: faker.string.alphanumeric(5),
[`HB.model_number`]: faker.random.alphaNumeric(5), [`HB.model_number`]: faker.string.alphanumeric(5),
[`HB.manufacturer`]: faker.random.alphaNumeric(5), [`HB.manufacturer`]: faker.string.alphanumeric(5),
[`HB.notes`]: "", [`HB.notes`]: "",
[`HB.purchase_from`]: faker.name.fullName(), [`HB.purchase_from`]: faker.person.fullName(),
[`HB.purchase_price`]: faker.datatype.number(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,
[`HB.warranty_details`]: "", [`HB.warranty_details`]: "",
[`HB.sold_to`]: faker.name.fullName(), [`HB.sold_to`]: faker.person.fullName(),
[`HB.sold_price`]: faker.datatype.number(100), [`HB.sold_price`]: faker.number.int(100),
[`HB.sold_time`]: formatDate(faker.date.past()), [`HB.sold_time`]: formatDate(faker.date.past()),
[`HB.sold_notes`]: "", [`HB.sold_notes`]: "",
}); });

View file

@ -141,6 +141,7 @@ export interface ItemSummary {
export interface ItemUpdate { export interface ItemUpdate {
archived: boolean; archived: boolean;
/** @example "0" */
assetId: string; assetId: string;
description: string; description: string;
fields: ItemField[]; fields: ItemField[];
@ -172,7 +173,6 @@ export interface ItemUpdate {
soldTime: Date | string; soldTime: Date | string;
soldTo: string; soldTo: string;
warrantyDetails: string; warrantyDetails: string;
/** Sold */
warrantyExpires: Date | string; warrantyExpires: Date | string;
} }
@ -244,36 +244,30 @@ export interface LocationUpdate {
} }
export interface MaintenanceEntry { export interface MaintenanceEntry {
/** Sold */
completedDate: Date | string; completedDate: Date | string;
/** @example "0" */ /** @example "0" */
cost: string; cost: string;
description: string; description: string;
id: string; id: string;
name: string; name: string;
/** Sold */
scheduledDate: Date | string; scheduledDate: Date | string;
} }
export interface MaintenanceEntryCreate { export interface MaintenanceEntryCreate {
/** Sold */
completedDate: Date | string; completedDate: Date | string;
/** @example "0" */ /** @example "0" */
cost: string; cost: string;
description: string; description: string;
name: string; name: string;
/** Sold */
scheduledDate: Date | string; scheduledDate: Date | string;
} }
export interface MaintenanceEntryUpdate { export interface MaintenanceEntryUpdate {
/** Sold */
completedDate: Date | string; completedDate: Date | string;
/** @example "0" */ /** @example "0" */
cost: string; cost: string;
description: string; description: string;
name: string; name: string;
/** Sold */
scheduledDate: Date | string; scheduledDate: Date | string;
} }

View file

@ -366,11 +366,13 @@
}); });
function openDialog(img: Photo) { function openDialog(img: Photo) {
// @ts-ignore - I don't know why this is happening
refDialog.value?.showModal(); refDialog.value?.showModal();
dialoged.src = img.src; dialoged.src = img.src;
} }
function closeDialog() { function closeDialog() {
// @ts-ignore - I don't know why this is happening
refDialog.value?.close(); refDialog.value?.close();
} }

View file

@ -63,6 +63,7 @@
locationId: item.value.location?.id, locationId: item.value.location?.id,
labelIds: item.value.labels.map(l => l.id), labelIds: item.value.labels.map(l => l.id),
parentId: parent.value ? parent.value.id : null, parentId: parent.value ? parent.value.id : null,
assetId: item.value.assetId,
}; };
const { error } = await api.items.update(itemId.value, payload); const { error } = await api.items.update(itemId.value, payload);