diff --git a/.gitignore b/.gitignore index a66bd4658c76aae75f1398b0c59c950b154b41c1..ffc7fdef1bdf24827f5d750d2a5bca6ff3acb24f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,5 @@ # mkdocs documentation site/ -docs/tech/architecture/definitions.md -docs/tech/architecture/CHANGELOG.md -docs/tech/api/openapi.yml # python .python-version diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2568e39228ecee44fbfa6009372f5fee006032d1..6f4df9f5306d6ba8aade151e089cf866a1512d2a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,6 @@ variables: stages: - setup - - commit - build - deploy @@ -18,27 +17,7 @@ setup: before_script: - apt-get update script: - - ./utilities.sh # Running the script to setup directories and copy files - artifacts: - paths: - - docs/tech - - files-from-repos - -commit_zip: - stage: commit - when: manual - allow_failure: true - script: - - git config --global user.email "ci@gitlab.com" - - git config --global user.name "CI Bot" - - git add files-from-repos/intro-definition.zip - - git add files-from-repos/showcase-definition.zip - - git commit -m "Add automatically deployment-files.zip" - - git push https://oauth2:${GITLAB_TOKEN}@gitlab.fi.muni.cz/inject/inject-docs.git HEAD:"$CI_PIPELINE_ID" -o ci.skip - dependencies: - - setup - only: - - citadel + - echo "updating" build: stage: build diff --git a/docs/tech/api/openapi.yml b/docs/tech/api/openapi.yml new file mode 100644 index 0000000000000000000000000000000000000000..6495f76d6423061851e098f3ed0f35ce57ba139e --- /dev/null +++ b/docs/tech/api/openapi.yml @@ -0,0 +1,332 @@ +openapi: 3.0.0 +info: + title: Inject API + version: 0.4.0 +servers: + - url: http://api.example.com/inject/api/v1 + description: Example API URL +paths: + /version: + get: + tags: + - Version + summary: Retrieve the backend and definition versions + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + properties: + version: + type: string + description: Backend version + definition_version: + type: string + description: Definition version supported by the backend + required: + - version + - definition_version + '500': + $ref: "#/components/responses/Error" + + /user/create-users: + post: + tags: + - user + summary: Upload a list of users in CSV format + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + required: + - file + responses: + '201': + $ref: "#/components/responses/Success" + '500': + $ref: "#/components/responses/Error" + + /export_import: + get: + tags: + - export_import + summary: Export database + description: "" + responses: + '200': + description: Exported file + content: + application/zip: + schema: + type: string + format: binary + '500': + $ref: "#/components/responses/Error" + post: + tags: + - export_import + summary: Import database + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + required: + - file + responses: + '200': + $ref: "#/components/responses/Success" + '500': + $ref: "#/components/responses/Error" + + /exercise_definition/upload-definition: + post: + tags: + - upload_definition + description: Upload a definition + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + name: + type: string + description: Name of the definition + file: + type: string + format: binary + description: Definition file + required: + - name + - file + responses: + '200': + $ref: "#/components/responses/Success" + '500': + $ref: "#/components/responses/Error" + + /exercise_definition/validate: + post: + tags: + - validate-definition + description: Validate the uploaded definition + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: Definition file + required: + - file + responses: + '200': + $ref: "#/components/responses/Success" + '500': + $ref: "#/components/responses/Error" + + /running_exercise/get_exercise_logs/{exercise_id}: + get: + tags: + - get_exercise_logs + description: Retrieve logs for the specific exercise + parameters: + - name: anonymize + in: query + description: Set to true for user anonymization otherwise leave empty + schema: + type: boolean + allowEmptyValue: true + - name: exercise_id + in: path + description: Id of the exercise + required: true + schema: + type: integer + responses: + '200': + description: Exported file + content: + application/zip: + schema: + type: string + format: binary + '500': + $ref: "#/components/responses/Error" + + /running_exercise/upload/{team_id}/: + post: + tags: + - team_upload_file + description: Upload a file as the specified team + parameters: + - name: team_id + in: path + description: Team id + required: true + schema: + type: integer + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: File to upload + required: + - file + responses: + '200': + $ref: "#/components/responses/Success" + '500': + $ref: "#/components/responses/Error" + + /running_exercise/{team_id}/{file_id}/: + get: + tags: + - team_download_file + parameters: + - name: team_id + in: path + required: true + schema: + type: integer + - name: file_id + in: path + required: true + schema: + type: string + responses: + '200': + description: File + content: + application/*: + schema: + type: string + format: binary + text/*: + schema: + type: string + format: binary + image/*: + schema: + type: string + format: binary + '500': + $ref: "#/components/responses/Error" + + /auth/login/: + post: + tags: + - auth + description: Login a user based on the credentials + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + username: + type: string + password: + type: string + required: + - username + - password + responses: + '200': + description: Login successful + $ref: "#/components/responses/AuthResponse" + '403': + $ref: "#/components/responses/Error" + + /auth/logout/: + post: + tags: + - auth + description: Logout a user + responses: + '200': + $ref: "#/components/responses/AuthResponse" + '500': + $ref: "#/components/responses/Error" + + /auth/session: + get: + tags: + - auth + description: Check whether the session is still valid + responses: + '200': + $ref: "#/components/responses/AuthResponse" + '500': + $ref: "#/components/responses/Error" + +components: + schemas: + JsonResponse: + type: object + properties: + status: + type: string + enum: + - ok + - error + detail: + type: string + description: Message with extra details + required: + - status + - detail + AuthResponse: + type: object + properties: + sessionid: + type: string + nullable: true + description: session id + required: + - sessionid + responses: + Success: + description: Operation successful + content: + application/json: + schema: + $ref: "#/components/schemas/JsonResponse" + Error: + description: "Error" + content: + application/json: + schema: + $ref: "#/components/schemas/JsonResponse" + AuthResponse: + description: "Response to auth endpoints" + content: + application/json: + schema: + $ref: "#/components/schemas/AuthResponse" diff --git a/docs/tech/log-format.md b/docs/tech/log-format.md index 051066d703f176c9b50f9ac287725da00c060e6d..d8ead5429c485df76a410773d339c5f485e94f88 100644 --- a/docs/tech/log-format.md +++ b/docs/tech/log-format.md @@ -35,27 +35,6 @@ Many of the fields described here are also described in the definition format which can be found [here](https://gitlab.fi.muni.cz/inject/backend/-/blob/main/definitions/README.md?ref_type=heads). -### Quick list: - -**Exercise files**: -- [exercise.jsonl](#exercisejsonl) -- [teams.jsonl](#teamsjsonl) -- [instructors.jsonl](#instructorsjsonl) -- [exercise_injects.jsonl](#exercise_injectsjsonl) -- [exercise_milestones.jsonl](#exercise_milestonesjsonl) -- [exercise_tools.jsonl](#exercise_toolsjsonl) -- [exercise_questionnaires.jsonl](#exercise_questionnairesjsonl) -- [exercise_learning_objectives.jsonl](#exercise_learning_objectivesjsonl) -- [email_participants.jsonl](#email_participantsjsonl) -- [file_infos.jsonl](#file_infosjsonl) - -**Individual team files**: -- [inject_states.jsonl](#inject_statesjsonl) -- [questionnaire_states.jsonl](#questionnaire_statesjsonl) -- [action_logs.jsonl](#action_logsjsonl) -- [milestones.jsonl](#milestonesjsonl) -- [emails.jsonl](#emailsjsonl) - ### Timestamps All fields with the `timestamp` type are timestamps in `ISO 8601` format. diff --git a/utilities.sh b/utilities.sh deleted file mode 100755 index 06ed98752fee5c81b434e9f1cf81382145317174..0000000000000000000000000000000000000000 --- a/utilities.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# Initialize and update git submodules -git submodule init -git submodule update --remote - -# Check the status of the git submodules -git submodule status - -# Create necessary directories -mkdir -p docs/tech -mkdir -p files-from-repos - -# Copy files to the respective directories -cp ./backend/definitions/README.md ./docs/tech/architecture/definitions/README.md -cp ./backend/definitions/CHANGELOG.md ./docs/tech/architecture/definitions/CHANGELOG.md -cp ./backend/openapi.yml ./docs/tech/api/openapi.yml - -cp ./showcase-definition/assets/definition.zip ./files-from-repos/showcase-definition.zip -cp ./introductory-definition/assets/definition.zip ./files-from-repos/intro-definition.zip