add explicitlyBodySpecific to Item GQL

for the upcoming Support feature!
This commit is contained in:
Emi Matchu 2020-08-14 21:12:13 -07:00
parent 3e012ec2c0
commit 02c959a837
3 changed files with 33 additions and 3 deletions

View file

@ -72,6 +72,14 @@ const typeDefs = gql`
# this for the Support UI; it's not very helpful for most users, because it # this for the Support UI; it's not very helpful for most users, because it
# can be empty even if the item _has_ an auto-detected special color. # can be empty even if the item _has_ an auto-detected special color.
manualSpecialColor: Color manualSpecialColor: Color
# This is set manually by Support users, when the item _seems_ to fit all
# pets the same because of its zones, but it actually doesn't - e.g.,
# the Dug Up Dirt Foreground actually looks different for each body. We
# provide this for the Support UI; it's not very helpful for most users,
# because it's only used at modeling time. This value does not change how
# layer data from this API should be interpreted!
explicitlyBodySpecific: Boolean!
} }
# Cache for 1 week (unlikely to change) # Cache for 1 week (unlikely to change)
@ -275,6 +283,10 @@ const resolvers = {
? { id: item.manualSpecialColorId } ? { id: item.manualSpecialColorId }
: null; : null;
}, },
explicitlyBodySpecific: async ({ id }, _, { itemLoader }) => {
const item = await itemLoader.load(id);
return item.explicitlyBodySpecific;
},
}, },
PetAppearance: { PetAppearance: {
id: async ({ petStateId }, _, { petStateLoader, petTypeLoader }) => { id: async ({ petStateId }, _, { petStateLoader, petTypeLoader }) => {

View file

@ -6,7 +6,7 @@ describe("Item", () => {
const res = await query({ const res = await query({
query: gql` query: gql`
query { query {
items(ids: ["38913", "38911", "38912", "77530", "78104"]) { items(ids: ["38913", "38911", "38912", "55788", "77530", "78104"]) {
id id
name name
description description
@ -17,6 +17,7 @@ describe("Item", () => {
id id
name name
} }
explicitlyBodySpecific
} }
} }
`, `,
@ -27,21 +28,23 @@ describe("Item", () => {
expect(getDbCalls()).toMatchInlineSnapshot(` expect(getDbCalls()).toMatchInlineSnapshot(`
Array [ Array [
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 [ Array [
"38913", "38913",
"38911", "38911",
"38912", "38912",
"55788",
"77530", "77530",
"78104", "78104",
], ],
], ],
Array [ Array [
"SELECT * FROM items WHERE id IN (?,?,?,?,?)", "SELECT * FROM items WHERE id IN (?,?,?,?,?,?)",
Array [ Array [
"38913", "38913",
"38911", "38911",
"38912", "38912",
"55788",
"77530", "77530",
"78104", "78104",
], ],

View file

@ -83,6 +83,7 @@ Object {
"items": Array [ "items": Array [
Object { Object {
"description": "Dont leave any trace that you were there with these gloves.", "description": "Dont leave any trace that you were there with these gloves.",
"explicitlyBodySpecific": false,
"id": "38913", "id": "38913",
"isNc": false, "isNc": false,
"manualSpecialColor": null, "manualSpecialColor": null,
@ -92,6 +93,7 @@ Object {
}, },
Object { Object {
"description": "Hide your face and hair so no one can recognise you.", "description": "Hide your face and hair so no one can recognise you.",
"explicitlyBodySpecific": false,
"id": "38911", "id": "38911",
"isNc": false, "isNc": false,
"manualSpecialColor": null, "manualSpecialColor": null,
@ -101,6 +103,7 @@ Object {
}, },
Object { Object {
"description": "This robe is great for being stealthy.", "description": "This robe is great for being stealthy.",
"explicitlyBodySpecific": false,
"id": "38912", "id": "38912",
"isNc": false, "isNc": false,
"manualSpecialColor": null, "manualSpecialColor": null,
@ -108,8 +111,19 @@ Object {
"rarityIndex": 90, "rarityIndex": 90,
"thumbnailUrl": "http://images.neopets.com/items/clo_zafara_agent_robe.gif", "thumbnailUrl": "http://images.neopets.com/items/clo_zafara_agent_robe.gif",
}, },
Object {
"description": "Maybe youll be discovered by some Neopets from the future and thawed out!",
"explicitlyBodySpecific": true,
"id": "55788",
"isNc": true,
"manualSpecialColor": null,
"name": "Encased in Ice",
"rarityIndex": 500,
"thumbnailUrl": "http://images.neopets.com/items/mall_petinice.gif",
},
Object { Object {
"description": "Made with the finest jewels of the sea!", "description": "Made with the finest jewels of the sea!",
"explicitlyBodySpecific": false,
"id": "77530", "id": "77530",
"isNc": true, "isNc": true,
"manualSpecialColor": Object { "manualSpecialColor": Object {
@ -122,6 +136,7 @@ Object {
}, },
Object { Object {
"description": "You truly are the number one fan of Altador Cup, and your room reflects this!", "description": "You truly are the number one fan of Altador Cup, and your room reflects this!",
"explicitlyBodySpecific": false,
"id": "78104", "id": "78104",
"isNc": true, "isNc": true,
"manualSpecialColor": null, "manualSpecialColor": null,