From fc8ae4af159025f9076a1f281258701830ef46ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20=C3=96hlerking?= Date: Fri, 13 Dec 2024 12:51:32 +0100 Subject: [PATCH] review changes --- .../group-provisioning-info.loggable.ts | 9 +- .../schulconnex/schulconnex.strategy.ts | 4 +- config/default.schema.json | 139 +++--------------- 3 files changed, 24 insertions(+), 128 deletions(-) diff --git a/apps/server/src/modules/provisioning/loggable/group-provisioning-info.loggable.ts b/apps/server/src/modules/provisioning/loggable/group-provisioning-info.loggable.ts index 7280036886..537a31e785 100644 --- a/apps/server/src/modules/provisioning/loggable/group-provisioning-info.loggable.ts +++ b/apps/server/src/modules/provisioning/loggable/group-provisioning-info.loggable.ts @@ -1,12 +1,8 @@ import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; -import { ExternalGroupDto, ExternalUserDto } from '../dto'; +import { ExternalGroupDto } from '../dto'; export class GroupProvisioningInfoLoggable implements Loggable { - constructor( - private readonly groupUser: ExternalUserDto, - private readonly groups: ExternalGroupDto[], - private readonly durationMs: number - ) {} + constructor(private readonly groups: ExternalGroupDto[], private readonly durationMs: number) {} public getLogMessage(): LogMessage | ErrorLogMessage | ValidationErrorLogMessage { const userCount = this.groups.reduce( @@ -17,7 +13,6 @@ export class GroupProvisioningInfoLoggable implements Loggable { return { message: 'Group provisioning has finished.', data: { - externalUserId: this.groupUser.externalId, groupCount: this.groups.length, userCount, durationMs: this.durationMs, diff --git a/apps/server/src/modules/provisioning/strategy/schulconnex/schulconnex.strategy.ts b/apps/server/src/modules/provisioning/strategy/schulconnex/schulconnex.strategy.ts index f5b82fad2a..1c3737a687 100644 --- a/apps/server/src/modules/provisioning/strategy/schulconnex/schulconnex.strategy.ts +++ b/apps/server/src/modules/provisioning/strategy/schulconnex/schulconnex.strategy.ts @@ -103,9 +103,7 @@ export abstract class SchulconnexProvisioningStrategy extends ProvisioningStrate } const endTime = performance.now(); - this.logger.warning( - new GroupProvisioningInfoLoggable(data.externalUser, data.externalGroups ?? [], endTime - startTime) - ); + this.logger.warning(new GroupProvisioningInfoLoggable(data.externalGroups ?? [], endTime - startTime)); } private async removeUserFromGroups(data: OauthDataDto): Promise { diff --git a/config/default.schema.json b/config/default.schema.json index 8b44ccda4c..d3eae8b17a 100644 --- a/config/default.schema.json +++ b/config/default.schema.json @@ -8,12 +8,7 @@ }, "NODE_ENV": { "type": "string", - "enum": [ - "development", - "test", - "production", - "migration" - ], + "enum": ["development", "test", "production", "migration"], "default": "production" }, "REQUEST_OPTION": { @@ -77,10 +72,7 @@ "DEFAULT_LANGUAGE": { "type": "string", "default": "de", - "enum": [ - "de", - "en" - ], + "enum": ["de", "en"], "description": "Value for the default language" }, "DEFAULT_TIMEZONE": { @@ -108,23 +100,13 @@ "TEACHER_VISIBILITY_FOR_EXTERNAL_TEAM_INVITATION": { "type": "string", "default": "disabled", - "enum": [ - "disabled", - "opt-in", - "opt-out", - "enabled" - ], + "enum": ["disabled", "opt-in", "opt-out", "enabled"], "description": "defines wheter external team invitation shows teachers from different schools or not. if enabled system wide there are options general enabled or opt-in/-out by user required." }, "STUDENT_TEAM_CREATION": { "type": "string", "default": "opt-out", - "enum": [ - "disabled", - "opt-in", - "opt-out", - "enabled" - ], + "enum": ["disabled", "opt-in", "opt-out", "enabled"], "description": "defines wheter students may create teams or not. if enabled system wide there are options general enabled or opt-in/-out by school admin required." }, "REDIS_URI": { @@ -300,13 +282,7 @@ "FILES_STORAGE": { "type": "object", "description": "Files storage server properties, required always to be defined", - "required": [ - "S3_ENDPOINT", - "S3_REGION", - "S3_BUCKET", - "S3_ACCESS_KEY_ID", - "S3_SECRET_ACCESS_KEY" - ], + "required": ["S3_ENDPOINT", "S3_REGION", "S3_BUCKET", "S3_ACCESS_KEY_ID", "S3_SECRET_ACCESS_KEY"], "properties": { "SERVICE_BASE_URL": { "type": "string", @@ -363,13 +339,7 @@ "FWU_CONTENT": { "type": "object", "description": "Properties of the S3 storage containing FWU content", - "required": [ - "S3_ENDPOINT", - "S3_REGION", - "S3_BUCKET", - "S3_ACCESS_KEY", - "S3_SECRET_KEY" - ], + "required": ["S3_ENDPOINT", "S3_REGION", "S3_BUCKET", "S3_ACCESS_KEY", "S3_SECRET_KEY"], "properties": { "S3_ENDPOINT": { "type": "string", @@ -408,12 +378,7 @@ "H5P_EDITOR": { "type": "object", "description": "Properties of the H5P server microservice and library management job", - "required": [ - "S3_ENDPOINT", - "S3_REGION", - "S3_BUCKET_CONTENT", - "S3_BUCKET_LIBRARIES" - ], + "required": ["S3_ENDPOINT", "S3_REGION", "S3_BUCKET_CONTENT", "S3_BUCKET_LIBRARIES"], "default": {}, "properties": { "S3_ENDPOINT": { @@ -473,12 +438,7 @@ "H5P_Library": { "type": "object", "description": "Properties of the H5P server microservice", - "required": [ - "S3_ENDPOINT", - "S3_BUCKET_LIBRARIES", - "S3_ACCESS_KEY_ID", - "S3_SECRET_ACCESS_KEY" - ], + "required": ["S3_ENDPOINT", "S3_BUCKET_LIBRARIES", "S3_ACCESS_KEY_ID", "S3_SECRET_ACCESS_KEY"], "default": {}, "properties": { "S3_ENDPOINT": { @@ -912,9 +872,7 @@ "ETHERPAD": { "type": "object", "description": "Etherpad settings", - "required": [ - "PAD_URI" - ], + "required": ["PAD_URI"], "properties": { "URI": { "type": "string", @@ -1072,9 +1030,7 @@ "API_VALIDATION_WHITELIST_EXTENSION": { "type": "string", "description": "when set, this is interpreted as a regex to extend the ignorelist for the API validation with any routes matching the regex.", - "examples": [ - ".*/courses/[0-9a-f]{24}($|/$)" - ] + "examples": [".*/courses/[0-9a-f]{24}($|/$)"] }, "FEATURE_PROMETHEUS_METRICS_ENABLED": { "type": "boolean", @@ -1149,31 +1105,13 @@ "type": "string", "default": "error", "description": "Log level for api.", - "enum": [ - "emerg", - "alert", - "crit", - "error", - "warning", - "notice", - "info", - "debug" - ] + "enum": ["emerg", "alert", "crit", "error", "warning", "notice", "info", "debug"] }, "NEST_LOG_LEVEL": { "type": "string", "default": "notice", "description": "Nest Log level for api. The http flag is for request logging. The http flag do only work by api methods with added 'request logging interceptor'.", - "enum": [ - "emerg", - "alert", - "crit", - "error", - "warning", - "notice", - "info", - "debug" - ] + "enum": ["emerg", "alert", "crit", "error", "warning", "notice", "info", "debug"] }, "EXIT_ON_ERROR": { "type": "boolean", @@ -1184,12 +1122,7 @@ "type": "string", "default": "requestError", "description": "Special logs.", - "enum": [ - "requestError", - "systemLogs", - "request", - "sendRequests" - ] + "enum": ["requestError", "systemLogs", "request", "sendRequests"] }, "SYNC_QUEUE_NAME": { "type": "string", @@ -1376,11 +1309,7 @@ "SAME_SITE": { "type": "string", "default": "none", - "enum": [ - "none", - "lax", - "strict" - ], + "enum": ["none", "lax", "strict"], "description": "Value for cookies sameSite property. When SECURE flag is false, 'None' is not allowed in SAME_SITE and Lax should be used as default instead" }, "HTTP_ONLY": { @@ -1404,13 +1333,7 @@ "description": "Expiration in seconds from now" } }, - "required": [ - "SAME_SITE", - "HTTP_ONLY", - "HOST_ONLY", - "SECURE", - "EXPIRES_SECONDS" - ], + "required": ["SAME_SITE", "HTTP_ONLY", "HOST_ONLY", "SECURE", "EXPIRES_SECONDS"], "allOf": [ { "$ref": "#/properties/COOKIE/definitions/SAME_SITE_SECURE_VALID" @@ -1428,10 +1351,7 @@ "then": { "properties": { "SAME_SITE": { - "enum": [ - "lax", - "strict" - ] + "enum": ["lax", "strict"] } } } @@ -1703,9 +1623,7 @@ "type": "string", "default": "image/png,image/jpeg,image/gif,image/svg+xml", "description": "List with allowed assets MIME types, comma separated, empty if all MIME types supported by tldraw should be allowed", - "examples": [ - "image/gif,image/jpeg,video/webm" - ] + "examples": ["image/gif,image/jpeg,video/webm"] }, "PERFORMANCE_MEASURE_ENABLED": { "type": "boolean", @@ -1716,16 +1634,7 @@ "type": "string", "default": "info", "description": "Define log level for tldraw.", - "enum": [ - "emerg", - "alert", - "crit", - "error", - "warning", - "notice", - "info", - "debug" - ] + "enum": ["emerg", "alert", "crit", "error", "warning", "notice", "info", "debug"] } } }, @@ -1746,16 +1655,12 @@ "API_URL": { "type": "string", "description": "Base URL of the schulconnex API (from dof)", - "examples": [ - "https://api-dienste.stage.niedersachsen-login.schule/v1/" - ] + "examples": ["https://api-dienste.stage.niedersachsen-login.schule/v1/"] }, "TOKEN_ENDPOINT": { "type": "string", "description": "Token endpoint of the schulconnex API (from dof)", - "examples": [ - "https://api-dienste.stage.niedersachsen-login.schule/v1/oauth2/token" - ] + "examples": ["https://api-dienste.stage.niedersachsen-login.schule/v1/oauth2/token"] }, "CLIENT_ID": { "type": "string", @@ -1831,9 +1736,7 @@ "type": "string", "default": "", "description": "URL for fetching policies info from moin.schule schulconnex", - "examples": [ - "https://api-dienste.stage.niedersachsen-login.schule/v1/policies-info" - ] + "examples": ["https://api-dienste.stage.niedersachsen-login.schule/v1/policies-info"] }, "PROVISIONING_SCHULCONNEX_GROUP_USERS_LIMIT": { "type": "number",