diff --git a/src/server/query-tests/Item.test.js b/src/server/query-tests/Item.test.js index 4cdeb0a..2b4aa5f 100644 --- a/src/server/query-tests/Item.test.js +++ b/src/server/query-tests/Item.test.js @@ -13,13 +13,16 @@ describe("Item", () => { const res = await query({ query: gql` query { - items(ids: ["38913", "38911", "38912", "55788", "77530", "78104"]) { + items( + ids: ["38913", "38911", "38912", "55788", "60671", "77530", "78104"] + ) { id name description thumbnailUrl rarityIndex isNc + isPb createdAt manualSpecialColor { id @@ -39,23 +42,25 @@ describe("Item", () => { expect(getDbCalls()).toMatchInlineSnapshot(` Array [ Array [ - "SELECT * FROM item_translations WHERE item_id IN (?,?,?,?,?,?) AND locale = \\"en\\"", + "SELECT * FROM item_translations WHERE item_id IN (?,?,?,?,?,?,?) AND locale = \\"en\\"", Array [ "38913", "38911", "38912", "55788", + "60671", "77530", "78104", ], ], Array [ - "SELECT * FROM items WHERE id IN (?,?,?,?,?,?)", + "SELECT * FROM items WHERE id IN (?,?,?,?,?,?,?)", Array [ "38913", "38911", "38912", "55788", + "60671", "77530", "78104", ], @@ -65,13 +70,14 @@ describe("Item", () => { INNER JOIN parents_swf_assets psa ON psa.parent_type = \\"Item\\" AND psa.parent_id = items.id INNER JOIN swf_assets sa ON sa.id = psa.swf_asset_id - WHERE items.id IN (?, ?, ?, ?, ?, ?) + WHERE items.id IN (?, ?, ?, ?, ?, ?, ?) GROUP BY items.id;", Array [ "38913", "38911", "38912", "55788", + "60671", "77530", "78104", ], diff --git a/src/server/query-tests/__snapshots__/Item.test.js.snap b/src/server/query-tests/__snapshots__/Item.test.js.snap index 699cdb4..f102ba6 100644 --- a/src/server/query-tests/__snapshots__/Item.test.js.snap +++ b/src/server/query-tests/__snapshots__/Item.test.js.snap @@ -851,10 +851,6 @@ Object { "id": "81777", "name": "Dyeworks Cream: Cosy Baby Onesie", "speciesThatNeedModels": Array [ - Object { - "id": "4", - "name": "Bori", - }, Object { "id": "7", "name": "Chia", @@ -867,10 +863,6 @@ Object { "id": "11", "name": "Elephante", }, - Object { - "id": "13", - "name": "Flotsam", - }, Object { "id": "15", "name": "Gnorbu", @@ -957,10 +949,6 @@ Object { "id": "81778", "name": "Dyeworks Pink: Cosy Baby Onesie", "speciesThatNeedModels": Array [ - Object { - "id": "4", - "name": "Bori", - }, Object { "id": "7", "name": "Chia", @@ -973,10 +961,6 @@ Object { "id": "12", "name": "Eyrie", }, - Object { - "id": "13", - "name": "Flotsam", - }, Object { "id": "16", "name": "Grarrl", @@ -997,10 +981,6 @@ Object { "id": "23", "name": "Kau", }, - Object { - "id": "24", - "name": "Kiko", - }, Object { "id": "25", "name": "Koi", @@ -1075,14 +1055,6 @@ Object { "id": "81779", "name": "Dyeworks Black: Cosy Baby Onesie", "speciesThatNeedModels": Array [ - Object { - "id": "4", - "name": "Bori", - }, - Object { - "id": "7", - "name": "Chia", - }, Object { "id": "8", "name": "Chomby", @@ -1099,10 +1071,6 @@ Object { "id": "12", "name": "Eyrie", }, - Object { - "id": "13", - "name": "Flotsam", - }, Object { "id": "15", "name": "Gnorbu", @@ -1363,10 +1331,6 @@ Object { "id": "48", "name": "Tuskaninny", }, - Object { - "id": "51", - "name": "Wocky", - }, Object { "id": "52", "name": "Xweetok", @@ -1599,10 +1563,6 @@ Object { "id": "5", "name": "Bruce", }, - Object { - "id": "6", - "name": "Buzz", - }, Object { "id": "7", "name": "Chia", @@ -1659,10 +1619,6 @@ Object { "id": "30", "name": "Lenny", }, - Object { - "id": "34", - "name": "Moehog", - }, Object { "id": "36", "name": "Nimmo", @@ -1687,10 +1643,6 @@ Object { "id": "48", "name": "Tuskaninny", }, - Object { - "id": "51", - "name": "Wocky", - }, Object { "id": "52", "name": "Xweetok", @@ -1713,10 +1665,6 @@ Object { "id": "5", "name": "Bruce", }, - Object { - "id": "6", - "name": "Buzz", - }, Object { "id": "7", "name": "Chia", @@ -1749,10 +1697,6 @@ Object { "id": "20", "name": "Jetsam", }, - Object { - "id": "21", - "name": "Jubjub", - }, Object { "id": "23", "name": "Kau", @@ -1773,14 +1717,6 @@ Object { "id": "30", "name": "Lenny", }, - Object { - "id": "32", - "name": "Lutari", - }, - Object { - "id": "34", - "name": "Moehog", - }, Object { "id": "36", "name": "Nimmo", @@ -1789,10 +1725,6 @@ Object { "id": "38", "name": "Peophin", }, - Object { - "id": "40", - "name": "Pteri", - }, Object { "id": "41", "name": "Quiggle", @@ -1809,10 +1741,6 @@ Object { "id": "48", "name": "Tuskaninny", }, - Object { - "id": "51", - "name": "Wocky", - }, Object { "id": "52", "name": "Xweetok", @@ -1839,10 +1767,6 @@ Object { "id": "5", "name": "Bruce", }, - Object { - "id": "6", - "name": "Buzz", - }, Object { "id": "7", "name": "Chia", @@ -1895,10 +1819,6 @@ Object { "id": "30", "name": "Lenny", }, - Object { - "id": "34", - "name": "Moehog", - }, Object { "id": "36", "name": "Nimmo", @@ -1927,10 +1847,6 @@ Object { "id": "48", "name": "Tuskaninny", }, - Object { - "id": "51", - "name": "Wocky", - }, Object { "id": "52", "name": "Xweetok", @@ -1959,14 +1875,6 @@ Object { "id": "1", "name": "Acara", }, - Object { - "id": "2", - "name": "Aisha", - }, - Object { - "id": "8", - "name": "Chomby", - }, Object { "id": "15", "name": "Gnorbu", @@ -1979,10 +1887,6 @@ Object { "id": "21", "name": "Jubjub", }, - Object { - "id": "22", - "name": "Kacheek", - }, Object { "id": "24", "name": "Kiko", @@ -1991,26 +1895,10 @@ Object { "id": "28", "name": "Krawk", }, - Object { - "id": "29", - "name": "Kyrii", - }, Object { "id": "33", "name": "Meerca", }, - Object { - "id": "34", - "name": "Moehog", - }, - Object { - "id": "36", - "name": "Nimmo", - }, - Object { - "id": "39", - "name": "Poogle", - }, Object { "id": "40", "name": "Pteri", @@ -2023,10 +1911,6 @@ Object { "id": "45", "name": "Skeith", }, - Object { - "id": "47", - "name": "Tonu", - }, Object { "id": "49", "name": "Uni", @@ -2035,10 +1919,6 @@ Object { "id": "50", "name": "Usul", }, - Object { - "id": "51", - "name": "Wocky", - }, Object { "id": "54", "name": "Zafara", @@ -2053,18 +1933,6 @@ Object { "id": "1", "name": "Acara", }, - Object { - "id": "2", - "name": "Aisha", - }, - Object { - "id": "4", - "name": "Bori", - }, - Object { - "id": "8", - "name": "Chomby", - }, Object { "id": "15", "name": "Gnorbu", @@ -2077,10 +1945,6 @@ Object { "id": "21", "name": "Jubjub", }, - Object { - "id": "22", - "name": "Kacheek", - }, Object { "id": "24", "name": "Kiko", @@ -2089,10 +1953,6 @@ Object { "id": "28", "name": "Krawk", }, - Object { - "id": "29", - "name": "Kyrii", - }, Object { "id": "32", "name": "Lutari", @@ -2101,14 +1961,6 @@ Object { "id": "33", "name": "Meerca", }, - Object { - "id": "34", - "name": "Moehog", - }, - Object { - "id": "36", - "name": "Nimmo", - }, Object { "id": "40", "name": "Pteri", @@ -2117,22 +1969,10 @@ Object { "id": "41", "name": "Quiggle", }, - Object { - "id": "43", - "name": "Scorchio", - }, - Object { - "id": "47", - "name": "Tonu", - }, Object { "id": "49", "name": "Uni", }, - Object { - "id": "50", - "name": "Usul", - }, Object { "id": "51", "name": "Wocky", @@ -2151,18 +1991,6 @@ Object { "id": "1", "name": "Acara", }, - Object { - "id": "2", - "name": "Aisha", - }, - Object { - "id": "4", - "name": "Bori", - }, - Object { - "id": "8", - "name": "Chomby", - }, Object { "id": "15", "name": "Gnorbu", @@ -2175,10 +2003,6 @@ Object { "id": "21", "name": "Jubjub", }, - Object { - "id": "22", - "name": "Kacheek", - }, Object { "id": "24", "name": "Kiko", @@ -2187,10 +2011,6 @@ Object { "id": "28", "name": "Krawk", }, - Object { - "id": "29", - "name": "Kyrii", - }, Object { "id": "32", "name": "Lutari", @@ -2199,18 +2019,6 @@ Object { "id": "33", "name": "Meerca", }, - Object { - "id": "34", - "name": "Moehog", - }, - Object { - "id": "36", - "name": "Nimmo", - }, - Object { - "id": "39", - "name": "Poogle", - }, Object { "id": "40", "name": "Pteri", @@ -2223,10 +2031,6 @@ Object { "id": "43", "name": "Scorchio", }, - Object { - "id": "47", - "name": "Tonu", - }, Object { "id": "49", "name": "Uni", @@ -2657,132 +2461,6 @@ Object { }, ], }, - Object { - "id": "42546", - "name": "Blue Scorchio Star Balloon With Screen", - "speciesThatNeedModels": Array [ - Object { - "id": "4", - "name": "Bori", - }, - Object { - "id": "5", - "name": "Bruce", - }, - Object { - "id": "6", - "name": "Buzz", - }, - Object { - "id": "11", - "name": "Elephante", - }, - Object { - "id": "13", - "name": "Flotsam", - }, - Object { - "id": "14", - "name": "Gelert", - }, - Object { - "id": "15", - "name": "Gnorbu", - }, - Object { - "id": "16", - "name": "Grarrl", - }, - Object { - "id": "19", - "name": "Ixi", - }, - Object { - "id": "20", - "name": "Jetsam", - }, - Object { - "id": "21", - "name": "Jubjub", - }, - Object { - "id": "23", - "name": "Kau", - }, - Object { - "id": "25", - "name": "Koi", - }, - Object { - "id": "26", - "name": "Korbat", - }, - Object { - "id": "27", - "name": "Kougra", - }, - Object { - "id": "30", - "name": "Lenny", - }, - Object { - "id": "32", - "name": "Lutari", - }, - Object { - "id": "34", - "name": "Moehog", - }, - Object { - "id": "36", - "name": "Nimmo", - }, - Object { - "id": "40", - "name": "Pteri", - }, - Object { - "id": "41", - "name": "Quiggle", - }, - Object { - "id": "42", - "name": "Ruki", - }, - Object { - "id": "44", - "name": "Shoyru", - }, - Object { - "id": "45", - "name": "Skeith", - }, - Object { - "id": "46", - "name": "Techo", - }, - Object { - "id": "47", - "name": "Tonu", - }, - Object { - "id": "48", - "name": "Tuskaninny", - }, - Object { - "id": "49", - "name": "Uni", - }, - Object { - "id": "52", - "name": "Xweetok", - }, - Object { - "id": "53", - "name": "Yurble", - }, - ], - }, Object { "id": "47830", "name": "Y12 Celebration Glasses", @@ -6413,6 +6091,10 @@ Object { "id": "32", "name": "Lutari", }, + Object { + "id": "36", + "name": "Nimmo", + }, Object { "id": "37", "name": "Ogrin", @@ -6725,10 +6407,18 @@ Object { "id": "81144", "name": "MME25-S5a: Storage Gear Trinket", "speciesThatNeedModels": Array [ + Object { + "id": "1", + "name": "Acara", + }, Object { "id": "2", "name": "Aisha", }, + Object { + "id": "3", + "name": "Blumaroo", + }, Object { "id": "4", "name": "Bori", @@ -6777,6 +6467,10 @@ Object { "id": "17", "name": "Grundo", }, + Object { + "id": "18", + "name": "Hissi", + }, Object { "id": "19", "name": "Ixi", @@ -6837,6 +6531,10 @@ Object { "id": "37", "name": "Ogrin", }, + Object { + "id": "38", + "name": "Peophin", + }, Object { "id": "39", "name": "Poogle", @@ -6899,6 +6597,10 @@ Object { "id": "81145", "name": "MME25-S5b: Moltaran Magma Chandelier", "speciesThatNeedModels": Array [ + Object { + "id": "1", + "name": "Acara", + }, Object { "id": "2", "name": "Aisha", @@ -6955,6 +6657,10 @@ Object { "id": "17", "name": "Grundo", }, + Object { + "id": "18", + "name": "Hissi", + }, Object { "id": "19", "name": "Ixi", @@ -7019,6 +6725,10 @@ Object { "id": "37", "name": "Ogrin", }, + Object { + "id": "38", + "name": "Peophin", + }, Object { "id": "39", "name": "Poogle", @@ -7211,36 +6921,12 @@ Object { "id": "1", "name": "Acara", }, - Object { - "id": "4", - "name": "Bori", - }, - Object { - "id": "7", - "name": "Chia", - }, - Object { - "id": "20", - "name": "Jetsam", - }, - Object { - "id": "23", - "name": "Kau", - }, - Object { - "id": "24", - "name": "Kiko", - }, ], }, Object { "id": "81708", "name": "Constellation Dress", "speciesThatNeedModels": Array [ - Object { - "id": "1", - "name": "Acara", - }, Object { "id": "4", "name": "Bori", @@ -7249,50 +6935,10 @@ Object { "id": "12", "name": "Eyrie", }, - Object { - "id": "13", - "name": "Flotsam", - }, - Object { - "id": "18", - "name": "Hissi", - }, - Object { - "id": "21", - "name": "Jubjub", - }, - Object { - "id": "25", - "name": "Koi", - }, - Object { - "id": "34", - "name": "Moehog", - }, - Object { - "id": "36", - "name": "Nimmo", - }, - Object { - "id": "40", - "name": "Pteri", - }, - Object { - "id": "43", - "name": "Scorchio", - }, - Object { - "id": "47", - "name": "Tonu", - }, Object { "id": "48", "name": "Tuskaninny", }, - Object { - "id": "53", - "name": "Yurble", - }, ], }, Object { @@ -7307,10 +6953,6 @@ Object { "id": "4", "name": "Bori", }, - Object { - "id": "5", - "name": "Bruce", - }, Object { "id": "7", "name": "Chia", @@ -7335,10 +6977,6 @@ Object { "id": "24", "name": "Kiko", }, - Object { - "id": "27", - "name": "Kougra", - }, Object { "id": "33", "name": "Meerca", @@ -7349,28 +6987,6 @@ Object { }, ], }, - Object { - "id": "81710", - "name": "Spear of Radiance", - "speciesThatNeedModels": Array [ - Object { - "id": "1", - "name": "Acara", - }, - Object { - "id": "24", - "name": "Kiko", - }, - Object { - "id": "41", - "name": "Quiggle", - }, - Object { - "id": "42", - "name": "Ruki", - }, - ], - }, Object { "id": "81736", "name": "Purple & Black Ponytails Wig", @@ -7385,68 +7001,6 @@ Object { }, ], }, - Object { - "id": "81753", - "name": "Staff of the Dead", - "speciesThatNeedModels": Array [ - Object { - "id": "4", - "name": "Bori", - }, - Object { - "id": "5", - "name": "Bruce", - }, - Object { - "id": "7", - "name": "Chia", - }, - Object { - "id": "8", - "name": "Chomby", - }, - Object { - "id": "17", - "name": "Grundo", - }, - Object { - "id": "21", - "name": "Jubjub", - }, - Object { - "id": "25", - "name": "Koi", - }, - Object { - "id": "34", - "name": "Moehog", - }, - Object { - "id": "37", - "name": "Ogrin", - }, - Object { - "id": "40", - "name": "Pteri", - }, - Object { - "id": "41", - "name": "Quiggle", - }, - Object { - "id": "43", - "name": "Scorchio", - }, - Object { - "id": "53", - "name": "Yurble", - }, - Object { - "id": "54", - "name": "Zafara", - }, - ], - }, Object { "id": "81783", "name": "Dyeworks Blue: Decorated Witch Hat and Wig", @@ -7455,14 +7009,6 @@ Object { "id": "7", "name": "Chia", }, - Object { - "id": "20", - "name": "Jetsam", - }, - Object { - "id": "24", - "name": "Kiko", - }, Object { "id": "26", "name": "Korbat", @@ -7492,12 +7038,40 @@ Object { ], }, Object { - "id": "81805", - "name": "Dyeworks Orange: Playful Scarecrow Makeup", + "id": "81792", + "name": "Dyeworks Blue & Purple: MiniMME18-S2a: Galactic Traveller Wig", "speciesThatNeedModels": Array [ Object { - "id": "15", - "name": "Gnorbu", + "id": "6", + "name": "Buzz", + }, + Object { + "id": "11", + "name": "Elephante", + }, + Object { + "id": "28", + "name": "Krawk", + }, + Object { + "id": "46", + "name": "Techo", + }, + Object { + "id": "48", + "name": "Tuskaninny", + }, + Object { + "id": "49", + "name": "Uni", + }, + Object { + "id": "52", + "name": "Xweetok", + }, + Object { + "id": "54", + "name": "Zafara", }, ], }, @@ -7508,12 +7082,11 @@ Object { exports[`Item loads items that need models 2`] = ` Array [ Array [ - "SELECT * FROM item_translations WHERE item_id IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) AND locale = \\"en\\"", + "SELECT * FROM item_translations WHERE item_id IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) AND locale = \\"en\\"", Array [ "36907", "42448", "42544", - "42546", "47830", "50669", "50670", @@ -7559,12 +7132,10 @@ Array [ "81697", "81708", "81709", - "81710", "81736", - "81753", "81783", "81785", - "81805", + "81792", "72260", "81136", "81515", @@ -7666,6 +7237,7 @@ Object { "explicitlyBodySpecific": false, "id": "38913", "isNc": false, + "isPb": false, "manualSpecialColor": null, "name": "Zafara Agent Gloves", "rarityIndex": 88, @@ -7682,6 +7254,7 @@ Object { "explicitlyBodySpecific": false, "id": "38911", "isNc": false, + "isPb": false, "manualSpecialColor": null, "name": "Zafara Agent Hood", "rarityIndex": 92, @@ -7698,6 +7271,7 @@ Object { "explicitlyBodySpecific": false, "id": "38912", "isNc": false, + "isPb": false, "manualSpecialColor": null, "name": "Zafara Agent Robe", "rarityIndex": 90, @@ -7714,11 +7288,29 @@ Object { "explicitlyBodySpecific": true, "id": "55788", "isNc": true, + "isPb": false, "manualSpecialColor": null, "name": "Encased in Ice", "rarityIndex": 500, "thumbnailUrl": "http://images.neopets.com/items/mall_petinice.gif", }, + Object { + "allOccupiedZones": Array [ + Object { + "label": "Shirt/Dress", + }, + ], + "createdAt": "2020-01-01T00:00:00.000Z", + "description": "This item is part of a deluxe paint brush set!", + "explicitlyBodySpecific": false, + "id": "60671", + "isNc": false, + "isPb": true, + "manualSpecialColor": null, + "name": "8-Bit Aisha Shirt", + "rarityIndex": 101, + "thumbnailUrl": "http://images.neopets.com/items/clo_8-bit_aisha_shirt.gif", + }, Object { "allOccupiedZones": Array [ Object { @@ -7730,6 +7322,7 @@ Object { "explicitlyBodySpecific": false, "id": "77530", "isNc": true, + "isPb": false, "manualSpecialColor": Object { "id": "44", "name": "Maraquan", @@ -7749,6 +7342,7 @@ Object { "explicitlyBodySpecific": false, "id": "78104", "isNc": true, + "isPb": false, "manualSpecialColor": null, "name": "#1 Fan Room Background", "rarityIndex": 500, diff --git a/src/server/types/Item.js b/src/server/types/Item.js index f276b52..01593b2 100644 --- a/src/server/types/Item.js +++ b/src/server/types/Item.js @@ -8,8 +8,13 @@ const typeDefs = gql` description: String! thumbnailUrl: String! rarityIndex: Int! + + # Whether this item comes from the NC Mall. isNc: Boolean! + # Whether this item comes from a paintbrush. + isPb: Boolean! + # When this item was first added to DTI. ISO 8601 string, or null if the # item was added so long ago that we don't have this field! createdAt: String @@ -127,6 +132,18 @@ const resolvers = { const item = await itemLoader.load(id); return item.rarityIndex === 500 || item.rarityIndex === 0; }, + isPb: async ({ id }, _, { itemTranslationLoader }) => { + const translation = await itemTranslationLoader.load(id); + if (!translation) { + console.warn( + `Item.isPb: Translation not found for item ${id}. Returning false.` + ); + return false; + } + return translation.description.includes( + "This item is part of a deluxe paint brush set!" + ); + }, createdAt: async ({ id }, _, { itemLoader }) => { const item = await itemLoader.load(id); return item.createdAt && item.createdAt.toISOString();