Play with generated graphql code

This commit is contained in:
Daniel Egger 2023-06-28 18:47:55 +02:00
parent 9860a59cef
commit df13e99d6f
7 changed files with 163 additions and 176 deletions

View File

@ -16,6 +16,13 @@ const config: CodegenConfig = {
plugins: [],
},
},
config: {
enumsAsTypes: true,
namingConvention: {
typeNames: "change-case-all#pascalCase",
enumValues: "change-case-all#upperCase",
},
},
};
export default config;

View File

@ -1,13 +1,11 @@
import type { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
import type { FragmentDefinitionNode } from 'graphql';
import type { Incremental } from './graphql';
import type { ResultOf, TypedDocumentNode as DocumentNode, } from '@graphql-typed-document-node/core';
export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<
export type FragmentType<TDocumentType extends DocumentNode<any, any>> = TDocumentType extends DocumentNode<
infer TType,
any
>
? [TType] extends [{ ' $fragmentName'?: infer TKey }]
? TType extends { ' $fragmentName'?: infer TKey }
? TKey extends string
? { ' $fragmentRefs'?: { [key in TKey]: TType } }
: never
@ -16,51 +14,35 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
_documentNode: DocumentNode<TType, any>,
fragmentType: FragmentType<DocumentNode<TType, any>>
): TType;
// return nullable if `fragmentType` is nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
_documentNode: DocumentNode<TType, any>,
fragmentType: FragmentType<DocumentNode<TType, any>> | null | undefined
): TType | null | undefined;
// return array of non-nullable if `fragmentType` is array of non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
_documentNode: DocumentNode<TType, any>,
fragmentType: ReadonlyArray<FragmentType<DocumentNode<TType, any>>>
): ReadonlyArray<TType>;
// return array of nullable if `fragmentType` is array of nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
_documentNode: DocumentNode<TType, any>,
fragmentType: ReadonlyArray<FragmentType<DocumentNode<TType, any>>> | null | undefined
): ReadonlyArray<TType> | null | undefined;
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
_documentNode: DocumentNode<TType, any>,
fragmentType: FragmentType<DocumentNode<TType, any>> | ReadonlyArray<FragmentType<DocumentNode<TType, any>>> | null | undefined
): TType | ReadonlyArray<TType> | null | undefined {
return fragmentType as any;
}
export function makeFragmentData<
F extends DocumentTypeDecoration<any, any>,
F extends DocumentNode,
FT extends ResultOf<F>
>(data: FT, _fragment: F): FragmentType<F> {
return data as FragmentType<F>;
}
export function isFragmentReady<TQuery, TFrag>(
queryNode: DocumentTypeDecoration<TQuery, any>,
fragmentNode: TypedDocumentNode<TFrag>,
data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined
): data is FragmentType<typeof fragmentNode> {
const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__
?.deferredFields;
if (!deferredFields) return true;
const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;
const fragName = fragDef?.name?.value;
const fields = (fragName && deferredFields[fragName]) || [];
return fields.length > 0 && fields.every(field => data && field in data);
}
}

View File

@ -10,11 +10,11 @@ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-
* 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
* 3. It does not support dead code elimination, so it will add unused operations.
*
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Therefore it is highly recommended to use the babel-plugin for production.
*/
const documents = {
"\n mutation SendFeedbackMutation($input: SendFeedbackInput!) {\n send_feedback(input: $input) {\n feedback_response {\n id\n }\n errors {\n field\n messages\n }\n }\n }\n": types.SendFeedbackMutationDocument,
"\n mutation UpsertAssignmentCompletion(\n $assignmentId: ID!\n $courseSessionId: ID!\n $assignmentUserId: ID\n $completionStatus: String!\n $completionDataString: String!\n $evaluationGrade: Float\n $evaluationPoints: Float\n ) {\n upsert_assignment_completion(\n assignment_id: $assignmentId\n course_session_id: $courseSessionId\n assignment_user_id: $assignmentUserId\n completion_status: $completionStatus\n completion_data_string: $completionDataString\n evaluation_grade: $evaluationGrade\n evaluation_points: $evaluationPoints\n ) {\n assignment_completion {\n id\n completion_status\n submitted_at\n evaluation_submitted_at\n evaluation_grade\n evaluation_points\n completion_data\n }\n }\n }\n": types.UpsertAssignmentCompletionDocument,
"\n mutation UpsertAssignmentCompletion(\n $assignmentId: ID!\n $courseSessionId: ID!\n $assignmentUserId: ID\n $completionStatus: AssignmentCompletionStatus!\n $completionDataString: String!\n $evaluationGrade: Float\n $evaluationPoints: Float\n ) {\n upsert_assignment_completion(\n assignment_id: $assignmentId\n course_session_id: $courseSessionId\n assignment_user_id: $assignmentUserId\n completion_status: $completionStatus\n completion_data_string: $completionDataString\n evaluation_grade: $evaluationGrade\n evaluation_points: $evaluationPoints\n ) {\n assignment_completion {\n id\n completion_status\n submitted_at\n evaluation_submitted_at\n evaluation_grade\n evaluation_points\n completion_data\n }\n }\n }\n": types.UpsertAssignmentCompletionDocument,
"\n query assignmentCompletionQuery(\n $assignmentId: ID!\n $courseSessionId: ID!\n $assignmentUserId: ID\n ) {\n assignment(id: $assignmentId) {\n assignment_type\n content_type\n effort_required\n evaluation_description\n evaluation_document_url\n evaluation_tasks\n id\n intro_text\n performance_objectives\n slug\n tasks\n title\n translation_key\n }\n assignment_completion(\n assignment_id: $assignmentId\n course_session_id: $courseSessionId\n assignment_user_id: $assignmentUserId\n ) {\n id\n completion_status\n submitted_at\n evaluation_submitted_at\n evaluation_user {\n id\n }\n assignment_user {\n id\n }\n evaluation_grade\n evaluation_points\n completion_data\n }\n }\n": types.AssignmentCompletionQueryDocument,
"\n query courseQuery($courseId: Int!) {\n course(id: $courseId) {\n id\n slug\n title\n category_name\n learning_path {\n id\n }\n }\n }\n": types.CourseQueryDocument,
};
@ -25,7 +25,7 @@ const documents = {
*
* @example
* ```ts
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
* ```
*
* The query argument is unknown!
@ -40,7 +40,7 @@ export function graphql(source: "\n mutation SendFeedbackMutation($input: SendF
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n mutation UpsertAssignmentCompletion(\n $assignmentId: ID!\n $courseSessionId: ID!\n $assignmentUserId: ID\n $completionStatus: String!\n $completionDataString: String!\n $evaluationGrade: Float\n $evaluationPoints: Float\n ) {\n upsert_assignment_completion(\n assignment_id: $assignmentId\n course_session_id: $courseSessionId\n assignment_user_id: $assignmentUserId\n completion_status: $completionStatus\n completion_data_string: $completionDataString\n evaluation_grade: $evaluationGrade\n evaluation_points: $evaluationPoints\n ) {\n assignment_completion {\n id\n completion_status\n submitted_at\n evaluation_submitted_at\n evaluation_grade\n evaluation_points\n completion_data\n }\n }\n }\n"): (typeof documents)["\n mutation UpsertAssignmentCompletion(\n $assignmentId: ID!\n $courseSessionId: ID!\n $assignmentUserId: ID\n $completionStatus: String!\n $completionDataString: String!\n $evaluationGrade: Float\n $evaluationPoints: Float\n ) {\n upsert_assignment_completion(\n assignment_id: $assignmentId\n course_session_id: $courseSessionId\n assignment_user_id: $assignmentUserId\n completion_status: $completionStatus\n completion_data_string: $completionDataString\n evaluation_grade: $evaluationGrade\n evaluation_points: $evaluationPoints\n ) {\n assignment_completion {\n id\n completion_status\n submitted_at\n evaluation_submitted_at\n evaluation_grade\n evaluation_points\n completion_data\n }\n }\n }\n"];
export function graphql(source: "\n mutation UpsertAssignmentCompletion(\n $assignmentId: ID!\n $courseSessionId: ID!\n $assignmentUserId: ID\n $completionStatus: AssignmentCompletionStatus!\n $completionDataString: String!\n $evaluationGrade: Float\n $evaluationPoints: Float\n ) {\n upsert_assignment_completion(\n assignment_id: $assignmentId\n course_session_id: $courseSessionId\n assignment_user_id: $assignmentUserId\n completion_status: $completionStatus\n completion_data_string: $completionDataString\n evaluation_grade: $evaluationGrade\n evaluation_points: $evaluationPoints\n ) {\n assignment_completion {\n id\n completion_status\n submitted_at\n evaluation_submitted_at\n evaluation_grade\n evaluation_points\n completion_data\n }\n }\n }\n"): (typeof documents)["\n mutation UpsertAssignmentCompletion(\n $assignmentId: ID!\n $courseSessionId: ID!\n $assignmentUserId: ID\n $completionStatus: AssignmentCompletionStatus!\n $completionDataString: String!\n $evaluationGrade: Float\n $evaluationPoints: Float\n ) {\n upsert_assignment_completion(\n assignment_id: $assignmentId\n course_session_id: $courseSessionId\n assignment_user_id: $assignmentUserId\n completion_status: $completionStatus\n completion_data_string: $completionDataString\n evaluation_grade: $evaluationGrade\n evaluation_points: $evaluationPoints\n ) {\n assignment_completion {\n id\n completion_status\n submitted_at\n evaluation_submitted_at\n evaluation_grade\n evaluation_points\n completion_data\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/

View File

@ -5,178 +5,180 @@ export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: { input: string; output: string; }
String: { input: string; output: string; }
Boolean: { input: boolean; output: boolean; }
Int: { input: number; output: number; }
Float: { input: number; output: number; }
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
/**
* The `DateTime` scalar type represents a DateTime
* value as specified by
* [iso8601](https://en.wikipedia.org/wiki/ISO_8601).
*/
DateTime: { input: any; output: any; }
DateTime: any;
/**
* The `GenericScalar` scalar type represents a generic
* GraphQL scalar value that could be:
* String, Boolean, Int, Float, List or Object.
*/
GenericScalar: { input: any; output: any; }
JSONStreamField: { input: any; output: any; }
GenericScalar: any;
JSONStreamField: any;
/**
* Allows use of a JSON String for input / output from the GraphQL schema.
*
* Use of this type is *not recommended* as you lose the benefits of having a defined, static
* schema (one of the key benefits of GraphQL).
*/
JSONString: { input: any; output: any; }
JSONString: any;
};
/** An enumeration. */
export enum AssignmentAssignmentAssignmentTypeChoices {
export type AssignmentAssignmentAssignmentTypeChoices =
/** CASEWORK */
Casework = 'CASEWORK',
| 'CASEWORK'
/** PREP_ASSIGNMENT */
PrepAssignment = 'PREP_ASSIGNMENT',
| 'PREP_ASSIGNMENT'
/** REFLECTION */
Reflection = 'REFLECTION'
}
| 'REFLECTION';
/** An enumeration. */
export enum AssignmentAssignmentCompletionCompletionStatusChoices {
export type AssignmentAssignmentCompletionCompletionStatusChoices =
/** EVALUATION_IN_PROGRESS */
EvaluationInProgress = 'EVALUATION_IN_PROGRESS',
| 'EVALUATION_IN_PROGRESS'
/** EVALUATION_SUBMITTED */
EvaluationSubmitted = 'EVALUATION_SUBMITTED',
| 'EVALUATION_SUBMITTED'
/** IN_PROGRESS */
InProgress = 'IN_PROGRESS',
| 'IN_PROGRESS'
/** SUBMITTED */
Submitted = 'SUBMITTED'
}
| 'SUBMITTED';
export type AssignmentCompletionMutation = {
__typename?: 'AssignmentCompletionMutation';
assignment_completion?: Maybe<AssignmentCompletionType>;
};
/** An enumeration. */
export type AssignmentCompletionStatus =
| 'EVALUATION_IN_PROGRESS'
| 'EVALUATION_SUBMITTED'
| 'IN_PROGRESS'
| 'SUBMITTED';
export type AssignmentCompletionType = {
__typename?: 'AssignmentCompletionType';
additional_json_data: Scalars['JSONString']['output'];
additional_json_data: Scalars['JSONString'];
assignment: AssignmentType;
assignment_user: UserType;
completion_data?: Maybe<Scalars['GenericScalar']['output']>;
completion_data?: Maybe<Scalars['GenericScalar']>;
completion_status: AssignmentAssignmentCompletionCompletionStatusChoices;
created_at: Scalars['DateTime']['output'];
evaluation_grade?: Maybe<Scalars['Float']['output']>;
evaluation_points?: Maybe<Scalars['Float']['output']>;
evaluation_submitted_at?: Maybe<Scalars['DateTime']['output']>;
created_at: Scalars['DateTime'];
evaluation_grade?: Maybe<Scalars['Float']>;
evaluation_points?: Maybe<Scalars['Float']>;
evaluation_submitted_at?: Maybe<Scalars['DateTime']>;
evaluation_user?: Maybe<UserType>;
id: Scalars['ID']['output'];
submitted_at?: Maybe<Scalars['DateTime']['output']>;
updated_at: Scalars['DateTime']['output'];
id: Scalars['ID'];
submitted_at?: Maybe<Scalars['DateTime']>;
updated_at: Scalars['DateTime'];
};
export type AssignmentType = CoursePageInterface & {
__typename?: 'AssignmentType';
assignment_type: AssignmentAssignmentAssignmentTypeChoices;
content_type?: Maybe<Scalars['String']['output']>;
content_type?: Maybe<Scalars['String']>;
/** Zeitaufwand als Text */
effort_required: Scalars['String']['output'];
effort_required: Scalars['String'];
/** Beschreibung der Bewertung */
evaluation_description: Scalars['String']['output'];
evaluation_description: Scalars['String'];
/** URL zum Beurteilungsinstrument */
evaluation_document_url: Scalars['String']['output'];
evaluation_tasks?: Maybe<Scalars['JSONStreamField']['output']>;
frontend_url?: Maybe<Scalars['String']['output']>;
id?: Maybe<Scalars['ID']['output']>;
evaluation_document_url: Scalars['String'];
evaluation_tasks?: Maybe<Scalars['JSONStreamField']>;
frontend_url?: Maybe<Scalars['String']>;
id?: Maybe<Scalars['ID']>;
/** Erläuterung der Ausgangslage */
intro_text: Scalars['String']['output'];
live?: Maybe<Scalars['Boolean']['output']>;
performance_objectives?: Maybe<Scalars['JSONStreamField']['output']>;
slug?: Maybe<Scalars['String']['output']>;
tasks?: Maybe<Scalars['JSONStreamField']['output']>;
title?: Maybe<Scalars['String']['output']>;
translation_key?: Maybe<Scalars['String']['output']>;
intro_text: Scalars['String'];
live?: Maybe<Scalars['Boolean']>;
performance_objectives?: Maybe<Scalars['JSONStreamField']>;
slug?: Maybe<Scalars['String']>;
tasks?: Maybe<Scalars['JSONStreamField']>;
title?: Maybe<Scalars['String']>;
translation_key?: Maybe<Scalars['String']>;
};
/** An enumeration. */
export enum CoreUserLanguageChoices {
export type CoreUserLanguageChoices =
/** Deutsch */
De = 'DE',
| 'DE'
/** Français */
Fr = 'FR',
| 'FR'
/** Italiano */
It = 'IT'
}
| 'IT';
export type CoursePageInterface = {
content_type?: Maybe<Scalars['String']['output']>;
frontend_url?: Maybe<Scalars['String']['output']>;
id?: Maybe<Scalars['ID']['output']>;
live?: Maybe<Scalars['Boolean']['output']>;
slug?: Maybe<Scalars['String']['output']>;
title?: Maybe<Scalars['String']['output']>;
translation_key?: Maybe<Scalars['String']['output']>;
content_type?: Maybe<Scalars['String']>;
frontend_url?: Maybe<Scalars['String']>;
id?: Maybe<Scalars['ID']>;
live?: Maybe<Scalars['Boolean']>;
slug?: Maybe<Scalars['String']>;
title?: Maybe<Scalars['String']>;
translation_key?: Maybe<Scalars['String']>;
};
export type CourseType = {
__typename?: 'CourseType';
category_name: Scalars['String']['output'];
id: Scalars['ID']['output'];
category_name: Scalars['String'];
id: Scalars['ID'];
learning_path?: Maybe<LearningPathType>;
slug: Scalars['String']['output'];
title: Scalars['String']['output'];
slug: Scalars['String'];
title: Scalars['String'];
};
export type ErrorType = {
__typename?: 'ErrorType';
field: Scalars['String']['output'];
messages: Array<Scalars['String']['output']>;
field: Scalars['String'];
messages: Array<Scalars['String']>;
};
export type FeedbackResponse = Node & {
__typename?: 'FeedbackResponse';
created_at: Scalars['DateTime']['output'];
data?: Maybe<Scalars['GenericScalar']['output']>;
created_at: Scalars['DateTime'];
data?: Maybe<Scalars['GenericScalar']>;
/** The ID of the object */
id: Scalars['ID']['output'];
id: Scalars['ID'];
};
export type LearningPathType = CoursePageInterface & {
__typename?: 'LearningPathType';
content_type?: Maybe<Scalars['String']['output']>;
depth: Scalars['Int']['output'];
draft_title: Scalars['String']['output'];
expire_at?: Maybe<Scalars['DateTime']['output']>;
expired: Scalars['Boolean']['output'];
first_published_at?: Maybe<Scalars['DateTime']['output']>;
frontend_url?: Maybe<Scalars['String']['output']>;
go_live_at?: Maybe<Scalars['DateTime']['output']>;
has_unpublished_changes: Scalars['Boolean']['output'];
id?: Maybe<Scalars['ID']['output']>;
last_published_at?: Maybe<Scalars['DateTime']['output']>;
latest_revision_created_at?: Maybe<Scalars['DateTime']['output']>;
live?: Maybe<Scalars['Boolean']['output']>;
locked: Scalars['Boolean']['output'];
locked_at?: Maybe<Scalars['DateTime']['output']>;
content_type?: Maybe<Scalars['String']>;
depth: Scalars['Int'];
draft_title: Scalars['String'];
expire_at?: Maybe<Scalars['DateTime']>;
expired: Scalars['Boolean'];
first_published_at?: Maybe<Scalars['DateTime']>;
frontend_url?: Maybe<Scalars['String']>;
go_live_at?: Maybe<Scalars['DateTime']>;
has_unpublished_changes: Scalars['Boolean'];
id?: Maybe<Scalars['ID']>;
last_published_at?: Maybe<Scalars['DateTime']>;
latest_revision_created_at?: Maybe<Scalars['DateTime']>;
live?: Maybe<Scalars['Boolean']>;
locked: Scalars['Boolean'];
locked_at?: Maybe<Scalars['DateTime']>;
locked_by?: Maybe<UserType>;
numchild: Scalars['Int']['output'];
numchild: Scalars['Int'];
owner?: Maybe<UserType>;
path: Scalars['String']['output'];
path: Scalars['String'];
/** Die informative Beschreibung, dargestellt in Suchmaschinen-Ergebnissen unter der Überschrift. */
search_description: Scalars['String']['output'];
search_description: Scalars['String'];
/** Der Titel der Seite, dargestellt in Suchmaschinen-Ergebnissen als die verlinkte Überschrift. */
seo_title: Scalars['String']['output'];
seo_title: Scalars['String'];
/** Ob ein Link zu dieser Seite in automatisch generierten Menüs auftaucht. */
show_in_menus: Scalars['Boolean']['output'];
slug?: Maybe<Scalars['String']['output']>;
title?: Maybe<Scalars['String']['output']>;
translation_key?: Maybe<Scalars['String']['output']>;
url_path: Scalars['String']['output'];
show_in_menus: Scalars['Boolean'];
slug?: Maybe<Scalars['String']>;
title?: Maybe<Scalars['String']>;
translation_key?: Maybe<Scalars['String']>;
url_path: Scalars['String'];
};
export type Mutation = {
@ -186,25 +188,25 @@ export type Mutation = {
};
export type MutationSend_FeedbackArgs = {
export type MutationSendFeedbackArgs = {
input: SendFeedbackInput;
};
export type MutationUpsert_Assignment_CompletionArgs = {
assignment_id: Scalars['ID']['input'];
assignment_user_id?: InputMaybe<Scalars['ID']['input']>;
completion_data_string?: InputMaybe<Scalars['String']['input']>;
completion_status?: InputMaybe<Scalars['String']['input']>;
course_session_id: Scalars['ID']['input'];
evaluation_grade?: InputMaybe<Scalars['Float']['input']>;
evaluation_points?: InputMaybe<Scalars['Float']['input']>;
export type MutationUpsertAssignmentCompletionArgs = {
assignment_id: Scalars['ID'];
assignment_user_id?: InputMaybe<Scalars['ID']>;
completion_data_string?: InputMaybe<Scalars['String']>;
completion_status?: InputMaybe<AssignmentCompletionStatus>;
course_session_id: Scalars['ID'];
evaluation_grade?: InputMaybe<Scalars['Float']>;
evaluation_points?: InputMaybe<Scalars['Float']>;
};
/** An object with an ID */
export type Node = {
/** The ID of the object */
id: Scalars['ID']['output'];
id: Scalars['ID'];
};
export type Query = {
@ -216,32 +218,32 @@ export type Query = {
export type QueryAssignmentArgs = {
id?: InputMaybe<Scalars['ID']['input']>;
slug?: InputMaybe<Scalars['String']['input']>;
id?: InputMaybe<Scalars['ID']>;
slug?: InputMaybe<Scalars['String']>;
};
export type QueryAssignment_CompletionArgs = {
assignment_id: Scalars['ID']['input'];
assignment_user_id?: InputMaybe<Scalars['ID']['input']>;
course_session_id: Scalars['ID']['input'];
export type QueryAssignmentCompletionArgs = {
assignment_id: Scalars['ID'];
assignment_user_id?: InputMaybe<Scalars['ID']>;
course_session_id: Scalars['ID'];
};
export type QueryCourseArgs = {
id?: InputMaybe<Scalars['Int']['input']>;
id?: InputMaybe<Scalars['Int']>;
};
export type SendFeedbackInput = {
clientMutationId?: InputMaybe<Scalars['String']['input']>;
course_session: Scalars['Int']['input'];
data?: InputMaybe<Scalars['GenericScalar']['input']>;
page: Scalars['String']['input'];
clientMutationId?: InputMaybe<Scalars['String']>;
course_session: Scalars['Int'];
data?: InputMaybe<Scalars['GenericScalar']>;
page: Scalars['String'];
};
export type SendFeedbackPayload = {
__typename?: 'SendFeedbackPayload';
clientMutationId?: Maybe<Scalars['String']['output']>;
clientMutationId?: Maybe<Scalars['String']>;
/** May contain more than one error for same field. */
errors?: Maybe<Array<Maybe<ErrorType>>>;
feedback_response?: Maybe<FeedbackResponse>;
@ -249,14 +251,14 @@ export type SendFeedbackPayload = {
export type UserType = {
__typename?: 'UserType';
avatar_url: Scalars['String']['output'];
email: Scalars['String']['output'];
first_name: Scalars['String']['output'];
id: Scalars['ID']['output'];
avatar_url: Scalars['String'];
email: Scalars['String'];
first_name: Scalars['String'];
id: Scalars['ID'];
language: CoreUserLanguageChoices;
last_name: Scalars['String']['output'];
last_name: Scalars['String'];
/** Erforderlich. 150 Zeichen oder weniger. Nur Buchstaben, Ziffern und @/./+/-/_. */
username: Scalars['String']['output'];
username: Scalars['String'];
};
export type SendFeedbackMutationMutationVariables = Exact<{
@ -267,29 +269,29 @@ export type SendFeedbackMutationMutationVariables = Exact<{
export type SendFeedbackMutationMutation = { __typename?: 'Mutation', send_feedback?: { __typename?: 'SendFeedbackPayload', feedback_response?: { __typename?: 'FeedbackResponse', id: string } | null, errors?: Array<{ __typename?: 'ErrorType', field: string, messages: Array<string> } | null> | null } | null };
export type UpsertAssignmentCompletionMutationVariables = Exact<{
assignmentId: Scalars['ID']['input'];
courseSessionId: Scalars['ID']['input'];
assignmentUserId?: InputMaybe<Scalars['ID']['input']>;
completionStatus: Scalars['String']['input'];
completionDataString: Scalars['String']['input'];
evaluationGrade?: InputMaybe<Scalars['Float']['input']>;
evaluationPoints?: InputMaybe<Scalars['Float']['input']>;
assignmentId: Scalars['ID'];
courseSessionId: Scalars['ID'];
assignmentUserId?: InputMaybe<Scalars['ID']>;
completionStatus: AssignmentCompletionStatus;
completionDataString: Scalars['String'];
evaluationGrade?: InputMaybe<Scalars['Float']>;
evaluationPoints?: InputMaybe<Scalars['Float']>;
}>;
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 AssignmentCompletionQueryQueryVariables = Exact<{
assignmentId: Scalars['ID']['input'];
courseSessionId: Scalars['ID']['input'];
assignmentUserId?: InputMaybe<Scalars['ID']['input']>;
assignmentId: Scalars['ID'];
courseSessionId: Scalars['ID'];
assignmentUserId?: InputMaybe<Scalars['ID']>;
}>;
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 CourseQueryQueryVariables = Exact<{
courseId: Scalars['Int']['input'];
courseId: Scalars['Int'];
}>;
@ -297,6 +299,6 @@ export type CourseQueryQuery = { __typename?: 'Query', course?: { __typename?: '
export const SendFeedbackMutationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SendFeedbackMutation"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SendFeedbackInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"send_feedback"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"feedback_response"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"field"}},{"kind":"Field","name":{"kind":"Name","value":"messages"}}]}}]}}]}}]} as unknown as DocumentNode<SendFeedbackMutationMutation, SendFeedbackMutationMutationVariables>;
export const UpsertAssignmentCompletionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpsertAssignmentCompletion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"assignmentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"courseSessionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"assignmentUserId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"completionStatus"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"completionDataString"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evaluationGrade"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Float"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evaluationPoints"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Float"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"upsert_assignment_completion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"assignment_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"assignmentId"}}},{"kind":"Argument","name":{"kind":"Name","value":"course_session_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"courseSessionId"}}},{"kind":"Argument","name":{"kind":"Name","value":"assignment_user_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"assignmentUserId"}}},{"kind":"Argument","name":{"kind":"Name","value":"completion_status"},"value":{"kind":"Variable","name":{"kind":"Name","value":"completionStatus"}}},{"kind":"Argument","name":{"kind":"Name","value":"completion_data_string"},"value":{"kind":"Variable","name":{"kind":"Name","value":"completionDataString"}}},{"kind":"Argument","name":{"kind":"Name","value":"evaluation_grade"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evaluationGrade"}}},{"kind":"Argument","name":{"kind":"Name","value":"evaluation_points"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evaluationPoints"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignment_completion"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"completion_status"}},{"kind":"Field","name":{"kind":"Name","value":"submitted_at"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_submitted_at"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_grade"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_points"}},{"kind":"Field","name":{"kind":"Name","value":"completion_data"}}]}}]}}]}}]} as unknown as DocumentNode<UpsertAssignmentCompletionMutation, UpsertAssignmentCompletionMutationVariables>;
export const UpsertAssignmentCompletionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpsertAssignmentCompletion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"assignmentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"courseSessionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"assignmentUserId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"completionStatus"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AssignmentCompletionStatus"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"completionDataString"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evaluationGrade"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Float"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evaluationPoints"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Float"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"upsert_assignment_completion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"assignment_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"assignmentId"}}},{"kind":"Argument","name":{"kind":"Name","value":"course_session_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"courseSessionId"}}},{"kind":"Argument","name":{"kind":"Name","value":"assignment_user_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"assignmentUserId"}}},{"kind":"Argument","name":{"kind":"Name","value":"completion_status"},"value":{"kind":"Variable","name":{"kind":"Name","value":"completionStatus"}}},{"kind":"Argument","name":{"kind":"Name","value":"completion_data_string"},"value":{"kind":"Variable","name":{"kind":"Name","value":"completionDataString"}}},{"kind":"Argument","name":{"kind":"Name","value":"evaluation_grade"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evaluationGrade"}}},{"kind":"Argument","name":{"kind":"Name","value":"evaluation_points"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evaluationPoints"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignment_completion"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"completion_status"}},{"kind":"Field","name":{"kind":"Name","value":"submitted_at"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_submitted_at"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_grade"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_points"}},{"kind":"Field","name":{"kind":"Name","value":"completion_data"}}]}}]}}]}}]} as unknown as DocumentNode<UpsertAssignmentCompletionMutation, UpsertAssignmentCompletionMutationVariables>;
export const AssignmentCompletionQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"assignmentCompletionQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"assignmentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"courseSessionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"assignmentUserId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignment"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"assignmentId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignment_type"}},{"kind":"Field","name":{"kind":"Name","value":"content_type"}},{"kind":"Field","name":{"kind":"Name","value":"effort_required"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_description"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_document_url"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_tasks"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"intro_text"}},{"kind":"Field","name":{"kind":"Name","value":"performance_objectives"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"tasks"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"translation_key"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assignment_completion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"assignment_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"assignmentId"}}},{"kind":"Argument","name":{"kind":"Name","value":"course_session_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"courseSessionId"}}},{"kind":"Argument","name":{"kind":"Name","value":"assignment_user_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"assignmentUserId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"completion_status"}},{"kind":"Field","name":{"kind":"Name","value":"submitted_at"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_submitted_at"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assignment_user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_grade"}},{"kind":"Field","name":{"kind":"Name","value":"evaluation_points"}},{"kind":"Field","name":{"kind":"Name","value":"completion_data"}}]}}]}}]} as unknown as DocumentNode<AssignmentCompletionQueryQuery, AssignmentCompletionQueryQueryVariables>;
export const CourseQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"courseQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"courseId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"course"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"courseId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"category_name"}},{"kind":"Field","name":{"kind":"Name","value":"learning_path"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode<CourseQueryQuery, CourseQueryQueryVariables>;

View File

@ -5,7 +5,7 @@ export const UPSERT_ASSIGNMENT_COMPLETION_MUTATION = graphql(`
$assignmentId: ID!
$courseSessionId: ID!
$assignmentUserId: ID
$completionStatus: String!
$completionStatus: AssignmentCompletionStatus!
$completionDataString: String!
$evaluationGrade: Float
$evaluationPoints: Float

View File

@ -1,3 +1,4 @@
import type { AssignmentCompletionStatus as AssignmentCompletionStatusGenerated } from "@/gql/graphql";
import type { Circle } from "@/services/circle";
import type { Component } from "vue";
@ -495,12 +496,7 @@ export interface Notification {
course: string | null;
}
export type AssignmentCompletionStatus =
| "unknwown"
| "IN_PROGRESS"
| "SUBMITTED"
| "EVALUATION_IN_PROGRESS"
| "EVALUATION_SUBMITTED";
export type AssignmentCompletionStatus = AssignmentCompletionStatusGenerated;
export interface UserDataText {
text: string;

View File

@ -20,7 +20,7 @@ from vbv_lernwelt.assignment.creators.create_assignments import (
create_vv_gewinnen_casework,
create_vv_reflection,
)
from vbv_lernwelt.assignment.models import Assignment
from vbv_lernwelt.assignment.models import Assignment, AssignmentCompletionStatus
from vbv_lernwelt.assignment.services import update_assignment_completion
from vbv_lernwelt.assignment.tests.assignment_factories import AssignmentListPageFactory
from vbv_lernwelt.competence.create_uk_competence_profile import (
@ -450,7 +450,7 @@ def create_course_uk_de_assignment_completion_data(assignment, course_session, u
assignment_user=user,
assignment=assignment,
course_session=course_session,
completion_status="SUBMITTED",
completion_status=AssignmentCompletionStatus.SUBMITTED,
)