From 255ba226103f34679a89323f226bc3d566305454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20=C3=96hlerking?= Date: Mon, 5 Aug 2024 10:23:48 +0200 Subject: [PATCH 1/3] add feature --- apps/server/src/shared/domain/types/school-feature.enum.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/server/src/shared/domain/types/school-feature.enum.ts b/apps/server/src/shared/domain/types/school-feature.enum.ts index 6e5391cbc06..da6f3cdf8fd 100644 --- a/apps/server/src/shared/domain/types/school-feature.enum.ts +++ b/apps/server/src/shared/domain/types/school-feature.enum.ts @@ -8,4 +8,5 @@ export enum SchoolFeature { OAUTH_PROVISIONING_ENABLED = 'oauthProvisioningEnabled', SHOW_OUTDATED_USERS = 'showOutdatedUsers', ENABLE_LDAP_SYNC_DURING_MIGRATION = 'enableLdapSyncDuringMigration', + AI_TUTOR = 'aiTutor', } From b5fbc065ed978cd36b7b45300b298bd72c51d529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20=C3=96hlerking?= Date: Mon, 5 Aug 2024 10:36:04 +0200 Subject: [PATCH 2/3] add global feature --- apps/server/src/modules/server/api/dto/config.response.ts | 4 ++++ apps/server/src/modules/server/api/test/server.api.spec.ts | 1 + apps/server/src/modules/server/server.config.ts | 2 ++ config/default.schema.json | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/apps/server/src/modules/server/api/dto/config.response.ts b/apps/server/src/modules/server/api/dto/config.response.ts index 87fa2771d38..c0913abf27d 100644 --- a/apps/server/src/modules/server/api/dto/config.response.ts +++ b/apps/server/src/modules/server/api/dto/config.response.ts @@ -212,6 +212,9 @@ export class ConfigResponse { @ApiProperty() FEATURE_SCHULCONNEX_MEDIA_LICENSE_ENABLED: boolean; + @ApiProperty() + FEATURE_AI_TUTOR_ENABLED: boolean; + constructor(config: ServerConfig) { this.ACCESSIBILITY_REPORT_EMAIL = config.ACCESSIBILITY_REPORT_EMAIL; this.ADMIN_TABLES_DISPLAY_CONSENT_COLUMN = config.ADMIN_TABLES_DISPLAY_CONSENT_COLUMN; @@ -281,5 +284,6 @@ export class ConfigResponse { this.FEATURE_MEDIA_SHELF_ENABLED = config.FEATURE_MEDIA_SHELF_ENABLED; this.BOARD_COLLABORATION_URI = config.BOARD_COLLABORATION_URI; this.FEATURE_SCHULCONNEX_MEDIA_LICENSE_ENABLED = config.FEATURE_SCHULCONNEX_MEDIA_LICENSE_ENABLED; + this.FEATURE_AI_TUTOR_ENABLED = config.FEATURE_AI_TUTOR_ENABLED; } } diff --git a/apps/server/src/modules/server/api/test/server.api.spec.ts b/apps/server/src/modules/server/api/test/server.api.spec.ts index a0a844e3f99..a68f7130937 100644 --- a/apps/server/src/modules/server/api/test/server.api.spec.ts +++ b/apps/server/src/modules/server/api/test/server.api.spec.ts @@ -98,6 +98,7 @@ describe('Server Controller (API)', () => { 'FEATURE_MEDIA_SHELF_ENABLED', 'BOARD_COLLABORATION_URI', 'FEATURE_SCHULCONNEX_MEDIA_LICENSE_ENABLED', + 'FEATURE_AI_TUTOR_ENABLED', ]; expect(response.status).toEqual(HttpStatus.OK); diff --git a/apps/server/src/modules/server/server.config.ts b/apps/server/src/modules/server/server.config.ts index d4d813e3836..4d76a2a7701 100644 --- a/apps/server/src/modules/server/server.config.ts +++ b/apps/server/src/modules/server/server.config.ts @@ -119,6 +119,7 @@ export interface ServerConfig SCHULCONNEX_CLIENT__TOKEN_ENDPOINT: string | undefined; SCHULCONNEX_CLIENT__CLIENT_ID: string | undefined; SCHULCONNEX_CLIENT__CLIENT_SECRET: string | undefined; + FEATURE_AI_TUTOR_ENABLED: boolean; } const config: ServerConfig = { @@ -283,6 +284,7 @@ const config: ServerConfig = { 'FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION' ) as boolean, FEATURE_SANIS_GROUP_PROVISIONING_ENABLED: Configuration.get('FEATURE_SANIS_GROUP_PROVISIONING_ENABLED') as boolean, + FEATURE_AI_TUTOR_ENABLED: Configuration.get('FEATURE_AI_TUTOR_ENABLED') as boolean, }; export const serverConfig = () => config; diff --git a/config/default.schema.json b/config/default.schema.json index c3cd6b52b43..011f311e2db 100644 --- a/config/default.schema.json +++ b/config/default.schema.json @@ -1650,6 +1650,11 @@ "type": "string", "default": "ws://localhost:4450", "description": "URL for connecting to the WebSocketServer" + }, + "FEATURE_AI_TUTOR_ENABLED": { + "type": "boolean", + "default": false, + "description": "Enables the AI Tutor" } }, "required": [] From dba3f1e215ed42372d73b9fc2d7ce0a39a22dd01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20=C3=96hlerking?= Date: Mon, 5 Aug 2024 14:14:28 +0200 Subject: [PATCH 3/3] fix school api test --- .../src/modules/school/api/test/school-patch.api.spec.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/server/src/modules/school/api/test/school-patch.api.spec.ts b/apps/server/src/modules/school/api/test/school-patch.api.spec.ts index eb255861f24..acfa1e83a2c 100644 --- a/apps/server/src/modules/school/api/test/school-patch.api.spec.ts +++ b/apps/server/src/modules/school/api/test/school-patch.api.spec.ts @@ -210,9 +210,7 @@ describe('School Controller (API)', () => { expect.objectContaining({ validationErrors: [ { - errors: [ - 'each value in features must be one of the following values: rocketChat, videoconference, nextcloud, studentVisibility, ldapUniventionMigrationSchool, oauthProvisioningEnabled, showOutdatedUsers, enableLdapSyncDuringMigration', - ], + errors: [expect.stringContaining('each value in features must be one of the following values:')], field: ['features'], }, ],