diff --git a/src/server/types/Item.js b/src/server/types/Item.js index 9eff8ae..52dbc61 100644 --- a/src/server/types/Item.js +++ b/src/server/types/Item.js @@ -457,12 +457,15 @@ const resolvers = { GROUP BY swf_assets.body_id -- We have some invalid data where the asset has a body ID that -- matches no pet type. Huh! Well, ignore those bodies! - HAVING speciesId IS NOT NULL; + HAVING speciesId IS NOT NULL OR bodyId = 0; `, [id] ); return rows.map((row) => ({ - body: { id: row.bodyId, species: { id: row.speciesId } }, + body: { + id: row.bodyId, + species: row.speciesId ? { id: row.speciesId } : null, + }, zones: row.zoneIds.split(",").map((zoneId) => ({ id: zoneId })), })); }, diff --git a/src/server/types/PetAppearance.js b/src/server/types/PetAppearance.js index b41d539..7e23704 100644 --- a/src/server/types/PetAppearance.js +++ b/src/server/types/PetAppearance.js @@ -49,14 +49,16 @@ const typeDefs = gql` type Body @cacheControl(maxAge: ${oneDay}, staleWhileRevalidate: ${oneWeek}) { id: ID! - species: Species! + + # Whether this is the special body type that represents fitting _all_ pets. + representsAllBodies: Boolean! + + # The species this body belongs to. Null if representsAllBodies is true. + species: Species # A PetAppearance that has this body. Prefers Blue (or the optional # preferredColorId), and happy poses. canonicalAppearance(preferredColorId: ID): PetAppearance - - # Whether this is the special body type that represents fitting _all_ pets. - representsAllBodies: Boolean! } type PetAppearance @cacheControl(maxAge: ${oneHour}, staleWhileRevalidate: ${oneWeek}) { @@ -188,7 +190,10 @@ const resolvers = { }, Body: { - species: ({ species }) => { + species: ({ id, species }) => { + if (id == "0") { + return null; + } if (species) { return species; }