From b26bb4ea03dd9284db527f4b9eac6763c6dc878e Mon Sep 17 00:00:00 2001 From: Marcelo dos Santos Date: Mon, 13 Mar 2023 20:25:15 -0300 Subject: [PATCH] feat: add Adding a mutation to our schema --- graphql/odyssey-lift-off/server/src/schema.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/graphql/odyssey-lift-off/server/src/schema.js b/graphql/odyssey-lift-off/server/src/schema.js index 49e04ec30..adf2672cf 100644 --- a/graphql/odyssey-lift-off/server/src/schema.js +++ b/graphql/odyssey-lift-off/server/src/schema.js @@ -10,6 +10,10 @@ const typeDefs = gql` module(id: ID!): Module! } + type Mutation { + incrementTrackViews(id: ID!): IncrementTrackViewsResponse! + } + "A track is a group of Modules that teaches about a specific topic" type Track { id: ID! @@ -52,6 +56,17 @@ const typeDefs = gql` "The module's video url, for video-based modules" videoUrl: String } + + type IncrementTrackViewsResponse { + "Similar to HTTP status code, represents the status of the mutation" + code: Int! + "Indicates whether the mutation was successful" + success: Boolean! + "Human-readable message for the UI" + message: String! + "Newly updated track after a successful mutation" + track: Track + } `; module.exports = typeDefs;