From 2fdae7c1207a00f4844f21927938aa5db8ebf2dc Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Wed, 28 Jun 2023 19:35:20 +0200 Subject: [PATCH] Use different naming convention for GraphQL types --- client/src/gql/graphql.ts | 34 +++++++++---------- client/src/gql/schema.graphql | 12 +++---- .../assignment/graphql/mutations.py | 4 +-- .../assignment/graphql/queries.py | 8 ++--- .../vbv_lernwelt/assignment/graphql/types.py | 4 +-- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/client/src/gql/graphql.ts b/client/src/gql/graphql.ts index 204397e4..6f9da652 100644 --- a/client/src/gql/graphql.ts +++ b/client/src/gql/graphql.ts @@ -56,20 +56,13 @@ export type AssignmentAssignmentCompletionCompletionStatusChoices = export type AssignmentCompletionMutation = { __typename?: 'AssignmentCompletionMutation'; - assignment_completion?: Maybe; + assignment_completion?: Maybe; }; -/** An enumeration. */ -export type AssignmentCompletionStatus = - | 'EVALUATION_IN_PROGRESS' - | 'EVALUATION_SUBMITTED' - | 'IN_PROGRESS' - | 'SUBMITTED'; - -export type AssignmentCompletionType = { - __typename?: 'AssignmentCompletionType'; +export type AssignmentCompletionObjectType = { + __typename?: 'AssignmentCompletionObjectType'; additional_json_data: Scalars['JSONString']; - assignment: AssignmentType; + assignment: AssignmentObjectType; assignment_user: UserType; completion_data?: Maybe; completion_status: AssignmentAssignmentCompletionCompletionStatusChoices; @@ -83,8 +76,15 @@ export type AssignmentCompletionType = { updated_at: Scalars['DateTime']; }; -export type AssignmentType = CoursePageInterface & { - __typename?: 'AssignmentType'; +/** An enumeration. */ +export type AssignmentCompletionStatus = + | 'EVALUATION_IN_PROGRESS' + | 'EVALUATION_SUBMITTED' + | 'IN_PROGRESS' + | 'SUBMITTED'; + +export type AssignmentObjectType = CoursePageInterface & { + __typename?: 'AssignmentObjectType'; assignment_type: AssignmentAssignmentAssignmentTypeChoices; content_type?: Maybe; /** Zeitaufwand als Text */ @@ -211,8 +211,8 @@ export type Node = { export type Query = { __typename?: 'Query'; - assignment?: Maybe; - assignment_completion?: Maybe; + assignment?: Maybe; + assignment_completion?: Maybe; course?: Maybe; }; @@ -279,7 +279,7 @@ export type UpsertAssignmentCompletionMutationVariables = Exact<{ }>; -export type UpsertAssignmentCompletionMutation = { __typename?: 'Mutation', upsert_assignment_completion?: { __typename?: 'AssignmentCompletionMutation', assignment_completion?: { __typename?: 'AssignmentCompletionType', id: string, completion_status: AssignmentAssignmentCompletionCompletionStatusChoices, submitted_at?: any | null, evaluation_submitted_at?: any | null, evaluation_grade?: number | null, evaluation_points?: number | null, completion_data?: any | null } | null } | null }; +export type UpsertAssignmentCompletionMutation = { __typename?: 'Mutation', upsert_assignment_completion?: { __typename?: 'AssignmentCompletionMutation', assignment_completion?: { __typename?: 'AssignmentCompletionObjectType', id: string, completion_status: AssignmentAssignmentCompletionCompletionStatusChoices, submitted_at?: any | null, evaluation_submitted_at?: any | null, evaluation_grade?: number | null, evaluation_points?: number | null, completion_data?: any | null } | null } | null }; export type AssignmentCompletionQueryQueryVariables = Exact<{ assignmentId: Scalars['ID']; @@ -288,7 +288,7 @@ export type AssignmentCompletionQueryQueryVariables = Exact<{ }>; -export type AssignmentCompletionQueryQuery = { __typename?: 'Query', assignment?: { __typename?: 'AssignmentType', assignment_type: AssignmentAssignmentAssignmentTypeChoices, content_type?: string | null, effort_required: string, evaluation_description: string, evaluation_document_url: string, evaluation_tasks?: any | null, id?: string | null, intro_text: string, performance_objectives?: any | null, slug?: string | null, tasks?: any | null, title?: string | null, translation_key?: string | null } | null, assignment_completion?: { __typename?: 'AssignmentCompletionType', id: string, completion_status: AssignmentAssignmentCompletionCompletionStatusChoices, submitted_at?: any | null, evaluation_submitted_at?: any | null, evaluation_grade?: number | null, evaluation_points?: number | null, completion_data?: any | null, evaluation_user?: { __typename?: 'UserType', id: string } | null, assignment_user: { __typename?: 'UserType', id: string } } | null }; +export type AssignmentCompletionQueryQuery = { __typename?: 'Query', assignment?: { __typename?: 'AssignmentObjectType', assignment_type: AssignmentAssignmentAssignmentTypeChoices, content_type?: string | null, effort_required: string, evaluation_description: string, evaluation_document_url: string, evaluation_tasks?: any | null, id?: string | null, intro_text: string, performance_objectives?: any | null, slug?: string | null, tasks?: any | null, title?: string | null, translation_key?: string | null } | null, assignment_completion?: { __typename?: 'AssignmentCompletionObjectType', id: string, completion_status: AssignmentAssignmentCompletionCompletionStatusChoices, submitted_at?: any | null, evaluation_submitted_at?: any | null, evaluation_grade?: number | null, evaluation_points?: number | null, completion_data?: any | null, evaluation_user?: { __typename?: 'UserType', id: string } | null, assignment_user: { __typename?: 'UserType', id: string } } | null }; export type CourseQueryQueryVariables = Exact<{ courseId: Scalars['Int']; diff --git a/client/src/gql/schema.graphql b/client/src/gql/schema.graphql index c381bea3..ab93d32e 100644 --- a/client/src/gql/schema.graphql +++ b/client/src/gql/schema.graphql @@ -1,7 +1,7 @@ type Query { course(id: Int): CourseType - assignment(id: ID, slug: String): AssignmentType - assignment_completion(assignment_id: ID!, course_session_id: ID!, assignment_user_id: ID): AssignmentCompletionType + assignment(id: ID, slug: String): AssignmentObjectType + assignment_completion(assignment_id: ID!, course_session_id: ID!, assignment_user_id: ID): AssignmentCompletionObjectType } type CourseType { @@ -96,7 +96,7 @@ enum CoreUserLanguageChoices { IT } -type AssignmentType implements CoursePageInterface { +type AssignmentObjectType implements CoursePageInterface { assignment_type: AssignmentAssignmentAssignmentTypeChoices! """Erläuterung der Ausgangslage""" @@ -136,7 +136,7 @@ enum AssignmentAssignmentAssignmentTypeChoices { scalar JSONStreamField -type AssignmentCompletionType { +type AssignmentCompletionObjectType { id: ID! created_at: DateTime! updated_at: DateTime! @@ -146,7 +146,7 @@ type AssignmentCompletionType { evaluation_grade: Float evaluation_points: Float assignment_user: UserType! - assignment: AssignmentType! + assignment: AssignmentObjectType! completion_status: AssignmentAssignmentCompletionCompletionStatusChoices! completion_data: GenericScalar additional_json_data: JSONString! @@ -221,7 +221,7 @@ input SendFeedbackInput { } type AssignmentCompletionMutation { - assignment_completion: AssignmentCompletionType + assignment_completion: AssignmentCompletionObjectType } """An enumeration.""" diff --git a/server/vbv_lernwelt/assignment/graphql/mutations.py b/server/vbv_lernwelt/assignment/graphql/mutations.py index 632c04c5..edb4145b 100644 --- a/server/vbv_lernwelt/assignment/graphql/mutations.py +++ b/server/vbv_lernwelt/assignment/graphql/mutations.py @@ -4,7 +4,7 @@ import graphene import structlog from rest_framework.exceptions import PermissionDenied -from vbv_lernwelt.assignment.graphql.types import AssignmentCompletionType +from vbv_lernwelt.assignment.graphql.types import AssignmentCompletionObjectType from vbv_lernwelt.assignment.models import Assignment, AssignmentCompletionStatus from vbv_lernwelt.assignment.services import update_assignment_completion from vbv_lernwelt.core.models import User @@ -15,7 +15,7 @@ logger = structlog.get_logger(__name__) class AssignmentCompletionMutation(graphene.Mutation): - assignment_completion = graphene.Field(AssignmentCompletionType) + assignment_completion = graphene.Field(AssignmentCompletionObjectType) class Arguments: assignment_id = graphene.ID(required=True) diff --git a/server/vbv_lernwelt/assignment/graphql/queries.py b/server/vbv_lernwelt/assignment/graphql/queries.py index f7847844..cb68a509 100644 --- a/server/vbv_lernwelt/assignment/graphql/queries.py +++ b/server/vbv_lernwelt/assignment/graphql/queries.py @@ -2,8 +2,8 @@ import graphene from rest_framework.exceptions import PermissionDenied from vbv_lernwelt.assignment.graphql.types import ( - AssignmentCompletionType, - AssignmentType, + AssignmentCompletionObjectType, + AssignmentObjectType, ) from vbv_lernwelt.assignment.models import Assignment, AssignmentCompletion from vbv_lernwelt.course.graphql.types import resolve_course_page @@ -13,14 +13,14 @@ from vbv_lernwelt.course.permissions import has_course_access, is_course_session class AssignmentQuery(object): assignment = graphene.Field( - AssignmentType, id=graphene.ID(), slug=graphene.String() + AssignmentObjectType, id=graphene.ID(), slug=graphene.String() ) def resolve_assignment(root, info, id=None, slug=None): return resolve_course_page(Assignment, root, info, id=id, slug=slug) assignment_completion = graphene.Field( - AssignmentCompletionType, + AssignmentCompletionObjectType, assignment_id=graphene.ID(required=True), course_session_id=graphene.ID(required=True), assignment_user_id=graphene.ID(required=False), diff --git a/server/vbv_lernwelt/assignment/graphql/types.py b/server/vbv_lernwelt/assignment/graphql/types.py index 9d33971b..4c50016b 100644 --- a/server/vbv_lernwelt/assignment/graphql/types.py +++ b/server/vbv_lernwelt/assignment/graphql/types.py @@ -6,7 +6,7 @@ from vbv_lernwelt.core.graphql.types import JSONStreamField from vbv_lernwelt.course.schema import CoursePageInterface -class AssignmentType(DjangoObjectType): +class AssignmentObjectType(DjangoObjectType): tasks = JSONStreamField() evaluation_tasks = JSONStreamField() performance_objectives = JSONStreamField() @@ -23,7 +23,7 @@ class AssignmentType(DjangoObjectType): ) -class AssignmentCompletionType(DjangoObjectType): +class AssignmentCompletionObjectType(DjangoObjectType): completion_data = GenericScalar() class Meta: