diff --git a/backend/capellacollab/alembic/versions/f7bf9456cfc9_add_archive_flag.py b/backend/capellacollab/alembic/versions/f7bf9456cfc9_add_archive_flag.py new file mode 100644 index 0000000000..0cac1e9f15 --- /dev/null +++ b/backend/capellacollab/alembic/versions/f7bf9456cfc9_add_archive_flag.py @@ -0,0 +1,35 @@ +# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors +# SPDX-License-Identifier: Apache-2.0 + +"""Add archive flag + +Revision ID: f7bf9456cfc9 +Revises: 1a4208c18909 +Create Date: 2023-08-28 08:57:22.931913 + +""" +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "f7bf9456cfc9" +down_revision = "1a4208c18909" +branch_labels = None +depends_on = None + + +def upgrade(): + op.add_column( + "t4c_instances", sa.Column("is_archived", sa.Boolean(), nullable=True) + ) + + op.get_bind().execute( + sa.text("UPDATE t4c_instances SET is_archived=false") + ) + + op.alter_column( + "t4c_instances", + "is_archived", + existing_type=sa.BOOLEAN(), + nullable=False, + ) diff --git a/backend/capellacollab/settings/modelsources/t4c/models.py b/backend/capellacollab/settings/modelsources/t4c/models.py index d89ae1458b..fc9ff63f14 100644 --- a/backend/capellacollab/settings/modelsources/t4c/models.py +++ b/backend/capellacollab/settings/modelsources/t4c/models.py @@ -79,6 +79,8 @@ class DatabaseT4CInstance(database.Base): back_populates="instance", cascade="all, delete" ) + is_archived: orm.Mapped[bool] = orm.mapped_column(default=False) + def port_validator(value: int | None) -> int | None: if not value: @@ -123,6 +125,7 @@ class PatchT4CInstance(pydantic.BaseModel): password: str | None = None protocol: Protocol | None = None version_id: int | None = None + is_archived: bool | None = None _validate_rest_api_url = pydantic.field_validator("rest_api")( validate_rest_api_url @@ -138,9 +141,11 @@ class T4CInstanceComplete(T4CInstanceBase): class CreateT4CInstance(T4CInstanceComplete): + is_archived: bool | None = None password: str class T4CInstance(T4CInstanceComplete): id: int version: tools_models.ToolVersionBase + is_archived: bool diff --git a/frontend/src/app/services/settings/t4c-instance.service.ts b/frontend/src/app/services/settings/t4c-instance.service.ts index 547fd4e94b..5c2588c9fa 100644 --- a/frontend/src/app/services/settings/t4c-instance.service.ts +++ b/frontend/src/app/services/settings/t4c-instance.service.ts @@ -22,6 +22,7 @@ export type BaseT4CInstance = { username: string; password: string; protocol: Protocol; + is_archived: boolean; }; export type NewT4CInstance = BaseT4CInstance & {