diff --git a/Dockerfile b/Dockerfile index c9f507c..261ad83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM adoptopenjdk/openjdk11:alpine-jre WORKDIR /eedu -COPY /target/gateway-0.1-SNAPSHOT.jar gateway.jar +COPY gateway-core/target/gateway-core-0.1-SNAPSHOT.jar gateway.jar EXPOSE 80 diff --git a/backend-api/pom.xml b/backend-api/pom.xml new file mode 100644 index 0000000..17829d4 --- /dev/null +++ b/backend-api/pom.xml @@ -0,0 +1,94 @@ + + + + gateway + de.the-morpheus.e-du + 0.1-SNAPSHOT + + 4.0.0 + + backend-api + + + + io.swagger.core.v3 + swagger-annotations + 2.1.2 + compile + + + com.squareup.okhttp + okhttp + 2.7.5 + compile + + + com.squareup.okhttp + logging-interceptor + 2.7.5 + compile + + + org.threeten + threetenbp + 1.4.0 + + + io.gsonfire + gson-fire + 1.8.4 + + + org.realityforge.javax.annotation + javax.annotation + 1.0.1 + + + junit + junit + 4.13 + compile + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + io.swagger.codegen.v3 + swagger-codegen-maven-plugin + 3.0.19 + + + + generate + + + ${project.basedir}/src/main/resources/task.yaml + java + de.themorpheus.edu.backend.api + de.themorpheus.edu.backend.model + de.themorpheus.edu.backend.invoker + + ${project.basedir}/src/main/java + + + + + + + + + + \ No newline at end of file diff --git a/backend-api/src/main/resources/task.yaml b/backend-api/src/main/resources/task.yaml new file mode 100644 index 0000000..83ce227 --- /dev/null +++ b/backend-api/src/main/resources/task.yaml @@ -0,0 +1,4713 @@ +openapi: 3.0.1 +info: + title: Task Microservice WIP + version: v1 +servers: + - url: http://localhost:80 +tags: + - name: task + description: Task + - name: task_group + description: Task Group + - name: subject + description: Subject + - name: module + description: Module + - name: lecture + description: Lecture + - name: difficulty + description: Difficulty + - name: task_type + description: Task Types + - name: solution + description: Solution +paths: + /task: + post: + tags: + - task + summary: Creates a new task + operationId: createTask + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + requestBody: + content: + application/json: + schema: + type: object + properties: + task: + type: string + example: "Calculate Term" + description: + type: string + example: "Calculate the following Term: 3(6*7-9)/3" + language: + type: string + example: "de-DE" + necessary_points: + type: integer + example: 100 + task_type_id: + type: integer + example: 1 + description: "Also possible to use [task_type_name_key: string], but one has to be present. If both are present the id will be used." + lecture_id: + type: integer + example: 1 + description: "Also possible to use [lecture_name_key: string], but one has to be present. If both are present the id will be used." + difficulty_id: + type: integer + example: 1 + description: "Also possible to use [difficulty_name_key: string], but one has to be present. If both are present the id will be used." + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task/{task_id}: + get: + tags: + - task + summary: Gets a task + operationId: getTask + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + example: 1 + format: int32 + minimum: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '401': + description: CORS + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + put: + tags: + - task + summary: Edits a Task + operationId: editTask + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + example: 1 + format: int32 + minimum: 1 + requestBody: + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + example: 1 + task: + type: string + example: "Calculate Term" + description: + type: string + example: "Calculate the following Term: 3(6*7-9)/3" + language: + type: string + example: "de-DE" + necessary_points: + type: integer + example: 100 + task_type_id: + type: integer + example: 1 + description: "Also possible to use [task_type_name_key: string]" + lecture_id: + type: integer + example: 1 + description: "Also possible to use [lecture_name_key: string]" + difficulty_id: + type: integer + example: 1 + description: "Also possible to use [difficulty_name_key: string]" + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - task + summary: Deletes a Task + operationId: deleteTask + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + example: 1 + format: int32 + minimum: 1 + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task/next: + post: + tags: + - task + summary: Gets next random task + description: Gets next random task in current lecture based on last task and + takes an integer array of the already absolved tasks ids. + operationId: getNext + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + requestBody: + content: + application/json: + schema: + type: object + properties: + last_task_ids: + type: array + description: List of tasks that have already been absolved + items: + type: integer + example: + - 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task/own: + get: + tags: + - task + summary: Gets all tasks created by the user + operationId: getOwnTasks + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + tasks: + type: array + items: + $ref: '#/components/schemas/Task' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task/user/{user_id}: + get: + tags: + - task + summary: Get all tasks created by specified user + operationId: getUserTasks + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + - name: user_id + in: path + required: true + description: The UUID of the user + schema: + type: string + example: "52bd088c-d6ad-4cee-9f93-cabfc8c07234" + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + tasks: + type: array + items: + $ref: '#/components/schemas/Task' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task/vote/{task_id}: + put: + tags: + - task + summary: Votes for a task + description: Vote for a specific task. The vote argument can **only** be *1* or + *-1* + operationId: voteTask + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + example: 1 + format: int32 + minimum: 1 + requestBody: + content: + application/json: + schema: + type: object + properties: + vote: + type: integer + example: 1 + description: Can only be 1 or -1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/TaskVote' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task/verify/{task_id}: + patch: + tags: + - task + summary: Verifys a task + operationId: verifyTask + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + example: 1 + format: int32 + minimum: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task/solution_type/{task_id}: + get: + tags: + - task + summary: Get the solution_type of a task + operationId: getTaskSolutionType + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + example: 1 + format: int32 + minimum: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + solution_type: + type: string + example: "multiple_choice_solution" + + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task/done/{task_id}: + get: + tags: + - task + summary: Marks a task as done + operationId: markTaskAsDone + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + example: 1 + format: int32 + minimum: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + task_done_id: + type: integer + example: 1 + date: + type: integer + example: 1589528838573 + format: int64 + description: "(Timestamp)" + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task_group: + post: + tags: + - task_group + summary: Create a Task Group + operationId: createTaskGroup + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + lecture_id: + type: integer + example: 1 + name_key: + type: string + example: Tolles-Aufgaben-Pack + task_ids: + type: array + items: + type: integer + example: 1 + difficulty_id: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + task_group_id: + type: integer + example: 1 + lecture_id: + type: integer + example: 1 + name_key: + type: string + example: Tolles-Aufgaben-Pack + task_ids: + type: array + items: + type: integer + example: 1 + difficulty_id: + type: integer + example: 1 + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + put: + tags: + - task_group + summary: Edit a Task Group + operationId: editTaskGroup + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_group_id: + type: integer + example: 1 + description: The task group id to modify + lecture_id: + type: integer + example: 1 + name_key: + type: string + example: Tolles-Aufgaben-Pack + task_ids: + type: array + items: + type: integer + example: 1 + difficulty_id: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + lecture_id: + type: integer + example: 1 + name_key: + type: string + example: Tolles-Aufgaben-Pack + task_ids: + type: array + items: + type: integer + example: 1 + difficulty_id: + type: integer + example: 1 + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task_group/own: + get: + tags: + - task_group + summary: Get all task groups created by the user + operationId: getOwnTaskGroups + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + task_groups: + type: array + items: + $ref: '#/components/schemas/TaskGroup' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task_group/user/{user_id}: + get: + tags: + - task_group + summary: Get all task groups from specified user + operationId: getTaskGroupsFromUser + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: user_id + in: path + required: true + schema: + type: string + example: 0b870676-1a01-47aa-8402-859fb9806238 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + task_groups: + type: array + items: + $ref: '#/components/schemas/TaskGroup' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task_group/{task_group_id}: + get: + tags: + - task_group + summary: Get a task group + operationId: getTaskGroup + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_group_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/TaskGroup' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - task_group + summary: Delete a Task Group + operationId: deleteTaskGroup + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_group_id + in: path + required: true + schema: + type: string + example: 1 + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task_group/task: + post: + tags: + - task_group + summary: Add single task to Task Group + operationId: addTaskToTaskGroups + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_group_id: + type: integer + example: 1 + description: The task group id to add the task to + task_id: + type: integer + description: The id of the task to add to the Task Group + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + task_group_id: + type: integer + example: 1 + description: The task group id to add the task to + task_id: + type: integer + description: The id of the task to add to the Task Group + example: 1 + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task_group/{task_group_id}/task/{task_id}: + delete: + tags: + - task_group + summary: Remove single task from Task Group + operationId: removeTaskFromTaskGroups + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_group_id + in: path + required: true + description: The id of the task group + schema: + type: integer + example: 1 + - name: task_id + in: path + required: true + description: The id of the task to remove from the task group + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /lecture/{lecture_name_key}/task_group: + get: + tags: + - task_group + summary: Get Task Groups from lecture + operationId: getTaskGroupsFromLecture + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: lecture_name_key + in: path + required: true + schema: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + task_Groups: + type: array + items: + $ref: '#/components/schemas/TaskGroup' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/multiple_choice/: + post: + tags: + - solution + summary: Creates a new multiple choice Solution + operationId: createmultipleChoiceSolution + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + applicaton/json: + schema: + type: object + properties: + task_id: + type: integer + example: 1 + solution: + type: string + example: "L\xF6sung 1" + is_correct: + type: boolean + example: 1 + responses: + 200: + description: Ok + content: + application/json: + schema: + type: object + properties: + multiple_choice_solution_id: + type: integer + minimum: 1 + example: 1 + correct: + type: boolean + example: true + solution: + type: string + example: "L\xF6sung 1 lol" + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/multiple_choice/{task_id}: + get: + tags: + - solution + summary: Get all multiple choice solutions from task id + operationId: getMultipleChoiceSolutions + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + solutions: + type: array + items: + type: object + properties: + multiple_choice_solution_id: + type: integer + example: 1 + solution: + type: string + example: "L\xF6sung 1 lol" + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/multiple_choice/{task_id}/all: + get: + tags: + - solution + summary: Same as solution/multiple_choice/{task_id}, but returns more data. + This route can only be used by teachers. + operationId: getAllMultipleChoiceSolutionsExpanded + security: + - JWT: + - read + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + solutions: + type: array + items: + type: object + properties: + multiple_choice_solution_id: + type: integer + example: 1 + solution: + type: string + example: "L\xF6sung 1 lol" + correct: + type: boolean + example: true + /solution/multiple_choice/check: + post: + tags: + - solution + summary: Check multiple choice solutions + operationId: checkMultipleChoiceSolutions + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + solution: + type: array + items: + type: object + properties: + multiple_choice_solution_id: + type: integer + example: 1 + correct: + type: boolean + example: true + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + solutions: + type: array + items: + type: boolean + description: Array if solution is true or not + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/multiple_choice/{multiple_choice_solution_id}: + delete: + tags: + - solution + summary: Deletes a multiple choice Solution + operationId: deleteMultipleChoiceSolutions + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: multiple_choice_solution_id + description: Id of the muliple choice solution + in: path + required: true + schema: + type: integer + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/freestyle: + post: + tags: + - solution + summary: Create a freestyle sample solution + operationId: createFreestyleSolution + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SampleSolution' + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/freestyle/check: + post: + tags: + - solution + summary: Check freestyle solution + operationId: checkFreestyleSolution + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + solution: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/SampleSolution' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/freestyle/{task_id}: + delete: + tags: + - solution + summary: Delte freestyle solution + operationId: deleteFreestyleSolution + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_id + in: path + required: true + schema: + type: string + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/wordsalad/: + post: + tags: + - solution + summary: Creates a new wordsalad Solution + operationId: createWordsaladSolution + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + applicaton/json: + schema: + type: object + properties: + task_id: + type: integer + solution: + type: string + responses: + 200: + description: Ok + content: + application/json: + schema: + type: object + properties: + wordsalad_solution_id: + type: integer + solution: + type: string + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + put: + tags: + - solution + summary: Edits a wordsalad Solution + operationId: editWordsaladSolution + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + solution: + type: string + responses: + 200: + description: Ok + content: + application/json: + schema: + type: object + properties: + wordsalad_solution_id: + type: integer + solution: + type: string + 400: + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + 500: + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/wordsalad/{task_id}: + get: + tags: + - solution + summary: Get all wordsalad solution from task id + operationId: getWordsaladSolution + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + format: int32 + minimum: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + solution: + type: string + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - solution + summary: Deletes a Wordsalad solution + operationId: deleteWordsaladSolutions + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_id + in: path + required: true + schema: + type: integer + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/wordsalad/check: + post: + tags: + - solution + summary: Check wordsalad solution + operationId: checkWordsaladSolution + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + solution: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + correct: + type: boolean + solution: + type: string + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/image/: + post: + tags: + - solution + summary: Create a image solution + operationId: createImageSolution + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + solution: + type: string + example: LINK_TO_IMAGE + format: URL + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + solution: + type: string + example: LINK_TO_IMAGE + format: URL + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/image/{task_id}: + get: + tags: + - solution + summary: Get all image solution from task id + operationId: getImageSolution + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + format: int32 + minimum: 1 + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - solution + summary: Deletes a Image Solution + operationId: deleteImmageSolution + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + format: int32 + minimum: 1 + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/image/check: + post: + tags: + - solution + summary: Check image solution + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + url: + type: string + example: LINK_TO_IMAGE + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/topic_connection: + post: + tags: + - solution + summary: Creates a new topic connection solution + operationId: createTopicConnectionSolution + security: + - JWT: + - read + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + point_a: + type: string + description: Name of connection point a. Can not be empty + point_b: + type: string + description: Name of connection point b. Can not be empty + responses: + 200: + description: Ok + content: + application/json: + schema: + type: object + properties: + topic_connection_solution_id: + type: integer + point_a: + type: string + point_b: + type: string + 400: + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + 500: + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/topic_connection/{task_id}: + get: + tags: + - solution + summary: Get all topic connection solution from task id + operationId: getTopicConnectionSolution + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + format: int32 + minimum: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + points: + type: array + items: + type: string + description: String of a connection point in random order + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/topic_connection/{task_id}/all: + get: + tags: + - solution + summary: Same as /solution/multiple_choice/{task_id}, but returns more data. + This route can only be used by teachers. + operationId: getAllTopicConnectionSolutionsExpanded + security: + - JWT: + - read + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_id + in: path + required: true + description: The unique task id + schema: + type: integer + format: int32 + minimum: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + solutions: + type: array + items: + type: object + properties: + topic_connection_solution_id: + type: integer + point_a: + type: string + point_b: + type: string + /solution/topic_connection/check: + post: + tags: + - solution + summary: check topic connection solution + operationId: checkTopicConnectionSolution + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + connected_points: + type: array + items: + type: object + properties: + point_a: + type: string + point_b: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + correct: + type: array + items: + type: object + properties: + topic_connection_solution_id: + type: integer + point_a: + type: string + point_b: + type: string + wrong: + type: array + items: + type: object + properties: + topic_connection_solution_id: + type: integer + point_a: + type: string + point_b: + type: string + missing: + type: array + items: + type: object + properties: + topic_connection_solution_id: + type: integer + point_a: + type: string + point_b: + type: string + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/topic_connection/{topic_connection_solution_id}: + delete: + tags: + - solution + summary: deletes a topic connection solution + operationId: deleteTopicConnectionSolution + security: + - JWT: + - read + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: topic_connection_solution_id + in: path + required: true + schema: + type: integer + format: int32 + minimum: 1 + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /solution/simple_equation: + post: + tags: + - solution + summary: Creates a simple equation solution + operationId: createSimpleEquationSolution + security: + - JWT: + - read + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + taks_id: + type: integer + result: + type: string + steps: + type: array + items: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + result: + type: string + steps: + type: array + items: + type: object + properties: + simple_equation_solution_id: + type: integer + step: + type: string + put: + tags: + - solution + summary: Updates a simple equation + operationId: updateSimpleEquationSolution + security: + - JWT: + - read + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + result: + type: string + steps: + type: array + items: + type: object + properties: + simple_equation_solution_id: + type: integer + description: If you want to create a new step at the end just + increment the last step id by one. If you want to change + the order of the steps you can change the simple equation + solution ids of all the steps to do so. + step: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + result: + type: string + steps: + type: array + items: + type: object + properties: + simple_equation_solution_id: + type: integer + step: + type: string + /solution/simple_equation/check: + post: + tags: + - solution + summary: check a simple equation solution + operationId: checkSimpleEquationSolution + security: + - JWT: + - read + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + result: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + correct: + type: boolean + result: + type: string + steps: + type: array + items: + type: object + properties: + simple_equation_solution_id: + type: integer + step: + type: string + /solution/simple_equation/{task_id}: + delete: + tags: + - solution + summary: deletes a simple_equation solution + operationId: deleteSimpleEquationSolution + security: + - JWT: + - read + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: task_id + in: path + required: true + schema: + type: integer + format: int32 + minimum: 1 + responses: + '200': + description: Ok + /subject: + post: + tags: + - subject + summary: Create a subject + operationId: createSubject + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name_key: + type: string + example: maths + description_key: + type: string + example: calculating numbers + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Subject' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + get: + tags: + - subject + summary: Get all subjects + operationId: getSubjects + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + subjects: + type: array + items: + $ref: '#/components/schemas/Subject' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /subject/{name_key}: + get: + tags: + - subject + summary: Get subject by name_key + operationId: getSubjectbyname_key + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: name_key + in: path + required: true + schema: + type: string + example: maths + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Subject' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - subject + summary: Delete subject by name_key + operationId: deleteSubjectbyname_key + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: name_key + in: path + required: true + schema: + type: string + example: maths + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /subject/{subject_id}: + get: + tags: + - subject + summary: Get subject by subject_id + operationId: getSubjectbysubject_id + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: subject_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Subject' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - subject + summary: Delete subject by subject_id + operationId: deleteSubjectbysubject_id + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: subject_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /module: + post: + tags: + - module + summary: Create module + operationId: createModule + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name_key: + type: string + example: geometry + subject_name_key: + type: string + example: maths + subject_id: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: "#/components/schemas/Module" + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + get: + tags: + - module + summary: Get all modules + operationId: getModules + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + modules: + type: array + items: + $ref: '#/components/schemas/Module' + /module/{name_key}: + get: + tags: + - module + summary: Get module by name_key + operationId: getModulebyname_key + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: name_key + in: path + required: true + example: geometry + schema: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Module' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - module + summary: Delete Module by name_key + operationId: deleteModulebyname_key + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: name_key + in: path + required: true + example: geometry + schema: + type: string + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /module/{module_id}: + get: + tags: + - module + summary: Get module by module_id + operationId: getModulebymodule_id + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: module_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Module' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - module + summary: Delete Module by module_id + operationId: deleteModulebymodule_id + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: module_id + in: path + required: true + schema: + type: integer + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /subject/{subject_name_key}/module: + get: + tags: + - subject + summary: Get modules from subject + operationId: getModulesFromSubjectbyname_key + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: subject_name_key + in: path + required: true + schema: + type: string + example: maths + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + modules: + type: array + items: + $ref: '#/components/schemas/Module' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /subject/{subject_id}/module: + get: + tags: + - subject + summary: Get modules from subject + operationId: getModulesFromSubjectbysubject_id + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: subject_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + modules: + type: array + items: + $ref: '#/components/schemas/Module' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /lecture: + post: + tags: + - lecture + summary: Create lecture + operationId: createLecture + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name_key: + type: string + example: squares + module_name_key: + type: string + example: geometry + module_id: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + lecture_id: + type: integer + example: 1 + name_key: + type: string + example: squares + module_name_key: + type: string + example: geometry + module_id: + type: integer + example: 1 + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + get: + tags: + - lecture + summary: Get all lectures + operationId: getLectures + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + lectures: + type: array + items: + $ref: '#/components/schemas/Lecture' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /lecture/{lecture_id}: + get: + tags: + - lecture + summary: Get lecture by id + operationId: getLecturebyid + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: lecture_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Lecture' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - lecture + summary: Delete Lecture by id + operationId: deleteLecturebyid + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: lecture_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /lecture/{name_key}: + get: + tags: + - lecture + summary: Get lecture by name_key + operationId: getLecturebyname_key + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: name_key + in: path + required: true + schema: + type: string + example: squares + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Lecture' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - lecture + summary: Delete Lecture by name_key + operationId: deleteLecturebyname_key + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: name_key + in: path + required: true + schema: + type: string + example: squares + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /lecture/{lecture_id}/task: + get: + tags: + - lecture + summary: Get all Tasks by lecture_id + operationId: getTaskByLectureId + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + - name: lecture_id + in: path + required: true + description: The unique lecture id + schema: + type: integer + format: int32 + minimum: 1 + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + tasks: + type: array + items: + $ref: '#/components/schemas/Task' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /lecture/{name_key}/task: + get: + tags: + - lecture + summary: Get all Tasks by lecture_name_key + operationId: getTaskByLectureNameKey + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/JWT' + - name: X-ServiceToken + in: header + required: true + description: View schema + schema: + $ref: '#/components/schemas/X-ServiceToken' + - name: name_key + in: path + required: true + description: The unique lecture name key + schema: + type: string + example: geometry + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + tasks: + type: array + items: + $ref: '#/components/schemas/Task' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /module/{module_name_key}/lecture: + get: + tags: + - module + summary: Get lectures from module_name_key + operationId: getLecturesFromModule_name_key + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: module_name_key + in: path + required: true + schema: + type: string + example: geometry + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + lectures: + type: array + items: + $ref: '#/components/schemas/Lecture' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /module/{module_id}/lecture: + get: + tags: + - module + summary: Get lectures from module_id + operationId: getLecturesFromModule_id + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: module_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + lectures: + type: array + items: + $ref: '#/components/schemas/Lecture' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /difficulty: + post: + tags: + - difficulty + summary: Create difficulty + operationId: createDifficulty + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name_key: + type: string + example: easy + + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + difficulty_id: + type: integer + example: 1 + name_key: + type: string + example: easy + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + get: + tags: + - difficulty + summary: Get all difficultys + operationId: getDifficultys + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + difficulties: + type: array + items: + $ref: '#/components/schemas/Difficulty' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /difficulty/{name_key}: + get: + tags: + - difficulty + summary: Get difficulty by name_key + operationId: getDifficultybyname_key + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: false + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: name_key + in: path + required: true + schema: + type: string + example: easy + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Difficulty' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - difficulty + summary: Delete difficulty by name_key + operationId: deleteDifficultybyname_key + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: false + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: name_key + in: path + required: true + schema: + type: string + example: easy + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /difficulty/{difficulty_id}: + get: + tags: + - difficulty + summary: Get difficulty by difficulty_id + operationId: getDifficultybydifficulty_id + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: false + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: difficulty_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Difficulty' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - difficulty + summary: Delete difficulty by difficulty_id + operationId: deleteDifficultybydifficulty_id + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: false + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + - name: difficulty_id + in: path + required: true + schema: + type: integer + responses: + '200': + description: Ok + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task_type: + post: + tags: + - task_type + summary: Create task type + operationId: createTaskType + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name_key: + type: string + example: exercise + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/TaskType' + + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + get: + tags: + - task_type + summary: Get all task types + operationId: getAllTaskTypes + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + schema: + type: string + - name: X-ServiceToken + in: header + required: true + schema: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + task_types: + type: array + items: + $ref: '#/components/schemas/TaskType' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task_type/{name_key}: + get: + tags: + - task_type + summary: Get task type by name_key + operationId: getTaskTypebyname_key + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + schema: + type: string + - name: name_key + in: path + required: true + schema: + type: string + example: exercise + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/TaskType' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - task_type + summary: Delete task type by name_key + operationId: deleteTaskTypebyname_key + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + schema: + type: string + - name: name_key + in: path + required: true + schema: + type: string + example: exercise + responses: + '200': + description: Ok + '400': + description: Internal Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /task_type/{task_type_id}: + get: + tags: + - task_type + summary: Get task type by task_type_id + operationId: getTaskTypebyid + security: + - JWT: + - read + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + schema: + type: string + - name: task_type_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/TaskType' + '400': + description: User Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - task_type + summary: Delete task type by task_type_id + operationId: deleteTaskTypebytask_type_id + security: + - JWT: + - write + - ServiceToken: + - read + - write + parameters: + - name: Authorization + in: header + required: true + schema: + type: string + - name: task_type_id + in: path + required: true + schema: + type: integer + example: 1 + responses: + '200': + description: Ok + '400': + description: Internal Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' +components: + securitySchemes: + JWT: + type: http + scheme: bearer + bearerFormat: JWT + ServiceToken: + type: http + scheme: bearer + bearerFormat: randomstring + responses: + BadRequest: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + Unauthorized: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + Forbidden: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + NotFound: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + MethodNotAllowed: + description: Method not allowed + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + NotAcceptable: + description: Not acceptable + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + RequestTimeout: + description: Request timeout + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + Conflict: + description: Conflict + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + Gone: + description: Gone + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + LengthRequiered: + description: Length requiered + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + PreconditionFailed: + description: Precondition failed + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + PayloadTooLarge: + description: Payload too large + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + RequestURITooLong: + description: Request-URI too long + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + RequestRangeNotSatisfiable: + description: Request range not satisfiable + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + ExpectationFailed: + description: Expectation failed + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + UnprocessableEntity: + description: Unprocessable entity + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + Locked: + description: Locked + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + TooManyRequests: + description: Too many requests + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + NoResponse: + description: No response + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + InternalServerError: + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + NotImplemented: + description: Not implemented + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + BadGateway: + description: BadGateway + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + ServiceUnavailable: + description: Service unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + Insufficient Storage: + description: Insufficient Storage + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + LoopDetected: + description: Loop detected + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + BandwidthLimitExceeded: + description: Bandwidth limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + NotExtended: + description: Not extended + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + NetworkAuthenticationRequired: + description: Network authentication required + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + NetworkConnectTimeoutError: + description: Network connect timeout error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + schemas: + JWT: + type: string + example: "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1ODk0ODE3NDEsImV4cCI6MTYwOTQ1NTYwMCwibm9uY2UiOiJuaWNlbGl0dGxlcmFuZG9tc3RyaW5nIiwiYXVkIjpbImdld2lhLmNvbSJdLCJzY29wZXMiOlsidGFzay50YXNrLnJlYWQuYWxsIiwidGFzay50YXNrLndyaXRlLmFsbCIsInRhc2sudGFzay5kZWxldGUuYWxsIiwidGFzay50YXNrZ3JvdXAucmVhZC5hbGwiLCJ0YXNrLnRhc2tncm91cC53cml0ZS5hbGwiLCJ0YXNrLnRhc2tncm91cC5kZWxldGUuYWxsIiwidGFzay5zdWJqZWN0LnJlYWQuYWxsIiwidGFzay5zdWJqZWN0LndyaXRlLmFsbCIsInRhc2suc3ViamVjdC5kZWxldGUuYWxsIiwidGFzay5tb2R1bGUucmVhZC5hbGwiLCJ0YXNrLm1vZHVsZS53cml0ZS5hbGwiLCJ0YXNrLm1vZHVsZS5kZWxldGUuYWxsIiwidGFzay5sZWN0dXJlLnJlYWQuYWxsIiwidGFzay5sZWN0dXJlLndyaXRlLmFsbCIsInRhc2subGVjdHVyZS5kZWxldGUuYWxsIiwidGFzay5kaWZmaWN1bHR5LnJlYWQuYWxs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cml0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLnNpbXBsZWVxdWF0aW9uLmRlbGV0ZS5hbGwiXX0.m3MuV-N7lkYn3SSamesEZ1o6FMrrMNQBXMv8JneSuoXu-5KgN2p7VMZJlvXN0_toKQQ1wixlGh-DxSO6pEfU_w" + description: "Json Web Token (Example has all scopes, expires 2021, HS512 encoding, secret: 'SECRET')" + X-ServiceToken: + type: string + example: "SECRET" + description: "ServiceToken to force just using gateway" + Task: + type: object + properties: + task_id: + type: integer + example: 1 + task: + type: string + example: "Calculate Term" + description: + type: string + example: "Calculate the following Term: 3(6*7-9)/3" + language: + type: string + example: "de-DE" + author_id: + type: string + example: "52bd088c-d6ad-4cee-9f93-cabfc8c07234" + necessary_points: + type: integer + example: 100 + verified: + type: boolean + example: false + lecture: + type: object + properties: + lecture_id: + type: integer + example: 1 + name_key: + type: string + example: "geometry" + module_id: + type: integer + example: 1 + task_type: + type: object + properties: + task_type_id: + type: integer + example: 1 + name_key: + type: string + example: "exercise" + difficulty: + type: object + properties: + difficulty_id: + type: integer + example: 1 + name_key: + type: string + example: "easy" + TaskVote: + type: object + properties: + task_vote_id: + type: integer + example: 1 + user_id: + type: string + example: "52bd088c-d6ad-4cee-9f93-cabfc8c07234" + value: + type: integer + example: 1 + TaskGroup: + type: object + properties: + task_group_id: + type: integer + example: 1 + lecture_id: + type: integer + example: 1 + name_key: + type: string + example: Tolles-Aufgaben-Pack + task_ids: + type: array + items: + type: integer + example: 1 + author_id: + type: string + example: 0b870676-1a01-47aa-8402-859fb9806238 + difficulty_id: + type: integer + example: 1 + Lecture: + type: object + properties: + lecture_id: + type: integer + example: 1 + name_key: + type: string + example: squares + module_id: + type: integer + example: 1 + Module: + type: object + properties: + module_id: + type: integer + example: 1 + name_key: + type: string + example: geometry + subject_id: + type: integer + example: 1 + Subject: + type: object + properties: + subject_id: + type: integer + example: 1 + name_key: + type: string + example: maths + description_key: + type: string + example: calculating numbers + Difficulty: + type: object + properties: + difficulty_id: + type: integer + example: 1 + name_key: + type: string + example: easy + TaskType: + type: object + properties: + task_type_id: + type: integer + example: 1 + name_key: + type: string + example: exercise + SampleSolution: + type: object + properties: + task_id: + type: integer + solution: + type: string + description: Sample solution + Error: + oneOf: + - $ref: '#/components/schemas/InternalError' + - $ref: '#/components/schemas/ValidationError' + - $ref: '#/components/schemas/ControllerError' + InternalError: + type: object + properties: + timestamp: + type: string + example: 2020-03-22T20:26:47.367+0000 + status: + type: string + example: 404 + error: + type: string + example: Not Found + message: + type: string + path: + type: string + ValidationError: + type: object + properties: + timestamp: + type: string + example: 2020-03-22T14:52:51.714+0000 + status: + type: string + example: 400 + error: + type: string + example: Bad Request + message: + type: string + path: + type: string + errors: + type: array + items: + type: object + properties: + codes: + type: array + items: + type: string + arguments: + type: array + items: + additionalProperties: + type: string + default_message: + type: string + object_name: + type: string + field: + type: string + rejected_value: + type: string + binding_failure: + type: boolean + code: + type: string + ControllerError: + type: object + properties: + status: + type: integer + example: 404 + message_key: + type: string + example: NOT_FOUND + extra: + type: string + example: task + required: + - message_key + - status \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index fc44ae5..af1e327 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,12 +4,12 @@ services: influxdb: image: influxdb:latest ports: - - "8086:8086" + - "8087:8086" gateway_grafana: image: grafana/grafana:latest ports: - - "3000:3000" + - "3001:3000" user: "0" links: - influxdb @@ -20,7 +20,7 @@ services: image: eedu/gateway container_name: eedu-gateway ports: - - 80:80 + - 81:80 environment: JWT_SECRET: SECRET SERVICE_SECRET: SECRET diff --git a/gateway-core/pom.xml b/gateway-core/pom.xml new file mode 100644 index 0000000..f52d168 --- /dev/null +++ b/gateway-core/pom.xml @@ -0,0 +1,347 @@ + + + + gateway + de.the-morpheus.e-du + 0.1-SNAPSHOT + + 4.0.0 + + gateway-core + + + + + org.springframework.boot + spring-boot-starter-parent + 2.2.6.RELEASE + pom + import + + + + + + + org.springframework.boot + spring-boot + 2.2.6.RELEASE + + + + org.springframework.boot + spring-boot-autoconfigure + 2.2.6.RELEASE + + + + org.springframework.boot + spring-boot-configuration-processor + 2.2.6.RELEASE + true + + + + org.springframework.boot + spring-boot-starter-test + 2.2.6.RELEASE + test + + + + org.apache.logging.log4j + log4j-core + 2.13.2 + compile + + + org.apache.logging.log4j + log4j-api + + + + + org.apache.logging.log4j + log4j-api + 2.13.2 + compile + + + org.slf4j + slf4j-api + 1.7.25 + compile + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.13.2 + compile + + + io.sentry + sentry-log4j2 + 1.7.30 + compile + + + org.apache.logging.log4j + log4j-api + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-to-slf4j + + + + + + org.projectlombok + lombok + 1.18.12 + compile + + + javax.validation + validation-api + 2.0.1.Final + compile + + + com.auth0 + java-jwt + 3.10.1 + compile + + + com.squareup.okhttp3 + okhttp + 4.5.0 + compile + + + com.google.code.gson + gson + 2.8.6 + compile + + + javax.servlet + javax.servlet-api + 4.0.1 + compile + + + com.google.code.findbugs + jsr305 + 1.3.9 + compile + + + + + org.springframework.boot + spring-boot-starter-actuator + 2.3.0.M4 + compile + + + commons-logging + commons-logging + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter + 2.3.0.M4 + + + commons-logging + commons-logging + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-devtools + 2.2.6.RELEASE + + + commons-logging + commons-logging + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework + spring-webmvc + 5.2.6.RELEASE + + + commons-logging + commons-logging + + + org.springframework.boot + spring-boot-starter-logging + + + + + + + io.micrometer + micrometer-core + 1.4.1 + compile + + + io.micrometer + micrometer-registry-influx + 1.4.1 + compile + + + + + com.graphql-java-kickstart + graphql-spring-boot-starter + 7.0.0 + compile + + + com.graphql-java-kickstart + playground-spring-boot-starter + 7.0.0 + compile + + + com.graphql-java-kickstart + graphql-java-tools + 6.0.2 + compile + + + com.careykevin + graphql-actuator + 0.0.3 + compile + + + de.the-morpheus.e-du + backend-api + 0.1-SNAPSHOT + compile + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.9 + 1.9 + + + + pl.project13.maven + git-commit-id-plugin + 4.0.0 + + + get-the-git-infos + + revision + + + + + ${project.basedir}/.git + git + false + true + ${project.build.outputDirectory}/git.properties + json + + false + false + -dirty + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.2.6.RELEASE + + + + repackage + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.1 + + checkstyle.xml + UTF-8 + true + true + false + + + + validate + validate + + check + + + + + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + \ No newline at end of file diff --git a/src/main/java/de/themorpheus/edu/gateway/GatewayApplication.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/GatewayApplication.java similarity index 97% rename from src/main/java/de/themorpheus/edu/gateway/GatewayApplication.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/GatewayApplication.java index 5d79556..dd11f60 100644 --- a/src/main/java/de/themorpheus/edu/gateway/GatewayApplication.java +++ b/gateway-core/src/main/java/de/themorpheus/edu/gateway/GatewayApplication.java @@ -11,12 +11,14 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.io.IOException; @EnableGraphQLActuator @SpringBootApplication +@Import(TaskApiConfiguration.class) public class GatewayApplication { public static final boolean PRODUCTIVE = Boolean.parseBoolean(System.getenv("PRODUCTIVE")); diff --git a/gateway-core/src/main/java/de/themorpheus/edu/gateway/TaskApiConfiguration.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/TaskApiConfiguration.java new file mode 100644 index 0000000..190059b --- /dev/null +++ b/gateway-core/src/main/java/de/themorpheus/edu/gateway/TaskApiConfiguration.java @@ -0,0 +1,36 @@ +package de.themorpheus.edu.gateway; + +import de.themorpheus.edu.backend.api.*; +import de.themorpheus.edu.backend.invoker.ApiClient; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class TaskApiConfiguration { + + @Bean + public TaskApi taskApi() { + return new TaskApi(apiClient()); + } + + @Bean + public TaskTypeApi taskTypeApi() { return new TaskTypeApi(apiClient()); } + + @Bean + public LectureApi lectureApi() { return new LectureApi(apiClient()); } + + @Bean + public ModuleApi moduleApi() { return new ModuleApi(apiClient()); } + + @Bean + public SubjectApi subjectApi() { return new SubjectApi(apiClient()); } + + @Bean + public DifficultyApi difficultyApi() { return new DifficultyApi(apiClient()); } + + @Bean + public ApiClient apiClient() { + return new ApiClient(); + } + +} diff --git a/src/main/java/de/themorpheus/edu/gateway/backend/BackendAPI.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/BackendAPI.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/backend/BackendAPI.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/BackendAPI.java diff --git a/src/main/java/de/themorpheus/edu/gateway/backend/Service.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/Service.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/backend/Service.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/Service.java diff --git a/src/main/java/de/themorpheus/edu/gateway/backend/UserService.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/UserService.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/backend/UserService.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/UserService.java diff --git a/src/main/java/de/themorpheus/edu/gateway/backend/user/UserCreateDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/user/UserCreateDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/backend/user/UserCreateDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/user/UserCreateDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/backend/user/UserErrorResponseDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/user/UserErrorResponseDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/backend/user/UserErrorResponseDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/user/UserErrorResponseDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/backend/user/UserLoginRequestDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/user/UserLoginRequestDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/backend/user/UserLoginRequestDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/user/UserLoginRequestDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/backend/user/UserLoginResponseDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/user/UserLoginResponseDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/backend/user/UserLoginResponseDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/backend/user/UserLoginResponseDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/generic/ServiceInfoDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/generic/ServiceInfoDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/generic/ServiceInfoDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/generic/ServiceInfoDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/report/TicketDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/report/TicketDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/report/TicketDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/report/TicketDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/DifficultyDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/DifficultyDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/DifficultyDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/DifficultyDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/LectureDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/LectureDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/LectureDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/LectureDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/ModuleDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/ModuleDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/ModuleDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/ModuleDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/SubjectDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/SubjectDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/SubjectDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/SubjectDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/TaskDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/TaskDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/TaskDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/TaskDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/TaskTypeDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/TaskTypeDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/TaskTypeDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/task/TaskTypeDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/JwtResultDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/JwtResultDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/JwtResultDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/JwtResultDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserAuthDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserAuthDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserAuthDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserAuthDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserAuthResultDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserAuthResultDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserAuthResultDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserAuthResultDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserRegisterDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserRegisterDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserRegisterDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserRegisterDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserRegisterResultDTO.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserRegisterResultDTO.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserRegisterResultDTO.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/dto/user/UserRegisterResultDTO.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/mutation/user/AuthenticationResolver.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/mutation/user/AuthenticationResolver.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/resolver/mutation/user/AuthenticationResolver.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/mutation/user/AuthenticationResolver.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/ServiceInfoResolver.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/ServiceInfoResolver.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/ServiceInfoResolver.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/ServiceInfoResolver.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/report/TicketResolver.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/report/TicketResolver.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/report/TicketResolver.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/report/TicketResolver.java diff --git a/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/DifficultyResolver.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/DifficultyResolver.java new file mode 100644 index 0000000..09056f0 --- /dev/null +++ b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/DifficultyResolver.java @@ -0,0 +1,26 @@ +package de.themorpheus.edu.gateway.graphql.resolver.query.task; + +import de.themorpheus.edu.backend.api.DifficultyApi; +import de.themorpheus.edu.backend.invoker.ApiException; +import de.themorpheus.edu.backend.model.Difficulty; +import de.themorpheus.edu.gateway.graphql.dto.task.DifficultyDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import javax.validation.constraints.Min; +import graphql.kickstart.tools.GraphQLQueryResolver; +import graphql.schema.DataFetchingEnvironment; + +@Component +public class DifficultyResolver implements GraphQLQueryResolver { + + @Autowired private DifficultyApi difficultyApi; + + public DifficultyDTO difficultyById(@Min(0) int difficultyId) throws ApiException { + Difficulty difficulty = difficultyApi.getDifficultybydifficultyId("SECRET", difficultyId, "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1ODk0ODE3NDEsImV4cCI6MTYwOTQ1NTYwMCwibm9uY2UiOiJuaWNlbGl0dGxlcmFuZG9tc3RyaW5nIiwiYXVkIjpbImdld2lhLmNvbSJdLCJzY29wZXMiOlsidGFzay50YXNrLnJlYWQuYWxsIiwidGFzay50YXNrLndyaXRlLmFsbCIsInRhc2sudGFzay5kZWxldGUuYWxsIiwidGFzay50YXNrZ3JvdXAucmVhZC5hbGwiLCJ0YXNrLnRhc2tncm91cC53cml0ZS5hbGwiLCJ0YXNrLnRhc2tncm91cC5kZWxldGUuYWxsIiwidGFzay5zdWJqZWN0LnJlYWQuYWxsIiwidGFzay5zdWJqZWN0LndyaXRlLmFsbCIsInRhc2suc3ViamVjdC5kZWxldGUuYWxsIiwidGFzay5tb2R1bGUucmVhZC5hbGwiLCJ0YXNrLm1vZHVsZS53cml0ZS5hbGwiLCJ0YXNrLm1vZHVsZS5kZWxldGUuYWxsIiwidGFzay5sZWN0dXJlLnJlYWQuYWxsIiwidGFzay5sZWN0dXJlLndyaXRlLmFsbCIsInRhc2subGVjdHVyZS5kZWxldG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iwidGFzay5zb2x1dGlvbi5zaW1wbGVlcXVhdGlvbi53cml0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLnNpbXBsZWVxdWF0aW9uLmRlbGV0ZS5hbGwiXX0.m3MuV-N7lkYn3SSamesEZ1o6FMrrMNQBXMv8JneSuoXu-5KgN2p7VMZJlvXN0_toKQQ1wixlGh-DxSO6pEfU_w"); + return new DifficultyDTO( + difficulty.getDifficultyId(), + difficulty.getNameKey() + ); + } + +} diff --git a/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/LectureResolver.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/LectureResolver.java new file mode 100644 index 0000000..94f1631 --- /dev/null +++ b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/LectureResolver.java @@ -0,0 +1,27 @@ +package de.themorpheus.edu.gateway.graphql.resolver.query.task; + +import de.themorpheus.edu.backend.api.LectureApi; +import de.themorpheus.edu.backend.invoker.ApiException; +import de.themorpheus.edu.backend.model.Lecture; +import de.themorpheus.edu.gateway.graphql.dto.task.LectureDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import javax.validation.constraints.Min; +import graphql.kickstart.tools.GraphQLQueryResolver; + +@Component +public class LectureResolver implements GraphQLQueryResolver { + + @Autowired private LectureApi lectureApi; + @Autowired private ModuleResolver moduleResolver; + + public LectureDTO lectureById(@Min(0) int lectureId) throws ApiException { + Lecture lecture = lectureApi.getLecturebyid("SECRET", lectureId, "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1ODk0ODE3NDEsImV4cCI6MTYwOTQ1NTYwMCwibm9uY2UiOiJuaWNlbGl0dGxlcmFuZG9tc3RyaW5nIiwiYXVkIjpbImdld2lhLmNvbSJdLCJzY29wZXMiOlsidGFzay50YXNrLnJlYWQuYWxsIiwidGFzay50YXNrLndyaXRlLmFsbCIsInRhc2sudGFzay5kZWxldGU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c2suc29sdXRpb24uZnJlZXN0eWxlLmRlbGV0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLmltYWdlLnJlYWQuYWxsIiwidGFzay5zb2x1dGlvbi5pbWFnZS53cml0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLmltYWdlLmRlbGV0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLnRvcGljY29ubmVjdGlvbi5yZWFkLmFsbCIsInRhc2suc29sdXRpb24udG9waWNjb25uZWN0aW9uLndyaXRlLmFsbCIsInRhc2suc29sdXRpb24udG9waWNjb25uZWN0aW9uLmRlbGV0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLnNpbXBsZWVxdWF0aW9uLnJlYWQuYWxsIiwidGFzay5zb2x1dGlvbi5zaW1wbGVlcXVhdGlvbi53cml0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLnNpbXBsZWVxdWF0aW9uLmRlbGV0ZS5hbGwiXX0.m3MuV-N7lkYn3SSamesEZ1o6FMrrMNQBXMv8JneSuoXu-5KgN2p7VMZJlvXN0_toKQQ1wixlGh-DxSO6pEfU_w"); + return new LectureDTO( + lecture.getLectureId(), + lecture.getNameKey(), + moduleResolver.moduleById(lecture.getModuleId()) + ); + } + +} diff --git a/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/ModuleResolver.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/ModuleResolver.java new file mode 100644 index 0000000..d72b203 --- /dev/null +++ b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/ModuleResolver.java @@ -0,0 +1,28 @@ +package de.themorpheus.edu.gateway.graphql.resolver.query.task; + +import de.themorpheus.edu.backend.api.ModuleApi; +import de.themorpheus.edu.backend.api.SubjectApi; +import de.themorpheus.edu.backend.invoker.ApiException; +import de.themorpheus.edu.backend.model.Module; +import de.themorpheus.edu.gateway.graphql.dto.task.ModuleDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import javax.validation.constraints.Min; +import graphql.kickstart.tools.GraphQLQueryResolver; + +@Component +public class ModuleResolver implements GraphQLQueryResolver { + + @Autowired private ModuleApi moduleApi; + @Autowired private SubjectResolver subjectResolver; + + public ModuleDTO moduleById(@Min(0) int moduleId) throws ApiException { + Module module = moduleApi.getModulebymoduleId("SECRET", moduleId, "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1ODk0ODE3NDEsImV4cCI6MTYwOTQ1NTYwMCwibm9uY2UiOiJuaWNlbGl0dGxlcmFuZG9tc3RyaW5nIiwiYXVkIjpbImdld2lhLmNvbSJdLCJzY29wZXMiOlsidGFzay50YXNrLnJlYWQuYWxsIiwidGFzay50YXNrLndyaXRlLmFsbCIsInRhc2sudGFzay5kZWxldGUuYWxsIiwidGFzay50YXNrZ3JvdXAucmVhZC5hbGwiLCJ0YXNrLnRhc2tncm91cC53cml0ZS5hbGwiLCJ0YXNrLnRhc2tncm91cC5kZWxldGUuYWxsIiwidGFzay5zdWJqZWN0LnJlYWQuYWxsIiwidGFzay5zdWJqZWN0LndyaXRlLmFsbCIsInRhc2suc3ViamVjdC5kZWxldGUuYWxsIiwidGFzay5tb2R1bGUucmVhZC5hbGwiLCJ0YXNrLm1vZHVsZS53cml0ZS5hbGwiLCJ0YXNrLm1vZHVsZS5kZWxldGUuYWxsIiwidGFzay5sZWN0dXJlLnJlYWQuYWxsIiwidGFzay5sZWN0dXJlLndyaXRlLmFsbCIsInRhc2subGVjdHVyZS5kZWxldGUuYWxsIiwidGFzay5kaWZmaWN1bHR5LnJlYWQuYWxsIiwidGFzay5kaWZmaWN1bHR5LndyaXRlLmFsbCIsInRhc2suZGlmZmljdWx0eS5kZWxldGUuYWxsIiwidGFzay50YXNrdHlwZS5yZWFkLmFsbCIsInRhc2sudGFza3R5cGUud3JpdGUuYWxsIiwidGFzay50YXNrdHlwZS5kZWxldGUuYWxsIiwidGFzay51c2VyLnJlYWQuYWx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Key(), + subjectResolver.subjectById(module.getSubjectId()) + ); + } + +} diff --git a/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/SubjectResolver.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/SubjectResolver.java new file mode 100644 index 0000000..320824f --- /dev/null +++ b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/SubjectResolver.java @@ -0,0 +1,25 @@ +package de.themorpheus.edu.gateway.graphql.resolver.query.task; + +import de.themorpheus.edu.backend.api.SubjectApi; +import de.themorpheus.edu.backend.invoker.ApiException; +import de.themorpheus.edu.backend.model.Subject; +import de.themorpheus.edu.gateway.graphql.dto.task.SubjectDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import javax.validation.constraints.Min; +import graphql.kickstart.tools.GraphQLQueryResolver; + +@Component +public class SubjectResolver implements GraphQLQueryResolver { + + @Autowired private SubjectApi subjectApi; + + public SubjectDTO subjectById(@Min(0) int subjectId) throws ApiException { + Subject subject = subjectApi.getSubjectbysubjectId("SECRET", subjectId, "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1ODk0ODE3NDEsImV4cCI6MTYwOTQ1NTYwMCwibm9uY2UiOiJuaWNlbGl0dGxlcmFuZG9tc3RyaW5nIiwiYXVkIjpbImdld2lhLmNvbSJdLCJzY29wZXMiOlsidGFzay50YXNrLnJlYWQuYWxsIiwidGFzay50YXNrLndyaXRlLmFsbCIsInRhc2sudGFzay5kZWxldGUuYWxsIiwidGFzay50YXNrZ3JvdXAucmVhZC5hbGwiLCJ0YXNrLnRhc2tncm91cC53cml0ZS5hbGwiLCJ0YXNrLnRhc2tncm91cC5kZWxldGUuYWxsIiwidGFzay5zdWJqZWN0LnJlYWQuYWxsIiwidGFzay5zdWJqZWN0LndyaXRlLmFsbCIsInRhc2suc3ViamVjdC5kZWxldGUuYWxsIiwidGFzay5tb2R1bGUucmVhZC5hbGw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hc2suc29sdXRpb24udG9waWNjb25uZWN0aW9uLndyaXRlLmFsbCIsInRhc2suc29sdXRpb24udG9waWNjb25uZWN0aW9uLmRlbGV0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLnNpbXBsZWVxdWF0aW9uLnJlYWQuYWxsIiwidGFzay5zb2x1dGlvbi5zaW1wbGVlcXVhdGlvbi53cml0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLnNpbXBsZWVxdWF0aW9uLmRlbGV0ZS5hbGwiXX0.m3MuV-N7lkYn3SSamesEZ1o6FMrrMNQBXMv8JneSuoXu-5KgN2p7VMZJlvXN0_toKQQ1wixlGh-DxSO6pEfU_w"); + return new SubjectDTO( + subject.getSubjectId(), + subject.getNameKey() + ); + } + +} diff --git a/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskResolver.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskResolver.java new file mode 100644 index 0000000..1cfdbc2 --- /dev/null +++ b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskResolver.java @@ -0,0 +1,70 @@ +package de.themorpheus.edu.gateway.graphql.resolver.query.task; + +import de.themorpheus.edu.backend.api.TaskApi; +import de.themorpheus.edu.backend.invoker.ApiException; +import de.themorpheus.edu.backend.model.Task; +import de.themorpheus.edu.gateway.graphql.dto.task.DifficultyDTO; +import de.themorpheus.edu.gateway.graphql.dto.task.LectureDTO; +import de.themorpheus.edu.gateway.graphql.dto.task.ModuleDTO; +import de.themorpheus.edu.gateway.graphql.dto.task.SubjectDTO; +import de.themorpheus.edu.gateway.graphql.dto.task.TaskDTO; +import de.themorpheus.edu.gateway.graphql.dto.task.TaskTypeDTO; +import de.themorpheus.edu.gateway.graphql.resolver.query.user.UserResolver; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import javax.validation.constraints.Min; + +import graphql.kickstart.tools.GraphQLQueryResolver; +import graphql.schema.DataFetchingEnvironment; + +@Component +public class TaskResolver implements GraphQLQueryResolver { + + @Autowired private TaskApi taskApi; + @Autowired private TaskTypeResolver taskTypeResolver; + @Autowired private LectureResolver lectureResolver; + + public static final TaskDTO EXAMPLE = new TaskDTO( + 0, + "Create something", + UserResolver.EXAMPLE, + 10, + new TaskTypeDTO( + 0, + "Exercise" + ), + new LectureDTO( + 0, + "Integralrechnung", + new ModuleDTO( + 0, + "Analysis", + new SubjectDTO( + 0, + "Math" + ) + ) + ), + new DifficultyDTO( + 0, + "Hard" + ) + ); + + public TaskDTO taskById(@Min(0) int taskId, DataFetchingEnvironment environment) throws ApiException{ + Task task = taskApi.getTask("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1ODk0ODE3NDEsImV4cCI6MTYwOTQ1NTYwMCwibm9uY2UiOiJuaWNlbGl0dGxlcmFuZG9tc3RyaW5nIiwiYXVkIjpbImdld2lhLmNvbSJdLCJzY29wZXMiOlsidGFzay50YXNrLnJlYWQuYWxsIiwidGFzay50YXNrLndyaXRlLmFsbCIsInRhc2sudGFzay5kZWxldGUuYWxsIiwidGFzay50YXNrZ3JvdXAucmVhZC5hbGwiLCJ0YXNrLnRhc2tncm91cC53cml0ZS5hbGwiLCJ0YXNrLnRhc2tncm91cC5kZWxldGUuYWxsIiwidGFzay5zdWJqZWN0LnJlYWQuYWxsIiwidGFzay5zdWJqZWN0LndyaXRlLmFsbCIsInRhc2suc3ViamVjdC5kZWxldGUuYWxsIiwidGFzay5tb2R1bGUucmVhZC5hbGwiLCJ0YXNrLm1vZHVsZS53cml0ZS5hbGwiLCJ0YXNrLm1vZHVsZS5kZWxldGUuYWxsIiwidGFzay5sZWN0dXJlLnJlYWQuYWxsIiwidGFzay5sZWN0dXJlLndyaXRlLmFsbCIsInRhc2subGVjdHVyZS5kZWxldGUuYWxsIiwidGFzay5kaWZmaWN1bHR5LnJlYWQuYWxsIiwidGFzay5kaWZmaWN1bHR5LndyaXRlLmFsbCIsIn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XBsZWVxdWF0aW9uLmRlbGV0ZS5hbGwiXX0.m3MuV-N7lkYn3SSamesEZ1o6FMrrMNQBXMv8JneSuoXu-5KgN2p7VMZJlvXN0_toKQQ1wixlGh-DxSO6pEfU_w", "SECRET", taskId); + return new TaskDTO( + task.getTaskId(), + task.getTask(), + UserResolver.EXAMPLE, + task.getNecessaryPoints(), + taskTypeResolver.taskTypeById(task.getTaskType().getTaskTypeId(), environment), + lectureResolver.lectureById(task.getLecture().getLectureId()), + new DifficultyDTO( + 0, + "Hard" + ) + ); + } + +} diff --git a/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskTypeResolver.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskTypeResolver.java new file mode 100644 index 0000000..bfca714 --- /dev/null +++ b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskTypeResolver.java @@ -0,0 +1,26 @@ +package de.themorpheus.edu.gateway.graphql.resolver.query.task; + +import de.themorpheus.edu.backend.api.TaskTypeApi; +import de.themorpheus.edu.backend.invoker.ApiException; +import de.themorpheus.edu.backend.model.TaskType; +import de.themorpheus.edu.gateway.graphql.dto.task.TaskTypeDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import javax.validation.constraints.Min; +import graphql.kickstart.tools.GraphQLQueryResolver; +import graphql.schema.DataFetchingEnvironment; + +@Component +public class TaskTypeResolver implements GraphQLQueryResolver { + + @Autowired private TaskTypeApi taskTypeApi; + + public TaskTypeDTO taskTypeById(@Min(0) int taskTypeId, DataFetchingEnvironment environment) throws ApiException { + TaskType taskType = taskTypeApi.getTaskTypebyid("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1ODk0ODE3NDEsImV4cCI6MTYwOTQ1NTYwMCwibm9uY2UiOiJuaWNlbGl0dGxlcmFuZG9tc3RyaW5nIiwiYXVkIjpbImdld2lhLmNvbSJdLCJzY29wZ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uLmZyZWVzdHlsZS5yZWFkLmFsbCIsInRhc2suc29sdXRpb24uZnJlZXN0eWxlLndyaXRlLmFsbCIsInRhc2suc29sdXRpb24uZnJlZXN0eWxlLmRlbGV0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLmltYWdlLnJlYWQuYWxsIiwidGFzay5zb2x1dGlvbi5pbWFnZS53cml0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLmltYWdlLmRlbGV0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLnRvcGljY29ubmVjdGlvbi5yZWFkLmFsbCIsInRhc2suc29sdXRpb24udG9waWNjb25uZWN0aW9uLndyaXRlLmFsbCIsInRhc2suc29sdXRpb24udG9waWNjb25uZWN0aW9uLmRlbGV0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLnNpbXBsZWVxdWF0aW9uLnJlYWQuYWxsIiwidGFzay5zb2x1dGlvbi5zaW1wbGVlcXVhdGlvbi53cml0ZS5hbGwiLCJ0YXNrLnNvbHV0aW9uLnNpbXBsZWVxdWF0aW9uLmRlbGV0ZS5hbGwiXX0.m3MuV-N7lkYn3SSamesEZ1o6FMrrMNQBXMv8JneSuoXu-5KgN2p7VMZJlvXN0_toKQQ1wixlGh-DxSO6pEfU_w", taskTypeId); + return new TaskTypeDTO( + taskType.getTaskTypeId(), + taskType.getNameKey() + ); + } + +} \ No newline at end of file diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/user/UserResolver.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/user/UserResolver.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/user/UserResolver.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/user/UserResolver.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/DeviceId.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/DeviceId.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/DeviceId.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/DeviceId.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/HeaderUtil.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/HeaderUtil.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/HeaderUtil.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/HeaderUtil.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/JsonWebToken.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/JsonWebToken.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/JsonWebToken.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/JsonWebToken.java diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/RefreshToken.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/RefreshToken.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/RefreshToken.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/util/RefreshToken.java diff --git a/src/main/java/de/themorpheus/edu/gateway/util/GitInfo.java b/gateway-core/src/main/java/de/themorpheus/edu/gateway/util/GitInfo.java similarity index 100% rename from src/main/java/de/themorpheus/edu/gateway/util/GitInfo.java rename to gateway-core/src/main/java/de/themorpheus/edu/gateway/util/GitInfo.java diff --git a/src/main/resources/application.properties b/gateway-core/src/main/resources/application.properties similarity index 87% rename from src/main/resources/application.properties rename to gateway-core/src/main/resources/application.properties index 57a08c0..658b806 100644 --- a/src/main/resources/application.properties +++ b/gateway-core/src/main/resources/application.properties @@ -1,10 +1,10 @@ security.basic.enable=false -server.port=80 +server.port=8080 graphql.playground.settings.request.credentials=Same-Origin management.metrics.export.influx.db=${INFLUX_DB} management.metrics.export.influx.username=${INFLUX_USERNAME} management.metrics.export.influx.password=${INFLUX_PASSWORD} -management.metrics.export.influx.step=${INFLUX_STEP} +management.metrics.export.influx.step=1m management.metrics.export.influx.uri=${INFLUX_URI} management.metrics.web.server.auto-time-request=true management.metrics.export.influx.auto-create-db=false diff --git a/src/main/resources/log4j2.xml b/gateway-core/src/main/resources/log4j2.xml similarity index 100% rename from src/main/resources/log4j2.xml rename to gateway-core/src/main/resources/log4j2.xml diff --git a/src/main/resources/schema.graphqls b/gateway-core/src/main/resources/schema.graphqls similarity index 100% rename from src/main/resources/schema.graphqls rename to gateway-core/src/main/resources/schema.graphqls diff --git a/src/main/resources/security.ignored b/gateway-core/src/main/resources/security.ignored similarity index 100% rename from src/main/resources/security.ignored rename to gateway-core/src/main/resources/security.ignored diff --git a/src/main/resources/sentry.properties b/gateway-core/src/main/resources/sentry.properties similarity index 100% rename from src/main/resources/sentry.properties rename to gateway-core/src/main/resources/sentry.properties diff --git a/pom.xml b/pom.xml index 529c5b5..429cc8b 100644 --- a/pom.xml +++ b/pom.xml @@ -2,12 +2,11 @@ 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - + pom + + gateway-core + backend-api + de.the-morpheus.e-du gateway @@ -15,252 +14,8 @@ gateway it collects and filters information requested by the frontend using GraphQL - - - - org.apache.logging.log4j - log4j-core - 2.13.2 - compile - - - org.apache.logging.log4j - log4j-api - - - - - org.apache.logging.log4j - log4j-api - 2.13.2 - compile - - - org.slf4j - slf4j-api - 1.7.25 - compile - - - org.apache.logging.log4j - log4j-slf4j-impl - 2.13.2 - compile - - - io.sentry - sentry-log4j2 - 1.7.30 - compile - - - org.apache.logging.log4j - log4j-api - - - org.apache.logging.log4j - log4j-core - - - org.apache.logging.log4j - log4j-to-slf4j - - - - - - org.projectlombok - lombok - 1.18.12 - compile - - - javax.validation - validation-api - 2.0.1.Final - compile - - - com.auth0 - java-jwt - 3.10.1 - compile - - - com.squareup.okhttp3 - okhttp - 4.5.0 - compile - - - com.google.code.gson - gson - 2.8.6 - compile - - - javax.servlet - javax.servlet-api - 4.0.1 - compile - - - com.google.code.findbugs - jsr305 - 1.3.9 - compile - - - - - org.springframework.boot - spring-boot-starter-actuator - 2.3.0.M4 - compile - - - commons-logging - commons-logging - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.springframework.boot - spring-boot-starter - 2.3.0.M4 - - - commons-logging - commons-logging - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.springframework.boot - spring-boot-devtools - 2.2.6.RELEASE - - - commons-logging - commons-logging - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.springframework - spring-webmvc - 5.2.6.RELEASE - - - commons-logging - commons-logging - - - org.springframework.boot - spring-boot-starter-logging - - - - - - - io.micrometer - micrometer-core - 1.4.1 - compile - - - io.micrometer - micrometer-registry-influx - 1.4.1 - compile - - - - - com.graphql-java-kickstart - graphql-spring-boot-starter - 7.0.0 - compile - - - com.graphql-java-kickstart - playground-spring-boot-starter - 7.0.0 - compile - - - com.graphql-java-kickstart - graphql-java-tools - 6.0.2 - compile - - - com.careykevin - graphql-actuator - 0.0.3 - compile - - - - - - - pl.project13.maven - git-commit-id-plugin - 4.0.0 - - - get-the-git-infos - - revision - - - - - ${project.basedir}/.git - git - false - true - ${project.build.outputDirectory}/git.properties - json - - false - false - -dirty - - - - - org.springframework.boot - spring-boot-maven-plugin - org.apache.maven.plugins maven-checkstyle-plugin @@ -285,19 +40,4 @@ - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/DifficultyResolver.java b/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/DifficultyResolver.java deleted file mode 100644 index db3ba22..0000000 --- a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/DifficultyResolver.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.themorpheus.edu.gateway.graphql.resolver.query.task; - -import de.themorpheus.edu.gateway.graphql.dto.task.DifficultyDTO; -import org.springframework.stereotype.Component; -import javax.validation.constraints.Min; -import graphql.kickstart.tools.GraphQLQueryResolver; -import graphql.schema.DataFetchingEnvironment; - -@Component -public class DifficultyResolver implements GraphQLQueryResolver { - - public DifficultyDTO difficultyById(@Min(0) int difficultyId, DataFetchingEnvironment environment) { - return TaskResolver.EXAMPLE.getDifficulty(); - } - -} diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/LectureResolver.java b/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/LectureResolver.java deleted file mode 100644 index 10935f4..0000000 --- a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/LectureResolver.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.themorpheus.edu.gateway.graphql.resolver.query.task; - -import de.themorpheus.edu.gateway.graphql.dto.task.LectureDTO; -import org.springframework.stereotype.Component; -import javax.validation.constraints.Min; -import graphql.kickstart.tools.GraphQLQueryResolver; -import graphql.schema.DataFetchingEnvironment; - -@Component -public class LectureResolver implements GraphQLQueryResolver { - - public LectureDTO lectureById(@Min(0) int lectureId, DataFetchingEnvironment environment) { - return TaskResolver.EXAMPLE.getLecture(); - } - -} diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/ModuleResolver.java b/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/ModuleResolver.java deleted file mode 100644 index a5877be..0000000 --- a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/ModuleResolver.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.themorpheus.edu.gateway.graphql.resolver.query.task; - -import de.themorpheus.edu.gateway.graphql.dto.task.ModuleDTO; -import org.springframework.stereotype.Component; -import javax.validation.constraints.Min; -import graphql.kickstart.tools.GraphQLQueryResolver; -import graphql.schema.DataFetchingEnvironment; - -@Component -public class ModuleResolver implements GraphQLQueryResolver { - - public ModuleDTO moduleById(@Min(0) int moduleId, DataFetchingEnvironment environment) { - return TaskResolver.EXAMPLE.getLecture().getModule(); - } - -} diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/SubjectResolver.java b/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/SubjectResolver.java deleted file mode 100644 index 3658140..0000000 --- a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/SubjectResolver.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.themorpheus.edu.gateway.graphql.resolver.query.task; - -import de.themorpheus.edu.gateway.graphql.dto.task.SubjectDTO; -import org.springframework.stereotype.Component; -import javax.validation.constraints.Min; -import graphql.kickstart.tools.GraphQLQueryResolver; -import graphql.schema.DataFetchingEnvironment; - -@Component -public class SubjectResolver implements GraphQLQueryResolver { - - public SubjectDTO subjectById(@Min(0) int subjectId, DataFetchingEnvironment environment) { - return TaskResolver.EXAMPLE.getLecture().getModule().getSubject(); - } - -} diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskResolver.java b/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskResolver.java deleted file mode 100644 index e3493ef..0000000 --- a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskResolver.java +++ /dev/null @@ -1,49 +0,0 @@ -package de.themorpheus.edu.gateway.graphql.resolver.query.task; - -import de.themorpheus.edu.gateway.graphql.dto.task.DifficultyDTO; -import de.themorpheus.edu.gateway.graphql.dto.task.LectureDTO; -import de.themorpheus.edu.gateway.graphql.dto.task.ModuleDTO; -import de.themorpheus.edu.gateway.graphql.dto.task.SubjectDTO; -import de.themorpheus.edu.gateway.graphql.dto.task.TaskDTO; -import de.themorpheus.edu.gateway.graphql.dto.task.TaskTypeDTO; -import de.themorpheus.edu.gateway.graphql.resolver.query.user.UserResolver; -import org.springframework.stereotype.Component; -import javax.validation.constraints.Min; -import graphql.kickstart.tools.GraphQLQueryResolver; -import graphql.schema.DataFetchingEnvironment; - -@Component -public class TaskResolver implements GraphQLQueryResolver { - - public static final TaskDTO EXAMPLE = new TaskDTO( - 0, - "Create something", - UserResolver.EXAMPLE, - 10, - new TaskTypeDTO( - 0, - "Exercise" - ), - new LectureDTO( - 0, - "Integralrechnung", - new ModuleDTO( - 0, - "Analysis", - new SubjectDTO( - 0, - "Math" - ) - ) - ), - new DifficultyDTO( - 0, - "Hard" - ) - ); - - public TaskDTO taskById(@Min(0) int taskId, DataFetchingEnvironment environment) { - return TaskResolver.EXAMPLE; - } - -} diff --git a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskTypeResolver.java b/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskTypeResolver.java deleted file mode 100644 index 10bae83..0000000 --- a/src/main/java/de/themorpheus/edu/gateway/graphql/resolver/query/task/TaskTypeResolver.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.themorpheus.edu.gateway.graphql.resolver.query.task; - -import de.themorpheus.edu.gateway.graphql.dto.task.TaskTypeDTO; -import org.springframework.stereotype.Component; -import javax.validation.constraints.Min; -import graphql.kickstart.tools.GraphQLQueryResolver; -import graphql.schema.DataFetchingEnvironment; - -@Component -public class TaskTypeResolver implements GraphQLQueryResolver { - - public TaskTypeDTO taskTypeById(@Min(0) int taskTypeId, DataFetchingEnvironment environment) { - return TaskResolver.EXAMPLE.getTaskType(); - } - -}