File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ const typeDefs = /* GraphQL */ `
3131 # The mutation type, represents all updates we can make to our data
3232 type Mutation {
3333 createReview(episode: Episode, review: ReviewInput!): Review
34+ updateHumanName(id: ID!, name: String!): Human
35+ deleteStarship(id: ID!): ID
3436 }
3537
3638 # The episodes in the Star Wars trilogy
@@ -365,6 +367,20 @@ const resolvers = {
365367 } ,
366368 Mutation : {
367369 createReview : ( root , { episode, review } ) => review ,
370+ updateHumanName : ( root , { id, name } ) => {
371+ const human = humanData [ id ]
372+ if ( ! human ) {
373+ throw new Error ( "Human not found" )
374+ }
375+ return { ...human , name }
376+ } ,
377+ deleteStarship : ( root , { id } ) => {
378+ const starship = getStarship ( id )
379+ if ( ! starship ) {
380+ throw new Error ( "Starship not found" )
381+ }
382+ return id
383+ } ,
368384 } ,
369385 Character : {
370386 __resolveType ( data , context , info ) {
You can’t perform that action at this time.
0 commit comments