From d1f5aae167f5f3c8632b1e7ac0107e565d51d64c Mon Sep 17 00:00:00 2001 From: thenav56 Date: Wed, 6 Sep 2023 16:53:10 +0545 Subject: [PATCH] Add is_hidden in Question - Update tests - Remove buggy filter - Add questionnaire arg in bulk mutations --- apps/questionnaire/enums.py | 2 +- apps/questionnaire/factories.py | 9 + apps/questionnaire/filters.py | 14 +- .../migrations/0006_question_is_hidden.py | 18 ++ apps/questionnaire/models.py | 1 + apps/questionnaire/mutations.py | 31 ++- apps/questionnaire/tests/test_mutations.py | 236 +++++++++++++----- apps/questionnaire/types.py | 1 + schema.graphql | 21 +- 9 files changed, 244 insertions(+), 89 deletions(-) create mode 100644 apps/questionnaire/migrations/0006_question_is_hidden.py diff --git a/apps/questionnaire/enums.py b/apps/questionnaire/enums.py index 71188d7..b0ceafe 100644 --- a/apps/questionnaire/enums.py +++ b/apps/questionnaire/enums.py @@ -29,6 +29,6 @@ @strawberry.enum -class QuestionLeafGroupVisibilityActionEnum(Enum): +class VisibilityActionEnum(Enum): SHOW = auto(), 'Show' HIDE = auto(), 'Hide' diff --git a/apps/questionnaire/factories.py b/apps/questionnaire/factories.py index 29c97ee..fa88955 100644 --- a/apps/questionnaire/factories.py +++ b/apps/questionnaire/factories.py @@ -141,3 +141,12 @@ class QuestionFactory(DjangoModelFactory): class Meta: model = Question + + @classmethod + def _create(cls, model_class, *args, **kwargs): + obj = model_class(*args, **kwargs) + obj.questionnaire = obj.leaf_group.questionnaire + if getattr(obj, 'choice_collection', None): + assert obj.choice_collection.questionnaire == obj.questionnaire + obj.save() + return obj diff --git a/apps/questionnaire/filters.py b/apps/questionnaire/filters.py index e9d3b1c..c05e92e 100644 --- a/apps/questionnaire/filters.py +++ b/apps/questionnaire/filters.py @@ -35,20 +35,8 @@ class QuestionFilter: name: strawberry.auto label: strawberry.auto leaf_group: strawberry.auto - include_child_group: bool | None = False + is_hidden: strawberry.auto def filter_leaf_group(self, queryset): # NOTE: logic is in filter_include_child_group return queryset - - def filter_include_child_group(self, queryset): - if self.leaf_group is strawberry.UNSET: - # Nothing to do here - return queryset - if not self.include_child_group: - return queryset.filter(group=self.leaf_group.pk) - all_groups = [ - self.leaf_group.pk, - # TODO: *get_child_groups_id(self.leaf_group.pk), - ] - return queryset.filter(group__in=all_groups) diff --git a/apps/questionnaire/migrations/0006_question_is_hidden.py b/apps/questionnaire/migrations/0006_question_is_hidden.py new file mode 100644 index 0000000..eaaf129 --- /dev/null +++ b/apps/questionnaire/migrations/0006_question_is_hidden.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.1 on 2023-09-06 09:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('questionnaire', '0005_alter_questionleafgroup_unique_together'), + ] + + operations = [ + migrations.AddField( + model_name='question', + name='is_hidden', + field=models.BooleanField(default=False), + ), + ] diff --git a/apps/questionnaire/models.py b/apps/questionnaire/models.py index 212c2ad..b933de7 100644 --- a/apps/questionnaire/models.py +++ b/apps/questionnaire/models.py @@ -505,6 +505,7 @@ class Type(models.IntegerChoices): leaf_group = models.ForeignKey(QuestionLeafGroup, on_delete=models.CASCADE) type = models.PositiveSmallIntegerField(choices=Type.choices) order = models.PositiveSmallIntegerField(default=0) + is_hidden = models.BooleanField(default=False) # XXX: This needs to be also unique within Questionnaire & Question Bank # TODO: Make sure this is also unique within questions and groups diff --git a/apps/questionnaire/mutations.py b/apps/questionnaire/mutations.py index 2b9662b..f5cbd8a 100644 --- a/apps/questionnaire/mutations.py +++ b/apps/questionnaire/mutations.py @@ -24,7 +24,7 @@ QuestionLeafGroupType, QuestionChoiceCollectionType, ) -from .enums import QuestionLeafGroupVisibilityActionEnum +from .enums import VisibilityActionEnum QuestionnaireMutation = ModelMutation('Questionnaire', QuestionnaireSerializer) QuestionMutation = ModelMutation('Question', QuestionSerializer) @@ -147,14 +147,37 @@ def bulk_update_questionnair_question_groups_leaf_order( @sync_to_async def update_question_groups_leaf_visibility( self, + questionnaire_id: strawberry.ID, ids: list[strawberry.ID], - visibility: QuestionLeafGroupVisibilityActionEnum, + visibility: VisibilityActionEnum, info: Info, ) -> BulkBasicMutationResponseType[QuestionLeafGroupType]: if errors := ModelMutation.check_permissions(info, Project.Permission.UPDATE_QUESTION_GROUP): return BulkBasicMutationResponseType(errors=[errors]) - queryset = QuestionLeafGroupType.get_queryset(None, None, info).filter(id__in=ids) - is_hidden = visibility == QuestionLeafGroupVisibilityActionEnum.HIDE + queryset = QuestionLeafGroupType.get_queryset(None, None, info).filter( + questionnaire=questionnaire_id, + id__in=ids, + ) + is_hidden = visibility == VisibilityActionEnum.HIDE + queryset.update(is_hidden=is_hidden) + return BulkBasicMutationResponseType(results=[i for i in queryset]) + + @strawberry.mutation + @sync_to_async + def update_questions_visibility( + self, + questionnaire_id: strawberry.ID, + ids: list[strawberry.ID], + visibility: VisibilityActionEnum, + info: Info, + ) -> BulkBasicMutationResponseType[QuestionType]: + if errors := ModelMutation.check_permissions(info, Project.Permission.UPDATE_QUESTION): + return BulkBasicMutationResponseType(errors=[errors]) + queryset = QuestionType.get_queryset(None, None, info).filter( + questionnaire=questionnaire_id, + id__in=ids, + ) + is_hidden = visibility == VisibilityActionEnum.HIDE queryset.update(is_hidden=is_hidden) return BulkBasicMutationResponseType(results=[i for i in queryset]) diff --git a/apps/questionnaire/tests/test_mutations.py b/apps/questionnaire/tests/test_mutations.py index ef6cd93..9a8398e 100644 --- a/apps/questionnaire/tests/test_mutations.py +++ b/apps/questionnaire/tests/test_mutations.py @@ -2,7 +2,7 @@ from apps.project.models import ProjectMembership from apps.project.factories import ProjectFactory -from apps.questionnaire.enums import QuestionLeafGroupVisibilityActionEnum +from apps.questionnaire.enums import VisibilityActionEnum from apps.questionnaire.models import ( Questionnaire, Question, @@ -181,45 +181,28 @@ def test_delete_questionnaire(self): ur_params = dict(created_by=user, modified_by=user) # Create some projects project, project2 = ProjectFactory.create_batch(2, **ur_params) - q1, q1_2 = QuestionnaireFactory.create_batch(2, **ur_params, project=project) + q1_1, q1_2 = QuestionnaireFactory.create_batch(2, **ur_params, project=project) q2 = QuestionnaireFactory.create(**ur_params, project=project2) # Create some questions, groups and choice collections - group1 = QuestionLeafGroupFactory.create( - **ur_params, - questionnaire=q1, - type=QuestionLeafGroup.Type.MATRIX_1D, - category_1=QuestionLeafGroup.Category1.CONTEXT, - category_2=QuestionLeafGroup.Category2.POLITICS, - ) - group1_2 = QuestionLeafGroupFactory.create( - **ur_params, - questionnaire=q1_2, - type=QuestionLeafGroup.Type.MATRIX_1D, - category_1=QuestionLeafGroup.Category1.CONTEXT, - category_2=QuestionLeafGroup.Category2.DEMOGRAPHY, - ) - group2 = QuestionLeafGroupFactory.create( - **ur_params, - questionnaire=q2, - type=QuestionLeafGroup.Type.MATRIX_1D, - category_1=QuestionLeafGroup.Category1.CONTEXT, - category_2=QuestionLeafGroup.Category2.POLITICS, - ) - # -- q1 - choice_collections = ChoiceCollectionFactory.create_batch(3, **ur_params, questionnaire=q1) - QuestionFactory.create_batch( - 2, **ur_params, questionnaire=q1, leaf_group=group1, choice_collection=choice_collections[0]) - QuestionFactory.create_batch( - 3, **ur_params, questionnaire=q1, leaf_group=group1, choice_collection=choice_collections[1]) - QuestionFactory.create_batch(3, **ur_params, questionnaire=q1, leaf_group=group1) - QuestionFactory.create_batch(3, **ur_params, questionnaire=q1_2, leaf_group=group1_2) + [group1_1_1] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q1_1) + [group1_2_1] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q1_2) + [group2_1] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q2) + # -- q1_1 + choice_collections = ChoiceCollectionFactory.create_batch(3, **ur_params, questionnaire=q1_1) + ChoiceCollectionFactory.create_batch(2, **ur_params, questionnaire=q1_2) + ChoiceCollectionFactory.create_batch(4, **ur_params, questionnaire=q2) + QuestionFactory.create_batch(2, **ur_params, leaf_group=group1_1_1, choice_collection=choice_collections[0]) + QuestionFactory.create_batch(3, **ur_params, leaf_group=group1_1_1, choice_collection=choice_collections[1]) + QuestionFactory.create_batch(8, **ur_params, leaf_group=group1_1_1) + # -- q1_2 + QuestionFactory.create_batch(6, **ur_params, leaf_group=group1_2_1) # -- q2 - QuestionFactory.create_batch(3, **ur_params, questionnaire=q1, leaf_group=group2) + QuestionFactory.create_batch(4, **ur_params, leaf_group=group2_1) # Without login variables = { 'projectId': self.gID(project.pk), - 'questionnaireId': self.gID(q1.pk), + 'questionnaireId': self.gID(q1_1.pk), } content = self.query_check(self.Mutation.QuestionnaireDelete, variables=variables, assert_errors=True) assert content['data'] is None @@ -230,9 +213,15 @@ def _get_counts(): 'questions': Question.objects.count(), 'choice_collections': ChoiceCollection.objects.count(), 'groups': QuestionLeafGroup.objects.count(), - 'questionnair': Questionnaire.objects.count(), + 'questionnaire': Questionnaire.objects.count(), } counts = _get_counts() + assert counts == { + 'questions': 23, + 'choice_collections': 9, + 'groups': 3, + 'questionnaire': 3, + } # With login # -- Without membership self.force_login(user) @@ -258,9 +247,9 @@ def _get_counts(): )['data']['private']['projectScope']['deleteQuestionnaire'] assert content['ok'] is True, content assert content['errors'] is None, content - counts['questions'] -= 11 + counts['questions'] -= 13 counts['choice_collections'] -= 3 - counts['questionnair'] -= 1 + counts['questionnaire'] -= 1 counts['groups'] -= 1 assert counts == _get_counts() @@ -272,8 +261,9 @@ def _get_counts(): )['data']['private']['projectScope']['deleteQuestionnaire'] assert content['ok'] is True, content assert content['errors'] is None, content - counts['questions'] -= 3 - counts['questionnair'] -= 1 + counts['questions'] -= 6 + counts['choice_collections'] -= 2 + counts['questionnaire'] -= 1 counts['groups'] -= 1 assert counts == _get_counts() @@ -350,6 +340,34 @@ class Mutation: } ''' + QuestionVisibilityUpdate = ''' + mutation MyMutation( + $projectId: ID!, + $questionnaireId: ID!, + $questionsId: [ID!]!, + $visibility: VisibilityActionEnum! + ) { + private { + id + projectScope(pk: $projectId) { + id + updateQuestionsVisibility( + ids: $questionsId, + questionnaireId: $questionnaireId, + visibility: $visibility + ) { + errors + results { + id + name + isHidden + } + } + } + } + } + ''' + def test_create_question(self): user = UserFactory.create() ur_params = dict(created_by=user, modified_by=user) @@ -449,9 +467,9 @@ def test_update_question(self): [group2] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q2) question_params = {**ur_params, 'type': Question.Type.INTEGER} - QuestionFactory.create(**question_params, questionnaire=q1, name='question_01', leaf_group=group1) - question12 = QuestionFactory.create(**question_params, questionnaire=q1, leaf_group=group1, name='question_02') - question2 = QuestionFactory.create(**question_params, questionnaire=q2, leaf_group=group2, name='question_01') + QuestionFactory.create(**question_params, name='question_01', leaf_group=group1) + question12 = QuestionFactory.create(**question_params, leaf_group=group1, name='question_02') + question2 = QuestionFactory.create(**question_params, leaf_group=group2, name='question_01') # Without login variables = { @@ -533,8 +551,8 @@ def test_delete_question(self): [group2] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q2) question_params = {**ur_params, 'type': Question.Type.INTEGER} - question1 = QuestionFactory.create(**question_params, questionnaire=q1, name='question_0101', leaf_group=group1) - question2 = QuestionFactory.create(**question_params, questionnaire=q2, name='question_0201', leaf_group=group2) + question1 = QuestionFactory.create(**question_params, name='question_0101', leaf_group=group1) + question2 = QuestionFactory.create(**question_params, name='question_0201', leaf_group=group2) # Without login variables = { @@ -577,6 +595,89 @@ def test_delete_question(self): assert_errors=True, ) + def test_question_visibility(self): + user = UserFactory.create() + ur_params = dict(created_by=user, modified_by=user) + # Create some projects + project, project2 = ProjectFactory.create_batch(2, **ur_params) + # Questionnaires + q1_1, q1_2 = QuestionnaireFactory.create_batch(2, **ur_params, project=project) + q2 = QuestionnaireFactory.create(**ur_params, project=project2) + # Leaf groups + [group1] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q1_1) + [group1_2] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q1_2) + [group2] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q2) + # Questions + ques1_1_1, ques1_1_2 = QuestionFactory.create_batch(2, **ur_params, leaf_group=group1) + ques1_2_1, ques1_2_2 = QuestionFactory.create_batch(2, **ur_params, leaf_group=group1_2) + ques2_2_1, ques2_2_2 = QuestionFactory.create_batch(2, **ur_params, leaf_group=group2) + # Without login + variables = { + 'projectId': self.gID(project.pk), + 'questionnaireId': self.gID(q1_1.pk), + 'questionsId': [ + # Invalid + self.gID(ques1_2_1.pk), + self.gID(ques1_2_2.pk), + self.gID(ques2_2_1.pk), + self.gID(ques2_2_2.pk), + ], + 'visibility': self.genum(VisibilityActionEnum.HIDE), + } + content = self.query_check(self.Mutation.QuestionVisibilityUpdate, variables=variables, assert_errors=True) + assert content['data'] is None + + # With login + # -- Without membership + self.force_login(user) + content = self.query_check(self.Mutation.QuestionVisibilityUpdate, variables=variables) + assert content['data']['private']['projectScope'] is None + + # -- With membership - But read access only + project.add_member(user, role=ProjectMembership.Role.VIEWER) + content = self.query_check( + self.Mutation.QuestionVisibilityUpdate, + variables=variables, + )['data']['private']['projectScope']['updateQuestionsVisibility'] + assert content['results'] is None, content + assert content['errors'] is not None, content + + # -- With membership - With write access + # -- Invalid question id + project.add_member(user, role=ProjectMembership.Role.MEMBER) + content = self.query_check( + self.Mutation.QuestionVisibilityUpdate, + variables=variables, + )['data']['private']['projectScope']['updateQuestionsVisibility'] + assert content['errors'] is None, content # Just empty response + assert content['results'] == [], content # Just empty response + + # -- Valid question id + variables['questionsId'] = [ + self.gID(ques1_1_1.pk), + self.gID(ques1_1_2.pk), + ] + for visibility, is_hidden_value in [ + (self.genum(VisibilityActionEnum.HIDE), True), + (self.genum(VisibilityActionEnum.SHOW), False), + ]: + variables['visibility'] = visibility + content = self.query_check( + self.Mutation.QuestionVisibilityUpdate, + variables=variables, + )['data']['private']['projectScope']['updateQuestionsVisibility'] + ques1_1_1.refresh_from_db() + ques1_1_2.refresh_from_db() + assert content['errors'] is None, content + assert set([ + d['id'] for d in content['results'] + ]) == set(variables['questionsId']), content + assert set([ + d['isHidden'] for d in content['results'] + ]) == {is_hidden_value}, content + assert ques1_1_1.is_hidden == is_hidden_value + assert ques1_1_2.is_hidden == is_hidden_value + class TestQuestionTypeMutation(TestCase): class Mutation: @@ -633,17 +734,22 @@ def _query_check(): class TestQuestionGroupMutation(TestCase): class Mutation: - QuestionLeafGroupVisiblityUpdate = ''' + QuestionLeafGroupVisibilityUpdate = ''' mutation MyMutation( $projectId: ID!, - $questionLeafGroupsID: [ID!]!, - $visibility: QuestionLeafGroupVisibilityActionEnum! + $questionnaireId: ID!, + $questionLeafGroupsId: [ID!]!, + $visibility: VisibilityActionEnum! ) { private { id projectScope(pk: $projectId) { id - updateQuestionGroupsLeafVisibility(ids: $questionLeafGroupsID, visibility: $visibility) { + updateQuestionGroupsLeafVisibility( + ids: $questionLeafGroupsId, + questionnaireId: $questionnaireId, + visibility: $visibility, + ) { errors results { id @@ -659,14 +765,14 @@ class Mutation: QuestionLeafGroupOrderBulkUpdate = ''' mutation MyMutation( $projectId: ID!, - $questionnairId: ID!, + $questionnaireId: ID!, $data: [QuestionLeafGroupOrderInputType!]! ) { private { id projectScope(pk: $projectId) { id - bulkUpdateQuestionnairQuestionGroupsLeafOrder(questionnaireId: $questionnairId, data: $data) { + bulkUpdateQuestionnairQuestionGroupsLeafOrder(questionnaireId: $questionnaireId, data: $data) { errors results { id @@ -684,31 +790,33 @@ def test_question_leaf_group_visibility(self): ur_params = dict(created_by=user, modified_by=user) # Create some projects project, project2 = ProjectFactory.create_batch(2, **ur_params) - q1 = QuestionnaireFactory.create(**ur_params, project=project) + q1, q1_2 = QuestionnaireFactory.create_batch(2, **ur_params, project=project) q2 = QuestionnaireFactory.create(**ur_params, project=project2) [group1] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q1) + [group1_2] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q1_2) [group2] = QuestionLeafGroupFactory.static_generator(1, **ur_params, questionnaire=q2) # Without login variables = { 'projectId': self.gID(project.pk), - 'questionLeafGroupsID': [self.gID(group2.pk)], - 'visibility': self.genum(QuestionLeafGroupVisibilityActionEnum.HIDE), + 'questionnaireId': self.gID(q1.pk), + 'questionLeafGroupsId': [self.gID(group2.pk), self.gID(group1_2.pk)], + 'visibility': self.genum(VisibilityActionEnum.HIDE), } - content = self.query_check(self.Mutation.QuestionLeafGroupVisiblityUpdate, variables=variables, assert_errors=True) + content = self.query_check(self.Mutation.QuestionLeafGroupVisibilityUpdate, variables=variables, assert_errors=True) assert content['data'] is None # With login # -- Without membership self.force_login(user) - content = self.query_check(self.Mutation.QuestionLeafGroupVisiblityUpdate, variables=variables) + content = self.query_check(self.Mutation.QuestionLeafGroupVisibilityUpdate, variables=variables) assert content['data']['private']['projectScope'] is None # -- With membership - But read access only project.add_member(user, role=ProjectMembership.Role.VIEWER) content = self.query_check( - self.Mutation.QuestionLeafGroupVisiblityUpdate, + self.Mutation.QuestionLeafGroupVisibilityUpdate, variables=variables, )['data']['private']['projectScope']['updateQuestionGroupsLeafVisibility'] assert content['results'] is None, content @@ -718,28 +826,28 @@ def test_question_leaf_group_visibility(self): # -- Invalid question leaf group id project.add_member(user, role=ProjectMembership.Role.MEMBER) content = self.query_check( - self.Mutation.QuestionLeafGroupVisiblityUpdate, + self.Mutation.QuestionLeafGroupVisibilityUpdate, variables=variables, )['data']['private']['projectScope']['updateQuestionGroupsLeafVisibility'] assert content['errors'] is None, content # Just empty response assert content['results'] == [], content # Just empty response # -- Valid question leaf group id - variables['questionLeafGroupsID'] = [self.gID(group1.pk)] + variables['questionLeafGroupsId'] = [self.gID(group1.pk)] for visibility, is_hidden_value in [ - (self.genum(QuestionLeafGroupVisibilityActionEnum.HIDE), True), - (self.genum(QuestionLeafGroupVisibilityActionEnum.SHOW), False), + (self.genum(VisibilityActionEnum.HIDE), True), + (self.genum(VisibilityActionEnum.SHOW), False), ]: variables['visibility'] = visibility content = self.query_check( - self.Mutation.QuestionLeafGroupVisiblityUpdate, + self.Mutation.QuestionLeafGroupVisibilityUpdate, variables=variables, )['data']['private']['projectScope']['updateQuestionGroupsLeafVisibility'] group1.refresh_from_db() assert content['errors'] is None, content assert set([ d['id'] for d in content['results'] - ]) == set(variables['questionLeafGroupsID']), content + ]) == set(variables['questionLeafGroupsId']), content assert set([ d['isHidden'] for d in content['results'] ]) == {is_hidden_value}, content @@ -772,7 +880,7 @@ def test_question_leaf_group_order_update(self): # Without login variables = { 'projectId': self.gID(project.pk), - 'questionnairId': self.gID(q1_1.pk), + 'questionnaireId': self.gID(q1_1.pk), 'data': [ { 'id': self.gID(group.pk), @@ -782,10 +890,10 @@ def test_question_leaf_group_order_update(self): # Valid groups *valid_group_order_set, # Invalid groups - # -- Another questionnair + # -- Another questionnaire (group1_2_1, 1001), (group1_2_2, 1001), - # -- Another questionnair another project + # -- Another questionnaire another project (group2_1_1, 1001), (group2_1_2, 1001), ) diff --git a/apps/questionnaire/types.py b/apps/questionnaire/types.py index e925ab7..9d2f9a8 100644 --- a/apps/questionnaire/types.py +++ b/apps/questionnaire/types.py @@ -128,6 +128,7 @@ class QuestionType(UserResourceTypeMixin): name: strawberry.auto label: strawberry.auto hint: strawberry.auto + is_hidden: strawberry.auto default: strawberry.auto guidance_hint: strawberry.auto diff --git a/schema.graphql b/schema.graphql index 47091ea..6876d15 100644 --- a/schema.graphql +++ b/schema.graphql @@ -181,7 +181,8 @@ type ProjectScopeMutation { updateQuestion(id: ID!, data: QuestionUpdateInput!): QuestionTypeMutationResponseType! deleteQuestion(id: ID!): QuestionTypeMutationResponseType! bulkUpdateQuestionnairQuestionGroupsLeafOrder(questionnaireId: ID!, data: [QuestionLeafGroupOrderInputType!]!): QuestionLeafGroupTypeBulkBasicMutationResponseType! - updateQuestionGroupsLeafVisibility(ids: [ID!]!, visibility: QuestionLeafGroupVisibilityActionEnum!): QuestionLeafGroupTypeBulkBasicMutationResponseType! + updateQuestionGroupsLeafVisibility(questionnaireId: ID!, ids: [ID!]!, visibility: VisibilityActionEnum!): QuestionLeafGroupTypeBulkBasicMutationResponseType! + updateQuestionsVisibility(questionnaireId: ID!, ids: [ID!]!, visibility: VisibilityActionEnum!): QuestionTypeBulkBasicMutationResponseType! createQuestionChoiceCollection(data: QuestionChoiceCollectionCreateInput!): QuestionChoiceCollectionTypeMutationResponseType! updateQuestionChoiceCollection(id: ID!, data: QuestionChoiceCollectionUpdateInput!): QuestionChoiceCollectionTypeMutationResponseType! deleteQuestionChoiceCollection(id: ID!): QuestionChoiceCollectionTypeMutationResponseType! @@ -357,7 +358,7 @@ input QuestionFilter { name: StrFilterLookup label: StrFilterLookup leafGroup: DjangoModelFilterInput - includeChildGroup: Boolean = false + isHidden: Boolean } enum QuestionLeafGroupCategory1TypeEnum { @@ -505,11 +506,6 @@ enum QuestionLeafGroupTypeEnum { MATRIX_2D } -enum QuestionLeafGroupVisibilityActionEnum { - SHOW - HIDE -} - input QuestionOrder { id: Ordering createdAt: Ordering @@ -522,6 +518,7 @@ type QuestionType { name: String! label: String! hint: String! + isHidden: Boolean! default: String! guidanceHint: String! trigger: String! @@ -547,6 +544,11 @@ type QuestionType { typeDisplay: String! } +type QuestionTypeBulkBasicMutationResponseType { + errors: [CustomErrorType!] + results: [QuestionType!] +} + type QuestionTypeCountList { limit: Int! offset: Int! @@ -721,4 +723,9 @@ type UserTypeCountList { offset: Int! count: Int! items: [UserType!]! +} + +enum VisibilityActionEnum { + SHOW + HIDE } \ No newline at end of file