diff --git a/backend/capellacollab/core/pydantic.py b/backend/capellacollab/core/pydantic.py index 42f2b8c01..5f0d1ac9a 100644 --- a/backend/capellacollab/core/pydantic.py +++ b/backend/capellacollab/core/pydantic.py @@ -7,11 +7,17 @@ def datetime_serializer( + dt: datetime.datetime, +) -> datetime.datetime: + return dt.replace(tzinfo=datetime.UTC) + + +def datetime_serializer_optional( dt: datetime.datetime | None, ) -> datetime.datetime | None: - if dt: - return dt.replace(tzinfo=datetime.UTC) - return None + if dt is None: + return None + return datetime_serializer(dt) class BaseModel(pydantic.BaseModel): diff --git a/backend/capellacollab/users/models.py b/backend/capellacollab/users/models.py index 1ee1ea146..4a9c54b8a 100644 --- a/backend/capellacollab/users/models.py +++ b/backend/capellacollab/users/models.py @@ -38,10 +38,10 @@ class User(BaseUser): last_login: datetime.datetime | None = None _validate_created = pydantic.field_serializer("created")( - core_pydantic.datetime_serializer + core_pydantic.datetime_serializer_optional ) _validate_last_login = pydantic.field_serializer("last_login")( - core_pydantic.datetime_serializer + core_pydantic.datetime_serializer_optional ) diff --git a/frontend/Makefile b/frontend/Makefile index 42daf9a0f..694227dbc 100644 --- a/frontend/Makefile +++ b/frontend/Makefile @@ -28,7 +28,7 @@ openapi: -v $$(pwd)/openapi_templates:/tmp/openapi_templates \ -v $$OPENAPI_DIR:/tmp/output \ -u $$(id -u $${USER}):$$(id -g $${USER}) \ - openapitools/openapi-generator-cli:v7.7.0 generate \ + openapitools/openapi-generator-cli:v7.8.0 generate \ -i /tmp/openapi.json \ -t /tmp/openapi_templates \ --global-property models,apis,supportingFiles="index.ts:api.ts:models.ts:variables.ts:configuration.ts:api.module.ts:param.ts:encoder.ts" \ diff --git a/frontend/src/app/openapi/.openapi-generator/FILES b/frontend/src/app/openapi/.openapi-generator/FILES index d5da3d37b..bf02952da 100644 --- a/frontend/src/app/openapi/.openapi-generator/FILES +++ b/frontend/src/app/openapi/.openapi-generator/FILES @@ -49,8 +49,8 @@ model/create-tool-version-output.ts model/custom-navbar-link.ts model/diagram-cache-metadata.ts model/diagram-metadata.ts -model/environment.ts -model/environment1.ts +model/environment-value.ts +model/environment-value1.ts model/event-type.ts model/file-tree.ts model/file-type.ts diff --git a/frontend/src/app/openapi/.openapi-generator/VERSION b/frontend/src/app/openapi/.openapi-generator/VERSION index 1985849fb..09a6d3084 100644 --- a/frontend/src/app/openapi/.openapi-generator/VERSION +++ b/frontend/src/app/openapi/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0 +7.8.0 diff --git a/frontend/src/app/openapi/model/environment.ts b/frontend/src/app/openapi/model/environment-value.ts similarity index 94% rename from frontend/src/app/openapi/model/environment.ts rename to frontend/src/app/openapi/model/environment-value.ts index 2a6cbf828..51da4b85f 100644 --- a/frontend/src/app/openapi/model/environment.ts +++ b/frontend/src/app/openapi/model/environment-value.ts @@ -13,7 +13,7 @@ import { ToolSessionEnvironmentInput } from './tool-session-environment-input'; import { ToolSessionEnvironmentStage } from './tool-session-environment-stage'; -export interface Environment { +export interface EnvironmentValue { /** * Stage of the environment variable injection. \'before\' runs before the environment variable is stringified, allowing extended filtering and manipulation. For example, you can access the path of the first provisioned model with \'{CAPELLACOLLAB_SESSION_PROVISIONING[0][path]}\'. If you provide a dict, it will use Pythons default dict serialization and will not JSON serialization! \'after\' runs after the environment variable is JSON serialized, allowing to access a dict in the JSON format. */ @@ -23,7 +23,7 @@ export interface Environment { */ value?: string; } -export namespace Environment { +export namespace EnvironmentValue { } diff --git a/frontend/src/app/openapi/model/environment1.ts b/frontend/src/app/openapi/model/environment-value1.ts similarity index 94% rename from frontend/src/app/openapi/model/environment1.ts rename to frontend/src/app/openapi/model/environment-value1.ts index d2598fd0b..49a701833 100644 --- a/frontend/src/app/openapi/model/environment1.ts +++ b/frontend/src/app/openapi/model/environment-value1.ts @@ -13,7 +13,7 @@ import { ToolSessionEnvironmentStage } from './tool-session-environment-stage'; import { ToolSessionEnvironmentOutput } from './tool-session-environment-output'; -export interface Environment1 { +export interface EnvironmentValue1 { /** * Stage of the environment variable injection. \'before\' runs before the environment variable is stringified, allowing extended filtering and manipulation. For example, you can access the path of the first provisioned model with \'{CAPELLACOLLAB_SESSION_PROVISIONING[0][path]}\'. If you provide a dict, it will use Pythons default dict serialization and will not JSON serialization! \'after\' runs after the environment variable is JSON serialized, allowing to access a dict in the JSON format. */ @@ -23,7 +23,7 @@ export interface Environment1 { */ value: string; } -export namespace Environment1 { +export namespace EnvironmentValue1 { } diff --git a/frontend/src/app/openapi/model/guacamole-connection-method-input.ts b/frontend/src/app/openapi/model/guacamole-connection-method-input.ts index a4bd2297b..2149f07d7 100644 --- a/frontend/src/app/openapi/model/guacamole-connection-method-input.ts +++ b/frontend/src/app/openapi/model/guacamole-connection-method-input.ts @@ -9,7 +9,7 @@ + To generate a new version, run `make openapi` in the root directory of this repository. */ -import { Environment } from './environment'; +import { EnvironmentValue } from './environment-value'; import { ToolSessionSharingConfigurationInput } from './tool-session-sharing-configuration-input'; import { RDPPortsInput } from './rdp-ports-input'; @@ -23,7 +23,7 @@ export interface GuacamoleConnectionMethodInput { /** * Connection method specific environment variables. Check the global environment field for more information. */ - environment?: { [key: string]: Environment; }; + environment?: { [key: string]: EnvironmentValue; }; sharing?: ToolSessionSharingConfigurationInput; } export namespace GuacamoleConnectionMethodInput { diff --git a/frontend/src/app/openapi/model/guacamole-connection-method-output.ts b/frontend/src/app/openapi/model/guacamole-connection-method-output.ts index 70dbad4ad..77faae740 100644 --- a/frontend/src/app/openapi/model/guacamole-connection-method-output.ts +++ b/frontend/src/app/openapi/model/guacamole-connection-method-output.ts @@ -11,7 +11,7 @@ import { ToolSessionSharingConfigurationOutput } from './tool-session-sharing-configuration-output'; import { RDPPortsOutput } from './rdp-ports-output'; -import { Environment1 } from './environment1'; +import { EnvironmentValue1 } from './environment-value1'; export interface GuacamoleConnectionMethodOutput { @@ -23,7 +23,7 @@ export interface GuacamoleConnectionMethodOutput { /** * Connection method specific environment variables. Check the global environment field for more information. */ - environment: { [key: string]: Environment1; }; + environment: { [key: string]: EnvironmentValue1; }; sharing: ToolSessionSharingConfigurationOutput; } export namespace GuacamoleConnectionMethodOutput { diff --git a/frontend/src/app/openapi/model/http-connection-method-input.ts b/frontend/src/app/openapi/model/http-connection-method-input.ts index b1aab8ce2..3288c623b 100644 --- a/frontend/src/app/openapi/model/http-connection-method-input.ts +++ b/frontend/src/app/openapi/model/http-connection-method-input.ts @@ -9,7 +9,7 @@ + To generate a new version, run `make openapi` in the root directory of this repository. */ -import { Environment } from './environment'; +import { EnvironmentValue } from './environment-value'; import { ToolSessionSharingConfigurationInput } from './tool-session-sharing-configuration-input'; import { HTTPPortsInput } from './http-ports-input'; @@ -23,7 +23,7 @@ export interface HTTPConnectionMethodInput { /** * Connection method specific environment variables. Check the global environment field for more information. */ - environment?: { [key: string]: Environment; }; + environment?: { [key: string]: EnvironmentValue; }; sharing?: ToolSessionSharingConfigurationInput; redirect_url?: string; /** diff --git a/frontend/src/app/openapi/model/http-connection-method-output.ts b/frontend/src/app/openapi/model/http-connection-method-output.ts index 574882202..2264c081a 100644 --- a/frontend/src/app/openapi/model/http-connection-method-output.ts +++ b/frontend/src/app/openapi/model/http-connection-method-output.ts @@ -11,7 +11,7 @@ import { ToolSessionSharingConfigurationOutput } from './tool-session-sharing-configuration-output'; import { HTTPPortsOutput } from './http-ports-output'; -import { Environment1 } from './environment1'; +import { EnvironmentValue1 } from './environment-value1'; export interface HTTPConnectionMethodOutput { @@ -23,7 +23,7 @@ export interface HTTPConnectionMethodOutput { /** * Connection method specific environment variables. Check the global environment field for more information. */ - environment: { [key: string]: Environment1; }; + environment: { [key: string]: EnvironmentValue1; }; sharing: ToolSessionSharingConfigurationOutput; redirect_url: string; /** diff --git a/frontend/src/app/openapi/model/models.ts b/frontend/src/app/openapi/model/models.ts index a7d469e27..7585cc893 100644 --- a/frontend/src/app/openapi/model/models.ts +++ b/frontend/src/app/openapi/model/models.ts @@ -30,8 +30,8 @@ export * from './create-tool-version-output'; export * from './custom-navbar-link'; export * from './diagram-cache-metadata'; export * from './diagram-metadata'; -export * from './environment'; -export * from './environment1'; +export * from './environment-value'; +export * from './environment-value1'; export * from './event-type'; export * from './file-tree'; export * from './file-type'; diff --git a/frontend/src/app/openapi/model/tool-session-configuration-input.ts b/frontend/src/app/openapi/model/tool-session-configuration-input.ts index d47f87b45..40ed65cde 100644 --- a/frontend/src/app/openapi/model/tool-session-configuration-input.ts +++ b/frontend/src/app/openapi/model/tool-session-configuration-input.ts @@ -10,8 +10,8 @@ */ import { ToolSessionConnectionInput } from './tool-session-connection-input'; +import { EnvironmentValue } from './environment-value'; import { PersistentWorkspaceSessionConfigurationInput } from './persistent-workspace-session-configuration-input'; -import { Environment } from './environment'; import { ResourcesInput } from './resources-input'; import { SessionMonitoringInput } from './session-monitoring-input'; import { ToolModelProvisioningInput } from './tool-model-provisioning-input'; @@ -22,7 +22,7 @@ export interface ToolSessionConfigurationInput { /** * Environment variables, which are mounted into session containers. You can use f-strings to reference other environment variables in the value. */ - environment?: { [key: string]: Environment; }; + environment?: { [key: string]: EnvironmentValue; }; connection?: ToolSessionConnectionInput; monitoring?: SessionMonitoringInput; /** diff --git a/frontend/src/app/openapi/model/tool-session-configuration-output.ts b/frontend/src/app/openapi/model/tool-session-configuration-output.ts index abd856875..d97be4993 100644 --- a/frontend/src/app/openapi/model/tool-session-configuration-output.ts +++ b/frontend/src/app/openapi/model/tool-session-configuration-output.ts @@ -12,8 +12,8 @@ import { ToolSessionConnectionOutput } from './tool-session-connection-output'; import { ResourcesOutput } from './resources-output'; import { SessionMonitoringOutput } from './session-monitoring-output'; +import { EnvironmentValue1 } from './environment-value1'; import { PersistentWorkspaceSessionConfigurationOutput } from './persistent-workspace-session-configuration-output'; -import { Environment1 } from './environment1'; import { ToolModelProvisioningOutput } from './tool-model-provisioning-output'; @@ -22,7 +22,7 @@ export interface ToolSessionConfigurationOutput { /** * Environment variables, which are mounted into session containers. You can use f-strings to reference other environment variables in the value. */ - environment: { [key: string]: Environment1; }; + environment: { [key: string]: EnvironmentValue1; }; connection: ToolSessionConnectionOutput; monitoring: SessionMonitoringOutput; /** diff --git a/frontend/src/app/openapi/model/tool-session-connection-input-methods-inner.ts b/frontend/src/app/openapi/model/tool-session-connection-input-methods-inner.ts index 6bd5663f9..2cd98e1f5 100644 --- a/frontend/src/app/openapi/model/tool-session-connection-input-methods-inner.ts +++ b/frontend/src/app/openapi/model/tool-session-connection-input-methods-inner.ts @@ -9,8 +9,8 @@ + To generate a new version, run `make openapi` in the root directory of this repository. */ +import { EnvironmentValue } from './environment-value'; import { GuacamoleConnectionMethodInput } from './guacamole-connection-method-input'; -import { Environment } from './environment'; import { HTTPConnectionMethodInput } from './http-connection-method-input'; import { ToolSessionSharingConfigurationInput } from './tool-session-sharing-configuration-input'; import { HTTPPortsInput } from './http-ports-input'; @@ -25,7 +25,7 @@ export interface ToolSessionConnectionInputMethodsInner { /** * Connection method specific environment variables. Check the global environment field for more information. */ - environment?: { [key: string]: Environment; }; + environment?: { [key: string]: EnvironmentValue; }; sharing?: ToolSessionSharingConfigurationInput; redirect_url?: string; /** diff --git a/frontend/src/app/openapi/model/tool-session-connection-method.ts b/frontend/src/app/openapi/model/tool-session-connection-method.ts index e7107d5b3..41ba6a5e5 100644 --- a/frontend/src/app/openapi/model/tool-session-connection-method.ts +++ b/frontend/src/app/openapi/model/tool-session-connection-method.ts @@ -11,7 +11,7 @@ import { SessionPorts } from './session-ports'; import { ToolSessionSharingConfigurationOutput } from './tool-session-sharing-configuration-output'; -import { Environment1 } from './environment1'; +import { EnvironmentValue1 } from './environment-value1'; export interface ToolSessionConnectionMethod { @@ -23,7 +23,7 @@ export interface ToolSessionConnectionMethod { /** * Connection method specific environment variables. Check the global environment field for more information. */ - environment: { [key: string]: Environment1; }; + environment: { [key: string]: EnvironmentValue1; }; sharing: ToolSessionSharingConfigurationOutput; } diff --git a/frontend/src/app/openapi/model/tool-session-connection-output-methods-inner.ts b/frontend/src/app/openapi/model/tool-session-connection-output-methods-inner.ts index f67578caf..aee12f9fa 100644 --- a/frontend/src/app/openapi/model/tool-session-connection-output-methods-inner.ts +++ b/frontend/src/app/openapi/model/tool-session-connection-output-methods-inner.ts @@ -13,7 +13,7 @@ import { ToolSessionSharingConfigurationOutput } from './tool-session-sharing-co import { HTTPConnectionMethodOutput } from './http-connection-method-output'; import { GuacamoleConnectionMethodOutput } from './guacamole-connection-method-output'; import { HTTPPortsOutput } from './http-ports-output'; -import { Environment1 } from './environment1'; +import { EnvironmentValue1 } from './environment-value1'; export interface ToolSessionConnectionOutputMethodsInner { @@ -25,7 +25,7 @@ export interface ToolSessionConnectionOutputMethodsInner { /** * Connection method specific environment variables. Check the global environment field for more information. */ - environment: { [key: string]: Environment1; }; + environment: { [key: string]: EnvironmentValue1; }; sharing: ToolSessionSharingConfigurationOutput; redirect_url: string; /**