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 */ `
31
31
# The mutation type, represents all updates we can make to our data
32
32
type Mutation {
33
33
createReview(episode: Episode, review: ReviewInput!): Review
34
+ updateHumanName(id: ID!, name: String!): Human
35
+ deleteStarship(id: ID!): ID
34
36
}
35
37
36
38
# The episodes in the Star Wars trilogy
@@ -365,6 +367,20 @@ const resolvers = {
365
367
} ,
366
368
Mutation : {
367
369
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
+ } ,
368
384
} ,
369
385
Character : {
370
386
__resolveType ( data , context , info ) {
You can’t perform that action at this time.
0 commit comments