Add generated types so that they can be referenced in code
This commit is contained in:
parent
2fdae7c120
commit
a692c819ee
|
|
@ -15,6 +15,9 @@ const config: CodegenConfig = {
|
|||
},
|
||||
plugins: [],
|
||||
},
|
||||
"./src/gql/typenames.ts": {
|
||||
plugins: ["./codegenGenerateTypenames.js"],
|
||||
},
|
||||
},
|
||||
config: {
|
||||
enumsAsTypes: true,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
// eslint-disable-next-line no-undef
|
||||
module.exports = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
plugin: (schema, _documents, _config) => {
|
||||
const typeNames = Object.keys(schema.getTypeMap())
|
||||
.filter((name) => !name.startsWith("__")) // Filter out built-in types
|
||||
.map((name) => `export const ${name} = "${name}";\n`);
|
||||
|
||||
return typeNames.join("");
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
export const AssignmentAssignmentAssignmentTypeChoices = "AssignmentAssignmentAssignmentTypeChoices";
|
||||
export const AssignmentAssignmentCompletionCompletionStatusChoices = "AssignmentAssignmentCompletionCompletionStatusChoices";
|
||||
export const AssignmentCompletionMutation = "AssignmentCompletionMutation";
|
||||
export const AssignmentCompletionObjectType = "AssignmentCompletionObjectType";
|
||||
export const AssignmentCompletionStatus = "AssignmentCompletionStatus";
|
||||
export const AssignmentObjectType = "AssignmentObjectType";
|
||||
export const Boolean = "Boolean";
|
||||
export const CoreUserLanguageChoices = "CoreUserLanguageChoices";
|
||||
export const CoursePageInterface = "CoursePageInterface";
|
||||
export const CourseType = "CourseType";
|
||||
export const DateTime = "DateTime";
|
||||
export const ErrorType = "ErrorType";
|
||||
export const FeedbackResponse = "FeedbackResponse";
|
||||
export const Float = "Float";
|
||||
export const GenericScalar = "GenericScalar";
|
||||
export const ID = "ID";
|
||||
export const Int = "Int";
|
||||
export const JSONStreamField = "JSONStreamField";
|
||||
export const JSONString = "JSONString";
|
||||
export const LearningPathType = "LearningPathType";
|
||||
export const Mutation = "Mutation";
|
||||
export const Node = "Node";
|
||||
export const Query = "Query";
|
||||
export const SendFeedbackInput = "SendFeedbackInput";
|
||||
export const SendFeedbackPayload = "SendFeedbackPayload";
|
||||
export const String = "String";
|
||||
export const UserType = "UserType";
|
||||
|
|
@ -5,6 +5,10 @@ import schema from "../gql/minifiedSchema.json";
|
|||
import { devtoolsExchange } from "@urql/devtools";
|
||||
import { cacheExchange } from "@urql/exchange-graphcache";
|
||||
import { Client, fetchExchange } from "@urql/vue";
|
||||
import {
|
||||
AssignmentCompletionMutation,
|
||||
AssignmentCompletionObjectType,
|
||||
} from "../gql/typenames";
|
||||
|
||||
export const graphqlClient = new Client({
|
||||
url: import.meta.env.VITE_GRAPHQL_URL || "/server/graphql/",
|
||||
|
|
@ -28,13 +32,13 @@ export const graphqlClient = new Client({
|
|||
const id = info.variables.id;
|
||||
if (id) {
|
||||
const completionData = cache.resolve(
|
||||
{ __typename: "AssignmentCompletionType", id: "1" },
|
||||
{ __typename: AssignmentCompletionObjectType, id: "1" },
|
||||
"completion_data"
|
||||
);
|
||||
return {
|
||||
__typename: "AssignmentCompletionMutation",
|
||||
__typename: AssignmentCompletionMutation,
|
||||
assignment_completion: {
|
||||
__typename: "AssignmentCompletionType",
|
||||
__typename: AssignmentCompletionObjectType,
|
||||
id: id,
|
||||
completion_data: Object.assign(
|
||||
{},
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from vbv_lernwelt.assignment.creators.create_assignments import (
|
|||
create_uk_fahrzeug_casework,
|
||||
create_uk_fahrzeug_prep_assignment,
|
||||
)
|
||||
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.factories import (
|
||||
|
|
@ -139,7 +139,7 @@ def create_test_assignment_submitted_data(assignment, course_session, user):
|
|||
assignment_user=user,
|
||||
assignment=assignment,
|
||||
course_session=course_session,
|
||||
completion_status="SUBMITTED",
|
||||
completion_status=AssignmentCompletionStatus.SUBMITTED,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue