Skip to content

Commit

Permalink
iterate
Browse files Browse the repository at this point in the history
  • Loading branch information
serefyarar committed Feb 1, 2024
1 parent add35fe commit fca4661
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions api/src/services/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ export class ItemService {
const {data, errors} = await this.client.executeQuery(`{
indexItemIndex(first: ${limit}, ${cursorFilter} filters: {
where: {
indexId: { equalTo: "${indexId}"}
indexId: { equalTo: "${indexId}"},
deletedAt: {isNull: true}
}
}, sorting: { createdAt: DESC}) {
pageInfo {
Expand Down Expand Up @@ -188,10 +189,13 @@ export class ItemService {
}

if (data.indexItemIndex.edges.length === 0) {
return null;
return {
endCursor: null,
items: [],
};
}

return {
return { //Todo fix itemId to id
endCursor: data.indexItemIndex.pageInfo.endCursor,
items: data.indexItemIndex.edges.map(({ node: { item: { __typename: type, ...rest } } }) => ({
type,
Expand Down

0 comments on commit fca4661

Please sign in to comment.