diff --git a/src/server/index.js b/src/server/index.js index d53f809..616ad48 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -182,8 +182,8 @@ const resolvers = { return item.rarityIndex; }, isNc: async ({ id, rarityIndex }, _, { itemLoader }) => { - if (rarityIndex) return rarityIndex === 500 || rarityIndex === 0; - const item = await itemLoader.load({ id }); + if (rarityIndex != null) return rarityIndex === 500 || rarityIndex === 0; + const item = await itemLoader.load(id); return item.rarityIndex === 500 || item.rarityIndex === 0; }, appearanceOn: async ( @@ -370,9 +370,8 @@ const resolvers = { })); return allPairs; }, - items: async (_, { ids }, { itemLoader }) => { - const items = await itemLoader.loadMany(ids); - return items; + items: (_, { ids }) => { + return ids.map(id => ({ id })); }, itemSearch: async (_, { query }, { itemSearchLoader }) => { const items = await itemSearchLoader.load(query.trim()); diff --git a/src/server/query-tests/Item.test.js b/src/server/query-tests/Item.test.js index 72cc216..7e4bdb4 100644 --- a/src/server/query-tests/Item.test.js +++ b/src/server/query-tests/Item.test.js @@ -23,7 +23,7 @@ describe("Item", () => { expect(getDbCalls()).toMatchInlineSnapshot(` Array [ Array [ - "SELECT * FROM items WHERE id IN (?,?,?,?)", + "SELECT * FROM item_translations WHERE item_id IN (?,?,?,?) AND locale = \\"en\\"", Array [ "38913", "38911", @@ -32,7 +32,7 @@ describe("Item", () => { ], ], Array [ - "SELECT * FROM item_translations WHERE item_id IN (?,?,?,?) AND locale = \\"en\\"", + "SELECT * FROM items WHERE id IN (?,?,?,?)", Array [ "38913", "38911", @@ -78,7 +78,7 @@ describe("Item", () => { expect(getDbCalls()).toMatchInlineSnapshot(` Array [ Array [ - "SELECT * FROM items WHERE id IN (?,?,?)", + "SELECT * FROM item_translations WHERE item_id IN (?,?,?) AND locale = \\"en\\"", Array [ "38912", "38911", @@ -86,7 +86,7 @@ describe("Item", () => { ], ], Array [ - "SELECT * FROM item_translations WHERE item_id IN (?,?,?) AND locale = \\"en\\"", + "SELECT * FROM items WHERE id IN (?,?,?)", Array [ "38912", "38911", @@ -173,13 +173,13 @@ describe("Item", () => { expect(getDbCalls()).toMatchInlineSnapshot(` Array [ Array [ - "SELECT * FROM items WHERE id IN (?)", + "SELECT * FROM item_translations WHERE item_id IN (?) AND locale = \\"en\\"", Array [ "42829", ], ], Array [ - "SELECT * FROM item_translations WHERE item_id IN (?) AND locale = \\"en\\"", + "SELECT * FROM items WHERE id IN (?)", Array [ "42829", ],