Use different naming convention for GraphQL types

This commit is contained in:
Daniel Egger 2023-06-28 19:35:20 +02:00
parent df13e99d6f
commit 2fdae7c120
5 changed files with 31 additions and 31 deletions

View File

@ -56,20 +56,13 @@ export type AssignmentAssignmentCompletionCompletionStatusChoices =
export type AssignmentCompletionMutation = { export type AssignmentCompletionMutation = {
__typename?: 'AssignmentCompletionMutation'; __typename?: 'AssignmentCompletionMutation';
assignment_completion?: Maybe<AssignmentCompletionType>; assignment_completion?: Maybe<AssignmentCompletionObjectType>;
}; };
/** An enumeration. */ export type AssignmentCompletionObjectType = {
export type AssignmentCompletionStatus = __typename?: 'AssignmentCompletionObjectType';
| 'EVALUATION_IN_PROGRESS'
| 'EVALUATION_SUBMITTED'
| 'IN_PROGRESS'
| 'SUBMITTED';
export type AssignmentCompletionType = {
__typename?: 'AssignmentCompletionType';
additional_json_data: Scalars['JSONString']; additional_json_data: Scalars['JSONString'];
assignment: AssignmentType; assignment: AssignmentObjectType;
assignment_user: UserType; assignment_user: UserType;
completion_data?: Maybe<Scalars['GenericScalar']>; completion_data?: Maybe<Scalars['GenericScalar']>;
completion_status: AssignmentAssignmentCompletionCompletionStatusChoices; completion_status: AssignmentAssignmentCompletionCompletionStatusChoices;
@ -83,8 +76,15 @@ export type AssignmentCompletionType = {
updated_at: Scalars['DateTime']; updated_at: Scalars['DateTime'];
}; };
export type AssignmentType = CoursePageInterface & { /** An enumeration. */
__typename?: 'AssignmentType'; export type AssignmentCompletionStatus =
| 'EVALUATION_IN_PROGRESS'
| 'EVALUATION_SUBMITTED'
| 'IN_PROGRESS'
| 'SUBMITTED';
export type AssignmentObjectType = CoursePageInterface & {
__typename?: 'AssignmentObjectType';
assignment_type: AssignmentAssignmentAssignmentTypeChoices; assignment_type: AssignmentAssignmentAssignmentTypeChoices;
content_type?: Maybe<Scalars['String']>; content_type?: Maybe<Scalars['String']>;
/** Zeitaufwand als Text */ /** Zeitaufwand als Text */
@ -211,8 +211,8 @@ export type Node = {
export type Query = { export type Query = {
__typename?: 'Query'; __typename?: 'Query';
assignment?: Maybe<AssignmentType>; assignment?: Maybe<AssignmentObjectType>;
assignment_completion?: Maybe<AssignmentCompletionType>; assignment_completion?: Maybe<AssignmentCompletionObjectType>;
course?: Maybe<CourseType>; course?: Maybe<CourseType>;
}; };
@ -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<{ export type AssignmentCompletionQueryQueryVariables = Exact<{
assignmentId: Scalars['ID']; 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<{ export type CourseQueryQueryVariables = Exact<{
courseId: Scalars['Int']; courseId: Scalars['Int'];

View File

@ -1,7 +1,7 @@
type Query { type Query {
course(id: Int): CourseType course(id: Int): CourseType
assignment(id: ID, slug: String): AssignmentType assignment(id: ID, slug: String): AssignmentObjectType
assignment_completion(assignment_id: ID!, course_session_id: ID!, assignment_user_id: ID): AssignmentCompletionType assignment_completion(assignment_id: ID!, course_session_id: ID!, assignment_user_id: ID): AssignmentCompletionObjectType
} }
type CourseType { type CourseType {
@ -96,7 +96,7 @@ enum CoreUserLanguageChoices {
IT IT
} }
type AssignmentType implements CoursePageInterface { type AssignmentObjectType implements CoursePageInterface {
assignment_type: AssignmentAssignmentAssignmentTypeChoices! assignment_type: AssignmentAssignmentAssignmentTypeChoices!
"""Erläuterung der Ausgangslage""" """Erläuterung der Ausgangslage"""
@ -136,7 +136,7 @@ enum AssignmentAssignmentAssignmentTypeChoices {
scalar JSONStreamField scalar JSONStreamField
type AssignmentCompletionType { type AssignmentCompletionObjectType {
id: ID! id: ID!
created_at: DateTime! created_at: DateTime!
updated_at: DateTime! updated_at: DateTime!
@ -146,7 +146,7 @@ type AssignmentCompletionType {
evaluation_grade: Float evaluation_grade: Float
evaluation_points: Float evaluation_points: Float
assignment_user: UserType! assignment_user: UserType!
assignment: AssignmentType! assignment: AssignmentObjectType!
completion_status: AssignmentAssignmentCompletionCompletionStatusChoices! completion_status: AssignmentAssignmentCompletionCompletionStatusChoices!
completion_data: GenericScalar completion_data: GenericScalar
additional_json_data: JSONString! additional_json_data: JSONString!
@ -221,7 +221,7 @@ input SendFeedbackInput {
} }
type AssignmentCompletionMutation { type AssignmentCompletionMutation {
assignment_completion: AssignmentCompletionType assignment_completion: AssignmentCompletionObjectType
} }
"""An enumeration.""" """An enumeration."""

View File

@ -4,7 +4,7 @@ import graphene
import structlog import structlog
from rest_framework.exceptions import PermissionDenied 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.models import Assignment, AssignmentCompletionStatus
from vbv_lernwelt.assignment.services import update_assignment_completion from vbv_lernwelt.assignment.services import update_assignment_completion
from vbv_lernwelt.core.models import User from vbv_lernwelt.core.models import User
@ -15,7 +15,7 @@ logger = structlog.get_logger(__name__)
class AssignmentCompletionMutation(graphene.Mutation): class AssignmentCompletionMutation(graphene.Mutation):
assignment_completion = graphene.Field(AssignmentCompletionType) assignment_completion = graphene.Field(AssignmentCompletionObjectType)
class Arguments: class Arguments:
assignment_id = graphene.ID(required=True) assignment_id = graphene.ID(required=True)

View File

@ -2,8 +2,8 @@ import graphene
from rest_framework.exceptions import PermissionDenied from rest_framework.exceptions import PermissionDenied
from vbv_lernwelt.assignment.graphql.types import ( from vbv_lernwelt.assignment.graphql.types import (
AssignmentCompletionType, AssignmentCompletionObjectType,
AssignmentType, AssignmentObjectType,
) )
from vbv_lernwelt.assignment.models import Assignment, AssignmentCompletion from vbv_lernwelt.assignment.models import Assignment, AssignmentCompletion
from vbv_lernwelt.course.graphql.types import resolve_course_page 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): class AssignmentQuery(object):
assignment = graphene.Field( 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): def resolve_assignment(root, info, id=None, slug=None):
return resolve_course_page(Assignment, root, info, id=id, slug=slug) return resolve_course_page(Assignment, root, info, id=id, slug=slug)
assignment_completion = graphene.Field( assignment_completion = graphene.Field(
AssignmentCompletionType, AssignmentCompletionObjectType,
assignment_id=graphene.ID(required=True), assignment_id=graphene.ID(required=True),
course_session_id=graphene.ID(required=True), course_session_id=graphene.ID(required=True),
assignment_user_id=graphene.ID(required=False), assignment_user_id=graphene.ID(required=False),

View File

@ -6,7 +6,7 @@ from vbv_lernwelt.core.graphql.types import JSONStreamField
from vbv_lernwelt.course.schema import CoursePageInterface from vbv_lernwelt.course.schema import CoursePageInterface
class AssignmentType(DjangoObjectType): class AssignmentObjectType(DjangoObjectType):
tasks = JSONStreamField() tasks = JSONStreamField()
evaluation_tasks = JSONStreamField() evaluation_tasks = JSONStreamField()
performance_objectives = JSONStreamField() performance_objectives = JSONStreamField()
@ -23,7 +23,7 @@ class AssignmentType(DjangoObjectType):
) )
class AssignmentCompletionType(DjangoObjectType): class AssignmentCompletionObjectType(DjangoObjectType):
completion_data = GenericScalar() completion_data = GenericScalar()
class Meta: class Meta: