add rarityIndex, isNc to API
This commit is contained in:
parent
6f5e03da9c
commit
ce81543957
3 changed files with 25 additions and 4 deletions
|
@ -63,6 +63,8 @@ const typeDefs = gql`
|
|||
name: String!
|
||||
description: String!
|
||||
thumbnailUrl: String!
|
||||
rarityIndex: Int!
|
||||
isNc: Boolean!
|
||||
appearanceOn(speciesId: ID!, colorId: ID!): ItemAppearance
|
||||
}
|
||||
|
||||
|
@ -73,7 +75,7 @@ const typeDefs = gql`
|
|||
pose: Pose!
|
||||
genderPresentation: GenderPresentation # deprecated
|
||||
emotion: Emotion # deprecated
|
||||
approximateThumbnailUrl: String!
|
||||
approximateThumbnailUrl: String! # deprecated
|
||||
layers: [AppearanceLayer!]!
|
||||
}
|
||||
|
||||
|
@ -162,6 +164,7 @@ const resolvers = {
|
|||
const translation = await itemTranslationLoader.load(item.id);
|
||||
return translation.description;
|
||||
},
|
||||
isNc: (item) => item.rarityIndex === 500 || item.rarityIndex === 0,
|
||||
appearanceOn: async (
|
||||
item,
|
||||
{ speciesId, colorId },
|
||||
|
|
|
@ -6,11 +6,13 @@ describe("Item", () => {
|
|||
const res = await query({
|
||||
query: gql`
|
||||
query {
|
||||
items(ids: ["38913", "38911", "38912"]) {
|
||||
items(ids: ["38913", "38911", "38912", "78104"]) {
|
||||
id
|
||||
name
|
||||
description
|
||||
thumbnailUrl
|
||||
rarityIndex
|
||||
isNc
|
||||
}
|
||||
}
|
||||
`,
|
||||
|
@ -21,19 +23,21 @@ describe("Item", () => {
|
|||
expect(getDbCalls()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Array [
|
||||
"SELECT * FROM items WHERE id IN (?,?,?)",
|
||||
"SELECT * FROM items WHERE id IN (?,?,?,?)",
|
||||
Array [
|
||||
"38913",
|
||||
"38911",
|
||||
"38912",
|
||||
"78104",
|
||||
],
|
||||
],
|
||||
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",
|
||||
"78104",
|
||||
],
|
||||
],
|
||||
]
|
||||
|
|
|
@ -84,21 +84,35 @@ Object {
|
|||
Object {
|
||||
"description": "Dont leave any trace that you were there with these gloves.",
|
||||
"id": "38913",
|
||||
"isNc": false,
|
||||
"name": "Zafara Agent Gloves",
|
||||
"rarityIndex": 88,
|
||||
"thumbnailUrl": "http://images.neopets.com/items/clo_zafara_agent_gloves.gif",
|
||||
},
|
||||
Object {
|
||||
"description": "Hide your face and hair so no one can recognise you.",
|
||||
"id": "38911",
|
||||
"isNc": false,
|
||||
"name": "Zafara Agent Hood",
|
||||
"rarityIndex": 92,
|
||||
"thumbnailUrl": "http://images.neopets.com/items/clo_zafara_agent_hood.gif",
|
||||
},
|
||||
Object {
|
||||
"description": "This robe is great for being stealthy.",
|
||||
"id": "38912",
|
||||
"isNc": false,
|
||||
"name": "Zafara Agent Robe",
|
||||
"rarityIndex": 90,
|
||||
"thumbnailUrl": "http://images.neopets.com/items/clo_zafara_agent_robe.gif",
|
||||
},
|
||||
Object {
|
||||
"description": "You truly are the number one fan of Altador Cup, and your room reflects this!",
|
||||
"id": "78104",
|
||||
"isNc": true,
|
||||
"name": "#1 Fan Room Background",
|
||||
"rarityIndex": 500,
|
||||
"thumbnailUrl": "http://images.neopets.com/items/mall_bg_numberonefanbg.gif",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
|
Loading…
Reference in a new issue