From 710593ea71951491c1b0f7fba9fded3f95ee813f Mon Sep 17 00:00:00 2001 From: sudeep Date: Fri, 12 Jul 2024 12:07:00 +0100 Subject: [PATCH 1/3] added editors in create questionnaire input Signed-off-by: sudeep --- eq-author-api/schema/typeDefs.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eq-author-api/schema/typeDefs.js b/eq-author-api/schema/typeDefs.js index 1b445c28f1..6d0545def3 100644 --- a/eq-author-api/schema/typeDefs.js +++ b/eq-author-api/schema/typeDefs.js @@ -1297,6 +1297,7 @@ input CreateQuestionnaireInput { type: QuestionnaireType shortTitle: String isPublic: Boolean + editors: [ID!] } input UpdateQuestionnaireInput { From c3f2696a4ed3eb050d0379ce461260dcc3f78f91 Mon Sep 17 00:00:00 2001 From: sudeep Date: Fri, 13 Sep 2024 16:20:03 +0100 Subject: [PATCH 2/3] createQuestionnaireV2 mutation and necessary types Signed-off-by: sudeep --- eq-author-api/schema/resolvers/base.js | 13 +++++++++++++ eq-author-api/schema/typeDefs.js | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/eq-author-api/schema/resolvers/base.js b/eq-author-api/schema/resolvers/base.js index e694571a53..cde4a2cdb3 100644 --- a/eq-author-api/schema/resolvers/base.js +++ b/eq-author-api/schema/resolvers/base.js @@ -457,6 +457,19 @@ const Resolvers = { return ctx.questionnaire; }, + createQuestionnaireV2: async (root, args, ctx) => { + const questionnaire = createNewQuestionnaire({ + ...args.input, + createdBy: ctx.user.id, + }); + + await createComments(questionnaire.id); + // Saving to ctx so it can be used by all other resolvers and read by tests + ctx.questionnaire = await createQuestionnaire(questionnaire, ctx); + logger.info(`Questionnaire Created with ID ${ctx.questionnaire.id}`); + + return ctx.questionnaire; + }, updateQuestionnaire: createMutation((_, { input }, ctx) => { Object.assign(ctx.questionnaire, input); onQuestionnaireUpdated(ctx.questionnaire); diff --git a/eq-author-api/schema/typeDefs.js b/eq-author-api/schema/typeDefs.js index 62ffce5eae..7e99d882a9 100644 --- a/eq-author-api/schema/typeDefs.js +++ b/eq-author-api/schema/typeDefs.js @@ -53,6 +53,12 @@ enum Access { PrivateQuestionnaires } +type BasicQuestionnaire { + id: ID! + title: String + shortTitle: String +} + type Questionnaire { id: ID! title: String @@ -1041,6 +1047,7 @@ input ImportSectionsInput { type Mutation { createQuestionnaire(input: CreateQuestionnaireInput!): Questionnaire + createQuestionnaireV2(input: CreateQuestionnaireInputV2!): BasicQuestionnaire updateQuestionnaire(input: UpdateQuestionnaireInput!): Questionnaire deleteQuestionnaire(input: DeleteQuestionnaireInput!): DeletedQuestionnaire duplicateQuestionnaire(input: DuplicateQuestionnaireInput!): Questionnaire @@ -1339,6 +1346,21 @@ input CreateQuestionnaireInput { type: QuestionnaireType shortTitle: String isPublic: Boolean +} + +input CreateQuestionnaireInputV2 { + title: String! + description: String + additionalGuidancePanelSwitch: Boolean + additionalGuidancePanel: String + theme: String! + navigation: Boolean + hub: Boolean + surveyId: String! + summary: Boolean + type: QuestionnaireType + shortTitle: String + isPublic: Boolean editors: [ID!] } From 94d7f20a8b5b94deb36989b59ca781b2afd37b12 Mon Sep 17 00:00:00 2001 From: sudeep Date: Thu, 19 Sep 2024 12:39:17 +0100 Subject: [PATCH 3/3] corrected api changes Signed-off-by: sudeep --- eq-author-api/schema/resolvers/base.js | 13 ------------- eq-author-api/schema/typeDefs.js | 22 ---------------------- 2 files changed, 35 deletions(-) diff --git a/eq-author-api/schema/resolvers/base.js b/eq-author-api/schema/resolvers/base.js index cde4a2cdb3..e694571a53 100644 --- a/eq-author-api/schema/resolvers/base.js +++ b/eq-author-api/schema/resolvers/base.js @@ -457,19 +457,6 @@ const Resolvers = { return ctx.questionnaire; }, - createQuestionnaireV2: async (root, args, ctx) => { - const questionnaire = createNewQuestionnaire({ - ...args.input, - createdBy: ctx.user.id, - }); - - await createComments(questionnaire.id); - // Saving to ctx so it can be used by all other resolvers and read by tests - ctx.questionnaire = await createQuestionnaire(questionnaire, ctx); - logger.info(`Questionnaire Created with ID ${ctx.questionnaire.id}`); - - return ctx.questionnaire; - }, updateQuestionnaire: createMutation((_, { input }, ctx) => { Object.assign(ctx.questionnaire, input); onQuestionnaireUpdated(ctx.questionnaire); diff --git a/eq-author-api/schema/typeDefs.js b/eq-author-api/schema/typeDefs.js index 7e99d882a9..62ffce5eae 100644 --- a/eq-author-api/schema/typeDefs.js +++ b/eq-author-api/schema/typeDefs.js @@ -53,12 +53,6 @@ enum Access { PrivateQuestionnaires } -type BasicQuestionnaire { - id: ID! - title: String - shortTitle: String -} - type Questionnaire { id: ID! title: String @@ -1047,7 +1041,6 @@ input ImportSectionsInput { type Mutation { createQuestionnaire(input: CreateQuestionnaireInput!): Questionnaire - createQuestionnaireV2(input: CreateQuestionnaireInputV2!): BasicQuestionnaire updateQuestionnaire(input: UpdateQuestionnaireInput!): Questionnaire deleteQuestionnaire(input: DeleteQuestionnaireInput!): DeletedQuestionnaire duplicateQuestionnaire(input: DuplicateQuestionnaireInput!): Questionnaire @@ -1346,21 +1339,6 @@ input CreateQuestionnaireInput { type: QuestionnaireType shortTitle: String isPublic: Boolean -} - -input CreateQuestionnaireInputV2 { - title: String! - description: String - additionalGuidancePanelSwitch: Boolean - additionalGuidancePanel: String - theme: String! - navigation: Boolean - hub: Boolean - surveyId: String! - summary: Boolean - type: QuestionnaireType - shortTitle: String - isPublic: Boolean editors: [ID!] }