diff --git a/backend/internal/data/repo/repo_items.go b/backend/internal/data/repo/repo_items.go index c80bb81..d703063 100644 --- a/backend/internal/data/repo/repo_items.go +++ b/backend/internal/data/repo/repo_items.go @@ -160,7 +160,6 @@ type ( Attachments []ItemAttachment `json:"attachments"` Fields []ItemField `json:"fields"` - Children []ItemSummary `json:"children"` } ) @@ -241,11 +240,6 @@ func mapItemOut(item *ent.Item) ItemOut { fields = mapFields(item.Edges.Fields) } - var children []ItemSummary - if item.Edges.Children != nil { - children = mapEach(item.Edges.Children, mapItemSummary) - } - var parent *ItemSummary if item.Edges.Parent != nil { v := mapItemSummary(item.Edges.Parent) @@ -279,7 +273,6 @@ func mapItemOut(item *ent.Item) ItemOut { Notes: item.Notes, Attachments: attachments, Fields: fields, - Children: children, } } @@ -297,7 +290,6 @@ func (e *ItemsRepository) getOne(ctx context.Context, where ...predicate.Item) ( WithLabel(). WithLocation(). WithGroup(). - WithChildren(). WithParent(). WithAttachments(func(aq *ent.AttachmentQuery) { aq.WithDocument() diff --git a/frontend/lib/api/classes/items.ts b/frontend/lib/api/classes/items.ts index 1a49f26..fc0ac57 100644 --- a/frontend/lib/api/classes/items.ts +++ b/frontend/lib/api/classes/items.ts @@ -22,6 +22,7 @@ export type ItemsQuery = { pageSize?: number; locations?: string[]; labels?: string[]; + parentIds?: string[]; q?: string; fields?: string[]; }; diff --git a/frontend/pages/item/[id]/index.vue b/frontend/pages/item/[id]/index.vue index 1dbde53..7855a5f 100644 --- a/frontend/pages/item/[id]/index.vue +++ b/frontend/pages/item/[id]/index.vue @@ -404,6 +404,23 @@ }, ]; }); + + const items = computedAsync(async () => { + if (!item.value) { + return []; + } + + const resp = await api.items.getAll({ + parentIds: [item.value.id], + }); + + if (resp.error) { + toast.error("Failed to load items"); + return []; + } + + return resp.data.items; + });