From 9d182d07b012c7d63d5770cd0e9578c2803cadec Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 18 Feb 2023 09:41:48 -0900 Subject: [PATCH 001/278] fix label store --- frontend/stores/labels.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/stores/labels.ts b/frontend/stores/labels.ts index acddf2c..05988d6 100644 --- a/frontend/stores/labels.ts +++ b/frontend/stores/labels.ts @@ -18,6 +18,8 @@ export const useLabelStore = defineStore("labels", { if (result.error) { console.error(result.error); } + + this.allLabels = result.data.items; }); } return state.allLabels ?? []; From 859d3b9ffe368c8a916c1fe952fa42a30d3bf929 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 18 Feb 2023 09:47:04 -0900 Subject: [PATCH 002/278] fix label store (#303) --- frontend/stores/labels.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/stores/labels.ts b/frontend/stores/labels.ts index acddf2c..05988d6 100644 --- a/frontend/stores/labels.ts +++ b/frontend/stores/labels.ts @@ -18,6 +18,8 @@ export const useLabelStore = defineStore("labels", { if (result.error) { console.error(result.error); } + + this.allLabels = result.data.items; }); } return state.allLabels ?? []; From 3ac6c7c8587c092be51841fd0921707f581fd3b0 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 18 Feb 2023 09:57:09 -0900 Subject: [PATCH 003/278] fix: use item quantity as count mechanism (#304) --- backend/internal/data/repo/repo_locations.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/internal/data/repo/repo_locations.go b/backend/internal/data/repo/repo_locations.go index 2d3ea56..25a17f0 100644 --- a/backend/internal/data/repo/repo_locations.go +++ b/backend/internal/data/repo/repo_locations.go @@ -105,7 +105,7 @@ func (r *LocationRepository) GetAll(ctx context.Context, GID uuid.UUID, filter L updated_at, ( SELECT - COUNT(*) + SUM(items.quantity) FROM items WHERE @@ -135,11 +135,17 @@ func (r *LocationRepository) GetAll(ctx context.Context, GID uuid.UUID, filter L for rows.Next() { var ct LocationOutCount - err := rows.Scan(&ct.ID, &ct.Name, &ct.Description, &ct.CreatedAt, &ct.UpdatedAt, &ct.ItemCount) + var maybeCount *int + + err := rows.Scan(&ct.ID, &ct.Name, &ct.Description, &ct.CreatedAt, &ct.UpdatedAt, &maybeCount) if err != nil { return nil, err } + if maybeCount != nil { + ct.ItemCount = *maybeCount + } + list = append(list, ct) } From 9d9b05d8a6e58eb32324007e57e331a177225907 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 18 Feb 2023 10:09:19 -0900 Subject: [PATCH 004/278] fix: several layout issues (#305) * fix login version issue * allow wrapping on action menu --- frontend/pages/index.vue | 4 ++-- frontend/pages/label/[id].vue | 2 +- frontend/pages/location/[id].vue | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue index 5bcc8c5..7c32931 100644 --- a/frontend/pages/index.vue +++ b/frontend/pages/index.vue @@ -109,7 +109,7 @@ diff --git a/frontend/lib/api/base/base-api.ts b/frontend/lib/api/base/base-api.ts index 3847a4b..358779a 100644 --- a/frontend/lib/api/base/base-api.ts +++ b/frontend/lib/api/base/base-api.ts @@ -1,4 +1,5 @@ import { Requests } from "../../requests"; +import { route } from "."; const ZERO_DATE = "0001-01-01T00:00:00Z"; @@ -70,12 +71,12 @@ export class BaseAPI { this.attachmentToken = attachmentToken; } - // if a attachmentToken is present it will be added to URL as a query param + // if an attachmentToken is present, it will be added to URL as a query param // this is done with a simple appending of the query param to the URL. If your // URL already has a query param, this will not work. authURL(url: string): string { if (this.attachmentToken) { - return `/api/v1${url}?access_token=${this.attachmentToken}`; + return route(url, { access_token: this.attachmentToken }); } return url; } diff --git a/frontend/lib/api/base/urls.ts b/frontend/lib/api/base/urls.ts index 31e263d..47a1c5b 100644 --- a/frontend/lib/api/base/urls.ts +++ b/frontend/lib/api/base/urls.ts @@ -11,13 +11,13 @@ export function overrideParts(host: string, prefix: string) { export type QueryValue = string | string[] | number | number[] | boolean | null | undefined; /** - * route is a the main URL builder for the API. It will use a predefined host and prefix (global) - * in the urls.ts file and then append the passed in path parameter uring the `URL` class from the + * route is the main URL builder for the API. It will use a predefined host and prefix (global) + * in the urls.ts file and then append the passed-in path parameter using the `URL` class from the * browser. It will also append any query parameters passed in as the second parameter. * * The default host `http://localhost.com` is removed from the path if it is present. This allows us * to bootstrap the API with different hosts as needed (like for testing) but still allows us to use - * relative URLs in pruduction because the API and client bundle are served from the same server/host. + * relative URLs in production because the API and client bundle are served from the same server/host. */ export function route(rest: string, params: Record = {}): string { const url = new URL(parts.prefix + rest, parts.host); diff --git a/frontend/pages/reports/label-generator.vue b/frontend/pages/reports/label-generator.vue index da3bbd7..780a0c4 100644 --- a/frontend/pages/reports/label-generator.vue +++ b/frontend/pages/reports/label-generator.vue @@ -1,4 +1,6 @@