A continuation of HomeBox the inventory and organization system built for the Home User
fix: other minor fixes (#388)
Hayden4dd925caf059
diff --git a/backend/app/api/handlers/v1/v1_ctrl_items.go b/backend/app/api/handlers/v1/v1_ctrl_items.goindex 062fbadd..7e7600cd 100644--- a/backend/app/api/handlers/v1/v1_ctrl_items.go+++ b/backend/app/api/handlers/v1/v1_ctrl_items.go@@ -58,6 +58,7 @@ func (ctrl *V1Controller) HandleItemsGetAll() errchain.HandlerFunc {LabelIDs: queryUUIDList(params, "labels"),IncludeArchived: queryBool(params.Get("includeArchived")),Fields: filterFieldItems(params["fields"]),+ OrderBy: params.Get("orderBy"),}if strings.HasPrefix(v.Search, "#") {diff --git a/backend/internal/data/repo/repo_items.go b/backend/internal/data/repo/repo_items.goindex 103c3e98..3e263cc5 100644--- a/backend/internal/data/repo/repo_items.go+++ b/backend/internal/data/repo/repo_items.go@@ -29,13 +29,14 @@ type (ItemQuery struct {Page intPageSize int- Search string `json:"search"`- AssetID AssetID `json:"assetId"`- LocationIDs []uuid.UUID `json:"locationIds"`- LabelIDs []uuid.UUID `json:"labelIds"`- SortBy string `json:"sortBy"`- IncludeArchived bool `json:"includeArchived"`- Fields []FieldQuery+ Search string `json:"search"`+ AssetID AssetID `json:"assetId"`+ LocationIDs []uuid.UUID `json:"locationIds"`+ LabelIDs []uuid.UUID `json:"labelIds"`+ SortBy string `json:"sortBy"`+ IncludeArchived bool `json:"includeArchived"`+ Fields []FieldQuery `json:"fields"`+ OrderBy string `json:"orderBy"`}ItemField struct {@@ -326,6 +327,7 @@ func (e *ItemsRepository) QueryByGroup(ctx context.Context, gid uuid.UUID, q Iteitem.NameContainsFold(q.Search),item.DescriptionContainsFold(q.Search),item.NotesContainsFold(q.Search),+ item.ManufacturerContainsFold(q.Search),),)}@@ -385,7 +387,17 @@ func (e *ItemsRepository) QueryByGroup(ctx context.Context, gid uuid.UUID, q Itereturn PaginationResult[ItemSummary]{}, err}- qb = qb.Order(ent.Asc(item.FieldName)).+ // Order+ switch q.OrderBy {+ case "createdAt":+ qb = qb.Order(ent.Desc(item.FieldCreatedAt))+ case "updatedAt":+ qb = qb.Order(ent.Desc(item.FieldUpdatedAt))+ default: // "name"+ qb = qb.Order(ent.Asc(item.FieldName))+ }++ qb = qb.WithLabel().WithLocation()diff --git a/frontend/components/Base/Card.vue b/frontend/components/Base/Card.vueindex 512748c9..d89c1c03 100644--- a/frontend/components/Base/Card.vue+++ b/frontend/components/Base/Card.vue@@ -23,10 +23,10 @@</div><div:class="{- 'max-h-[99999px]': !collapsed,- 'max-h-0': collapsed,+ 'max-h-[9000px]': collapsable && !collapsed,+ 'max-h-0 overflow-hidden': collapsed,}"- class="transition-[max-height] duration-200 overflow-hidden"+ class="transition-[max-height] duration-200"><slot /></div>diff --git a/frontend/components/Item/View/Table.vue b/frontend/components/Item/View/Table.vueindex b9b71962..f6c3cf19 100644--- a/frontend/components/Item/View/Table.vue+++ b/frontend/components/Item/View/Table.vue@@ -79,7 +79,7 @@};const props = defineProps<Props>();- const sortByProperty = ref<keyof ItemSummary>("name");+ const sortByProperty = ref<keyof ItemSummary | "">("");const headers = computed<TableHeader[]>(() => {return [@@ -136,6 +136,10 @@}function itemSort(a: ItemSummary, b: ItemSummary) {+ if (!sortByProperty.value) {+ return 0;+ }+const aLower = extractSortable(a, sortByProperty.value);const bLower = extractSortable(b, sortByProperty.value);diff --git a/frontend/layouts/default.vue b/frontend/layouts/default.vueindex 393b4eec..8941b287 100644--- a/frontend/layouts/default.vue+++ b/frontend/layouts/default.vue@@ -16,16 +16,16 @@<AppHeaderDecor class="-mt-10 hidden lg:block" /><!-- Button --><div class="navbar z-[99] lg:hidden top-0 fixed bg-primary shadow-md drawer-button">+ <label for="my-drawer-2" class="btn btn-square btn-ghost text-base-100 drawer-button lg:hidden">+ <Icon name="mdi-menu" class="h-6 w-6" />+ </label><NuxtLink to="/home">- <h2 class="mt-1 ml-1 text-3xl font-bold tracking-tight text-base-100 flex">+ <h2 class="text-3xl font-bold tracking-tight text-base-100 flex">HomeB<AppLogo class="w-8 -mb-3" />x</h2></NuxtLink>- <label for="my-drawer-2" class="btn btn-square btn-ghost ml-auto text-base-100 drawer-button lg:hidden">- <Icon name="mdi-menu" class="h-6 w-6" />- </label></div><slot></slot>diff --git a/frontend/lib/api/classes/items.ts b/frontend/lib/api/classes/items.tsindex 29403a2a..b7cc17d8 100644--- a/frontend/lib/api/classes/items.ts+++ b/frontend/lib/api/classes/items.ts@@ -15,6 +15,7 @@ import { AttachmentTypes, PaginationResult } from "../types/non-generated";import { Requests } from "~~/lib/requests";export type ItemsQuery = {+ orderBy?: string;includeArchived?: boolean;page?: number;pageSize?: number;diff --git a/frontend/pages/home/table.ts b/frontend/pages/home/table.tsindex 127ecbb6..7c38d6a3 100644--- a/frontend/pages/home/table.ts+++ b/frontend/pages/home/table.ts@@ -5,6 +5,7 @@ export function itemsTable(api: UserClient) {const { data } = await api.items.getAll({page: 1,pageSize: 5,+ orderBy: "createdAt",});return data.items;});diff --git a/frontend/pages/profile.vue b/frontend/pages/profile.vueindex d597e926..04f0eb66 100644--- a/frontend/pages/profile.vue+++ b/frontend/pages/profile.vue@@ -473,11 +473,10 @@<span class="text-base-600"> Delete Account</span><template #description> Delete your account and all it's associated data </template></BaseSectionHeader>-- <div class="py-4 border-t-2 border-gray-300">- <BaseButton size="sm" class="btn-error" @click="deleteProfile"> Delete Account </BaseButton>- </div></template>+ <div class="p-4 px-6 border-t-2 border-gray-300">+ <BaseButton size="sm" class="btn-error" @click="deleteProfile"> Delete Account </BaseButton>+ </div></BaseCard></BaseContainer><footer v-if="status" class="text-center w-full bottom-0 pb-4">