diff --git a/eslint.config.js b/eslint.config.js
index d48866d2e3..82fa229ba2 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -31,6 +31,7 @@ module.exports = [
"src/serverApi/**",
"src/fileStorageApi/**",
"src/h5pEditorApi/**",
+ "src/commonCartridgeApi/**",
],
},
{
diff --git a/openapitools.json b/openapitools.json
index 741c3d8322..e0b1bc018c 100644
--- a/openapitools.json
+++ b/openapitools.json
@@ -2,6 +2,24 @@
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
- "version": "5.1.0"
+ "version": "5.1.0",
+ "generators": {
+ "common-cartridge-api": {
+ "generatorName": "typescript-axios",
+ "inputSpec": "http://localhost:3350/api/v3/docs-json/",
+ "output": "./src/commonCartridgeApi/v3",
+ "skipValidateSpec": true,
+ "enablePostProcessFile": true,
+ "additionalProperties": {
+ "apiPackage": "api",
+ "enumNameSuffix": "",
+ "enumPropertyNaming": "UPPERCASE",
+ "modelPackage": "models",
+ "supportsES6": true,
+ "withInterfaces": true,
+ "withSeparateModelsAndApi": true
+ }
+ }
+ }
}
}
diff --git a/package.json b/package.json
index a2123ee00d..3569a7adeb 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,8 @@
"lint:fix": "npx eslint 'src/**/*.{ts,js,vue}' --fix",
"generate-client:server": "node generate-client.js -c openapitools-for-server.json",
"generate-client:filestorage": "node generate-client.js -u 'http://localhost:4444/api/v3/docs-json/' -p 'src/fileStorageApi/v3' -c 'openapitools-for-file-storage.json'",
- "generate-client:h5p-editor": "node generate-client.js -u 'http://localhost:4448/api/v3/docs-json/' -p 'src/h5pEditorApi/v3' -c 'openapitools-for-h5p-editor.json'"
+ "generate-client:h5p-editor": "node generate-client.js -u 'http://localhost:4448/api/v3/docs-json/' -p 'src/h5pEditorApi/v3' -c 'openapitools-for-h5p-editor.json'",
+ "generate-client:common-cartridge": "openapi-generator-cli generate -c ./openapitools.json --generator-key common-cartridge-api"
},
"dependencies": {
"@braintree/sanitize-url": "^6.0.4",
diff --git a/sonar-project.properties b/sonar-project.properties
index d6ac3c6e56..cd26cc3f4b 100644
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -1,7 +1,7 @@
sonar.organization=schulcloud-verbund
sonar.projectKey=hpi-schul-cloud_nuxt-client
sonar.sources=.
-sonar.exclusions=src/serverApi/**/*.*,src/fileStorageApi/**/*.*,src/h5pEditorApi/**/*.*,**/themes/**.ts
+sonar.exclusions=src/serverApi/**/*.*,src/fileStorageApi/**/*.*,src/h5pEditorApi/**/*.*,src/commonCartridgeApi/**/*.*,**/themes/**.ts
sonar.coverage.exclusions=tests/**/*.*,**/*.unit.ts,**/*.unit.js,**/themes/**.ts,eslint.config.js,src/main.ts,src/plugins/vuetify.ts
sonar.cpd.exclusions=**/locales/**.ts,tests/**/*.*,**/*.unit.ts,**/*.unit.js,**/themes/**.ts
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
\ No newline at end of file
diff --git a/src/commonCartridgeApi/v3/.gitignore b/src/commonCartridgeApi/v3/.gitignore
new file mode 100644
index 0000000000..149b576547
--- /dev/null
+++ b/src/commonCartridgeApi/v3/.gitignore
@@ -0,0 +1,4 @@
+wwwroot/*.js
+node_modules
+typings
+dist
diff --git a/src/commonCartridgeApi/v3/.npmignore b/src/commonCartridgeApi/v3/.npmignore
new file mode 100644
index 0000000000..999d88df69
--- /dev/null
+++ b/src/commonCartridgeApi/v3/.npmignore
@@ -0,0 +1 @@
+# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
\ No newline at end of file
diff --git a/src/commonCartridgeApi/v3/.openapi-generator-ignore b/src/commonCartridgeApi/v3/.openapi-generator-ignore
new file mode 100644
index 0000000000..7484ee590a
--- /dev/null
+++ b/src/commonCartridgeApi/v3/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/src/commonCartridgeApi/v3/.openapi-generator/FILES b/src/commonCartridgeApi/v3/.openapi-generator/FILES
new file mode 100644
index 0000000000..b571336241
--- /dev/null
+++ b/src/commonCartridgeApi/v3/.openapi-generator/FILES
@@ -0,0 +1,12 @@
+.gitignore
+.npmignore
+.openapi-generator-ignore
+api.ts
+api/common-cartridge-api.ts
+base.ts
+common.ts
+configuration.ts
+git_push.sh
+index.ts
+models/course-export-body-params.ts
+models/index.ts
diff --git a/src/commonCartridgeApi/v3/.openapi-generator/VERSION b/src/commonCartridgeApi/v3/.openapi-generator/VERSION
new file mode 100644
index 0000000000..acf69b48b8
--- /dev/null
+++ b/src/commonCartridgeApi/v3/.openapi-generator/VERSION
@@ -0,0 +1 @@
+5.1.0
\ No newline at end of file
diff --git a/src/commonCartridgeApi/v3/api.ts b/src/commonCartridgeApi/v3/api.ts
new file mode 100644
index 0000000000..0edbcfe49a
--- /dev/null
+++ b/src/commonCartridgeApi/v3/api.ts
@@ -0,0 +1,18 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * Schulcloud-Verbund-Software Server API
+ * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1.
+ *
+ * The version of the OpenAPI document: 3.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+
+export * from './api/common-cartridge-api';
+
diff --git a/src/commonCartridgeApi/v3/api/common-cartridge-api.ts b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts
new file mode 100644
index 0000000000..ee596fb7fe
--- /dev/null
+++ b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts
@@ -0,0 +1,161 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * Schulcloud-Verbund-Software Server API
+ * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1.
+ *
+ * The version of the OpenAPI document: 3.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
+import { Configuration } from '../configuration';
+// Some imports not used depending on template conditions
+// @ts-ignore
+import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
+// @ts-ignore
+import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
+// @ts-ignore
+import { CourseExportBodyParams } from '../models';
+/**
+ * CommonCartridgeApi - axios parameter creator
+ * @export
+ */
+export const CommonCartridgeApiAxiosParamCreator = function (configuration?: Configuration) {
+ return {
+ /**
+ *
+ * @param {string} courseId
+ * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export
+ * @param {CourseExportBodyParams} courseExportBodyParams
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ commonCartridgeControllerExportCourse: async (courseId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options: any = {}): Promise => {
+ // verify required parameter 'courseId' is not null or undefined
+ assertParamExists('commonCartridgeControllerExportCourse', 'courseId', courseId)
+ // verify required parameter 'version' is not null or undefined
+ assertParamExists('commonCartridgeControllerExportCourse', 'version', version)
+ // verify required parameter 'courseExportBodyParams' is not null or undefined
+ assertParamExists('commonCartridgeControllerExportCourse', 'courseExportBodyParams', courseExportBodyParams)
+ const localVarPath = `/common-cartridge/export/{courseId}`
+ .replace(`{${"courseId"}}`, encodeURIComponent(String(courseId)));
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
+ let baseOptions;
+ if (configuration) {
+ baseOptions = configuration.baseOptions;
+ }
+
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
+ const localVarHeaderParameter = {} as any;
+ const localVarQueryParameter = {} as any;
+
+ if (version !== undefined) {
+ localVarQueryParameter['version'] = version;
+ }
+
+
+
+ localVarHeaderParameter['Content-Type'] = 'application/json';
+
+ setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
+ localVarRequestOptions.data = serializeDataIfNeeded(courseExportBodyParams, localVarRequestOptions, configuration)
+
+ return {
+ url: toPathString(localVarUrlObj),
+ options: localVarRequestOptions,
+ };
+ },
+ }
+};
+
+/**
+ * CommonCartridgeApi - functional programming interface
+ * @export
+ */
+export const CommonCartridgeApiFp = function(configuration?: Configuration) {
+ const localVarAxiosParamCreator = CommonCartridgeApiAxiosParamCreator(configuration)
+ return {
+ /**
+ *
+ * @param {string} courseId
+ * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export
+ * @param {CourseExportBodyParams} courseExportBodyParams
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ async commonCartridgeControllerExportCourse(courseId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
+ const localVarAxiosArgs = await localVarAxiosParamCreator.commonCartridgeControllerExportCourse(courseId, version, courseExportBodyParams, options);
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
+ },
+ }
+};
+
+/**
+ * CommonCartridgeApi - factory interface
+ * @export
+ */
+export const CommonCartridgeApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
+ const localVarFp = CommonCartridgeApiFp(configuration)
+ return {
+ /**
+ *
+ * @param {string} courseId
+ * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export
+ * @param {CourseExportBodyParams} courseExportBodyParams
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ commonCartridgeControllerExportCourse(courseId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise {
+ return localVarFp.commonCartridgeControllerExportCourse(courseId, version, courseExportBodyParams, options).then((request) => request(axios, basePath));
+ },
+ };
+};
+
+/**
+ * CommonCartridgeApi - interface
+ * @export
+ * @interface CommonCartridgeApi
+ */
+export interface CommonCartridgeApiInterface {
+ /**
+ *
+ * @param {string} courseId
+ * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export
+ * @param {CourseExportBodyParams} courseExportBodyParams
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ * @memberof CommonCartridgeApiInterface
+ */
+ commonCartridgeControllerExportCourse(courseId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise;
+
+}
+
+/**
+ * CommonCartridgeApi - object-oriented interface
+ * @export
+ * @class CommonCartridgeApi
+ * @extends {BaseAPI}
+ */
+export class CommonCartridgeApi extends BaseAPI implements CommonCartridgeApiInterface {
+ /**
+ *
+ * @param {string} courseId
+ * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export
+ * @param {CourseExportBodyParams} courseExportBodyParams
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ * @memberof CommonCartridgeApi
+ */
+ public commonCartridgeControllerExportCourse(courseId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any) {
+ return CommonCartridgeApiFp(this.configuration).commonCartridgeControllerExportCourse(courseId, version, courseExportBodyParams, options).then((request) => request(this.axios, this.basePath));
+ }
+}
diff --git a/src/commonCartridgeApi/v3/base.ts b/src/commonCartridgeApi/v3/base.ts
new file mode 100644
index 0000000000..04e7c6ea9a
--- /dev/null
+++ b/src/commonCartridgeApi/v3/base.ts
@@ -0,0 +1,71 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * Schulcloud-Verbund-Software Server API
+ * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1.
+ *
+ * The version of the OpenAPI document: 3.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+import { Configuration } from "./configuration";
+// Some imports not used depending on template conditions
+// @ts-ignore
+import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
+
+export const BASE_PATH = "http://localhost:3350/api/v3".replace(/\/+$/, "");
+
+/**
+ *
+ * @export
+ */
+export const COLLECTION_FORMATS = {
+ csv: ",",
+ ssv: " ",
+ tsv: "\t",
+ pipes: "|",
+};
+
+/**
+ *
+ * @export
+ * @interface RequestArgs
+ */
+export interface RequestArgs {
+ url: string;
+ options: any;
+}
+
+/**
+ *
+ * @export
+ * @class BaseAPI
+ */
+export class BaseAPI {
+ protected configuration: Configuration | undefined;
+
+ constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
+ if (configuration) {
+ this.configuration = configuration;
+ this.basePath = configuration.basePath || this.basePath;
+ }
+ }
+};
+
+/**
+ *
+ * @export
+ * @class RequiredError
+ * @extends {Error}
+ */
+export class RequiredError extends Error {
+ name: "RequiredError" = "RequiredError";
+ constructor(public field: string, msg?: string) {
+ super(msg);
+ }
+}
diff --git a/src/commonCartridgeApi/v3/common.ts b/src/commonCartridgeApi/v3/common.ts
new file mode 100644
index 0000000000..927bdf8400
--- /dev/null
+++ b/src/commonCartridgeApi/v3/common.ts
@@ -0,0 +1,138 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * Schulcloud-Verbund-Software Server API
+ * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1.
+ *
+ * The version of the OpenAPI document: 3.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+import { Configuration } from "./configuration";
+import { RequiredError, RequestArgs } from "./base";
+import { AxiosInstance } from 'axios';
+
+/**
+ *
+ * @export
+ */
+export const DUMMY_BASE_URL = 'https://example.com'
+
+/**
+ *
+ * @throws {RequiredError}
+ * @export
+ */
+export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
+ if (paramValue === null || paramValue === undefined) {
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
+ }
+}
+
+/**
+ *
+ * @export
+ */
+export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
+ if (configuration && configuration.apiKey) {
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
+ ? await configuration.apiKey(keyParamName)
+ : await configuration.apiKey;
+ object[keyParamName] = localVarApiKeyValue;
+ }
+}
+
+/**
+ *
+ * @export
+ */
+export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
+ if (configuration && (configuration.username || configuration.password)) {
+ object["auth"] = { username: configuration.username, password: configuration.password };
+ }
+}
+
+/**
+ *
+ * @export
+ */
+export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
+ if (configuration && configuration.accessToken) {
+ const accessToken = typeof configuration.accessToken === 'function'
+ ? await configuration.accessToken()
+ : await configuration.accessToken;
+ object["Authorization"] = "Bearer " + accessToken;
+ }
+}
+
+/**
+ *
+ * @export
+ */
+export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
+ if (configuration && configuration.accessToken) {
+ const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
+ ? await configuration.accessToken(name, scopes)
+ : await configuration.accessToken;
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
+ }
+}
+
+/**
+ *
+ * @export
+ */
+export const setSearchParams = function (url: URL, ...objects: any[]) {
+ const searchParams = new URLSearchParams(url.search);
+ for (const object of objects) {
+ for (const key in object) {
+ if (Array.isArray(object[key])) {
+ searchParams.delete(key);
+ for (const item of object[key]) {
+ searchParams.append(key, item);
+ }
+ } else {
+ searchParams.set(key, object[key]);
+ }
+ }
+ }
+ url.search = searchParams.toString();
+}
+
+/**
+ *
+ * @export
+ */
+export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
+ const nonString = typeof value !== 'string';
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
+ : nonString;
+ return needsSerialization
+ ? JSON.stringify(value !== undefined ? value : {})
+ : (value || "");
+}
+
+/**
+ *
+ * @export
+ */
+export const toPathString = function (url: URL) {
+ return url.pathname + url.search + url.hash
+}
+
+/**
+ *
+ * @export
+ */
+export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
+ const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
+ return axios.request(axiosRequestArgs);
+ };
+}
diff --git a/src/commonCartridgeApi/v3/configuration.ts b/src/commonCartridgeApi/v3/configuration.ts
new file mode 100644
index 0000000000..ce202f21c6
--- /dev/null
+++ b/src/commonCartridgeApi/v3/configuration.ts
@@ -0,0 +1,101 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * Schulcloud-Verbund-Software Server API
+ * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1.
+ *
+ * The version of the OpenAPI document: 3.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+export interface ConfigurationParameters {
+ apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise);
+ username?: string;
+ password?: string;
+ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise);
+ basePath?: string;
+ baseOptions?: any;
+ formDataCtor?: new () => any;
+}
+
+export class Configuration {
+ /**
+ * parameter for apiKey security
+ * @param name security name
+ * @memberof Configuration
+ */
+ apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise);
+ /**
+ * parameter for basic security
+ *
+ * @type {string}
+ * @memberof Configuration
+ */
+ username?: string;
+ /**
+ * parameter for basic security
+ *
+ * @type {string}
+ * @memberof Configuration
+ */
+ password?: string;
+ /**
+ * parameter for oauth2 security
+ * @param name security name
+ * @param scopes oauth2 scope
+ * @memberof Configuration
+ */
+ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise);
+ /**
+ * override base path
+ *
+ * @type {string}
+ * @memberof Configuration
+ */
+ basePath?: string;
+ /**
+ * base options for axios calls
+ *
+ * @type {any}
+ * @memberof Configuration
+ */
+ baseOptions?: any;
+ /**
+ * The FormData constructor that will be used to create multipart form data
+ * requests. You can inject this here so that execution environments that
+ * do not support the FormData class can still run the generated client.
+ *
+ * @type {new () => FormData}
+ */
+ formDataCtor?: new () => any;
+
+ constructor(param: ConfigurationParameters = {}) {
+ this.apiKey = param.apiKey;
+ this.username = param.username;
+ this.password = param.password;
+ this.accessToken = param.accessToken;
+ this.basePath = param.basePath;
+ this.baseOptions = param.baseOptions;
+ this.formDataCtor = param.formDataCtor;
+ }
+
+ /**
+ * Check if the given MIME is a JSON MIME.
+ * JSON MIME examples:
+ * application/json
+ * application/json; charset=UTF8
+ * APPLICATION/JSON
+ * application/vnd.company+json
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
+ * @return True if the given MIME is JSON, false otherwise.
+ */
+ public isJsonMime(mime: string): boolean {
+ const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
+ }
+}
diff --git a/src/commonCartridgeApi/v3/git_push.sh b/src/commonCartridgeApi/v3/git_push.sh
new file mode 100644
index 0000000000..ced3be2b0c
--- /dev/null
+++ b/src/commonCartridgeApi/v3/git_push.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+git_host=$4
+
+if [ "$git_host" = "" ]; then
+ git_host="github.com"
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
+fi
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="GIT_USER_ID"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="GIT_REPO_ID"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="Minor update"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=`git remote`
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
+
diff --git a/src/commonCartridgeApi/v3/index.ts b/src/commonCartridgeApi/v3/index.ts
new file mode 100644
index 0000000000..8b762df664
--- /dev/null
+++ b/src/commonCartridgeApi/v3/index.ts
@@ -0,0 +1,18 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * Schulcloud-Verbund-Software Server API
+ * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1.
+ *
+ * The version of the OpenAPI document: 3.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+export * from "./api";
+export * from "./configuration";
+export * from "./models";
diff --git a/src/commonCartridgeApi/v3/models/course-export-body-params.ts b/src/commonCartridgeApi/v3/models/course-export-body-params.ts
new file mode 100644
index 0000000000..7bdbce2ac9
--- /dev/null
+++ b/src/commonCartridgeApi/v3/models/course-export-body-params.ts
@@ -0,0 +1,43 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * Schulcloud-Verbund-Software Server API
+ * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1.
+ *
+ * The version of the OpenAPI document: 3.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+
+/**
+ *
+ * @export
+ * @interface CourseExportBodyParams
+ */
+export interface CourseExportBodyParams {
+ /**
+ * The list of ids of topics which should be exported. If empty no topics are exported.
+ * @type {Array}
+ * @memberof CourseExportBodyParams
+ */
+ topics: Array;
+ /**
+ * The list of ids of tasks which should be exported. If empty no tasks are exported.
+ * @type {Array}
+ * @memberof CourseExportBodyParams
+ */
+ tasks: Array;
+ /**
+ * The list of ids of column boards which should be exported. If empty no column boards are exported.
+ * @type {Array}
+ * @memberof CourseExportBodyParams
+ */
+ columnBoards: Array;
+}
+
+
diff --git a/src/commonCartridgeApi/v3/models/index.ts b/src/commonCartridgeApi/v3/models/index.ts
new file mode 100644
index 0000000000..0ff80136e6
--- /dev/null
+++ b/src/commonCartridgeApi/v3/models/index.ts
@@ -0,0 +1 @@
+export * from './course-export-body-params';
diff --git a/src/components/molecules/CommonCartridgeExportModal.vue b/src/components/molecules/CommonCartridgeExportModal.vue
index 3d9ec14906..bab53482e1 100644
--- a/src/components/molecules/CommonCartridgeExportModal.vue
+++ b/src/components/molecules/CommonCartridgeExportModal.vue
@@ -41,9 +41,6 @@
{{ $t(`components.molecules.export.options.info`) }}
·
- {{ $t(`components.molecules.export.options.info.point1`) }}
-
- ·
{{ $t(`components.molecules.export.options.info.point2`) }}
diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts
index 6f24664ecc..f9312bcaaa 100644
--- a/src/store/course-room-details.ts
+++ b/src/store/course-room-details.ts
@@ -1,6 +1,5 @@
import {
BoardApiFactory,
- CoursesApiFactory,
CreateBoardBodyParams,
CreateBoardResponse,
LessonApiFactory,
@@ -20,6 +19,10 @@ import { Action, Module, Mutation, VuexModule } from "vuex-module-decorators";
import { BusinessError } from "./types/commons";
import { HttpStatusCode } from "./types/http-status-code.enum";
import { Course } from "./types/room";
+import {
+ CommonCartridgeApiFactory,
+ CommonCartridgeApiInterface,
+} from "@/commonCartridgeApi/v3";
@Module({
name: "courseRoomDetailsModule",
@@ -53,6 +56,10 @@ export default class CourseRoomDetailsModule extends VuexModule {
return LessonApiFactory(undefined, "/v3", $axios);
}
+ public get commonCartridgeApi(): CommonCartridgeApiInterface {
+ return CommonCartridgeApiFactory(undefined, "/v3", $axios);
+ }
+
@Action
async fetchCourse(courseId: string): Promise {
this.setLoading(true);
@@ -199,22 +206,20 @@ export default class CourseRoomDetailsModule extends VuexModule {
}): Promise {
this.resetBusinessError();
try {
- const response = await CoursesApiFactory(
- undefined,
- "v3",
- $axios
- ).courseControllerExportCourse(
- this.roomData.roomId,
- exportSettings.version,
- {
- topics: exportSettings.topics,
- tasks: exportSettings.tasks,
- columnBoards: exportSettings.columnBoards,
- },
- {
- responseType: "blob",
- }
- );
+ const response =
+ await this.commonCartridgeApi.commonCartridgeControllerExportCourse(
+ this.roomData.roomId,
+ exportSettings.version,
+ {
+ topics: exportSettings.topics,
+ tasks: exportSettings.tasks,
+ columnBoards: exportSettings.columnBoards,
+ },
+ {
+ responseType: "blob",
+ }
+ );
+
const link = document.createElement("a");
link.href = URL.createObjectURL(
new Blob([response.data as unknown as Blob])
diff --git a/src/store/course-room-details.unit.ts b/src/store/course-room-details.unit.ts
index 962b40ef2c..2b634e39fe 100644
--- a/src/store/course-room-details.unit.ts
+++ b/src/store/course-room-details.unit.ts
@@ -1,4 +1,6 @@
import * as serverApi from "@/serverApi/v3/api";
+import * as commonCartridgeApi from "@/commonCartridgeApi/v3/api/common-cartridge-api";
+import { CommonCartridgeApiInterface } from "@/commonCartridgeApi/v3/api";
import { BoardParentType } from "@/serverApi/v3/api";
import { applicationErrorModule, authModule } from "@/store";
import ApplicationErrorModule from "@/store/application-error";
@@ -7,7 +9,7 @@ import { initializeAxios } from "@/utils/api";
import { meResponseFactory } from "@@/tests/test-utils";
import { courseFactory } from "@@/tests/test-utils/factory";
import setupStores from "@@/tests/test-utils/setupStores";
-import { AxiosError, AxiosInstance } from "axios";
+import { AxiosError, AxiosInstance, AxiosPromise } from "axios";
import CourseRoomDetailsModule from "./course-room-details";
import { HttpStatusCode } from "./types/http-status-code.enum";
import { Course } from "./types/room";
@@ -386,12 +388,14 @@ describe("course-room module", () => {
describe("downloadCommonCartridgeCourse", () => {
it("should call backend api", async () => {
const courseRoomDetailsModule = new CourseRoomDetailsModule({});
- const mockApi = {
- lessonControllerDelete: jest.fn(() => Promise.resolve()),
+ const mockApi: CommonCartridgeApiInterface = {
+ commonCartridgeControllerExportCourse: jest.fn(
+ () => Promise.resolve() as unknown as AxiosPromise
+ ),
};
const spy = jest
- .spyOn(serverApi, "CoursesApiFactory")
- .mockReturnValue(mockApi as unknown as serverApi.CoursesApiInterface);
+ .spyOn(commonCartridgeApi, "CommonCartridgeApiFactory")
+ .mockReturnValue(mockApi);
await expect(
courseRoomDetailsModule.downloadCommonCartridgeCourse({
@@ -402,19 +406,23 @@ describe("course-room module", () => {
})
).resolves.not.toBeDefined();
+ expect(
+ mockApi.commonCartridgeControllerExportCourse
+ ).toHaveBeenCalled();
+
spy.mockRestore();
});
it("should catch error in catch block", async () => {
const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const error = { statusCode: 418, message: "I'm a teapot" };
- const mockApi = {
- courseControllerExportCourse: jest.fn(() =>
- Promise.reject({ ...error })
+ const mockApi: CommonCartridgeApiInterface = {
+ commonCartridgeControllerExportCourse: jest.fn(() =>
+ Promise.reject(error)
),
};
const spy = jest
- .spyOn(serverApi, "CoursesApiFactory")
- .mockReturnValue(mockApi as unknown as serverApi.CoursesApiInterface);
+ .spyOn(commonCartridgeApi, "CommonCartridgeApiFactory")
+ .mockReturnValue(mockApi);
await courseRoomDetailsModule.downloadCommonCartridgeCourse({
version: "1.1.0",
@@ -818,5 +826,15 @@ describe("course-room module", () => {
);
});
});
+
+ describe("getCommonCartridgeApi", () => {
+ it("should return the CommonCartridgeApiInterface", () => {
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
+
+ const result = courseRoomDetailsModule.commonCartridgeApi;
+
+ expect(result).toBeInstanceOf(Object);
+ });
+ });
});
});