Add createdAt and updatedAt to Outfit GQL
Not used in-app yet, but Dice wanted it for the Discord Neobot!
This commit is contained in:
parent
fc6cb2dfdd
commit
a0107aaf7b
1 changed files with 14 additions and 0 deletions
|
@ -10,6 +10,12 @@ const typeDefs = gql`
|
||||||
closetedItems: [Item!]!
|
closetedItems: [Item!]!
|
||||||
creator: User
|
creator: User
|
||||||
|
|
||||||
|
# When this outfit was created. ISO 8601 string.
|
||||||
|
createdAt: String!
|
||||||
|
|
||||||
|
# When this outfit was last updated. ISO 8601 string.
|
||||||
|
updatedAt: String!
|
||||||
|
|
||||||
# This is a convenience field: you could query this from the combination of
|
# This is a convenience field: you could query this from the combination of
|
||||||
# petAppearance and wornItems, but this gets you it in one shot!
|
# petAppearance and wornItems, but this gets you it in one shot!
|
||||||
itemAppearances: [ItemAppearance!]!
|
itemAppearances: [ItemAppearance!]!
|
||||||
|
@ -89,6 +95,14 @@ const resolvers = {
|
||||||
|
|
||||||
return { id: outfit.userId };
|
return { id: outfit.userId };
|
||||||
},
|
},
|
||||||
|
createdAt: async ({ id }, _, { outfitLoader }) => {
|
||||||
|
const outfit = await outfitLoader.load(id);
|
||||||
|
return outfit.createdAt.toISOString();
|
||||||
|
},
|
||||||
|
updatedAt: async ({ id }, _, { outfitLoader }) => {
|
||||||
|
const outfit = await outfitLoader.load(id);
|
||||||
|
return outfit.updatedAt.toISOString();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
|
|
Loading…
Reference in a new issue