-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge master into bugfix-healthcheck-rabbitmq-cancelled-connection
- Loading branch information
Showing
159 changed files
with
3,524 additions
and
1,909 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...se/src/simcore_postgres_database/migration/versions/8bfe65a5e294_add_cancellation_mark.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""add cancellation mark | ||
Revision ID: 8bfe65a5e294 | ||
Revises: 5ad02358751a | ||
Create Date: 2024-11-08 14:40:59.266181+00:00 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "8bfe65a5e294" | ||
down_revision = "5ad02358751a" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column( | ||
"comp_runs", sa.Column("cancelled", sa.DateTime(timezone=True), nullable=True) | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column("comp_runs", "cancelled") | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/postgres-database/src/simcore_postgres_database/utils_sql.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def assemble_array_groups(user_group_ids: list[int]) -> str: | ||
return ( | ||
"array[]::text[]" | ||
if len(user_group_ids) == 0 | ||
else f"""array[{', '.join(f"'{group_id}'" for group_id in user_group_ids)}]""" | ||
) |
30 changes: 30 additions & 0 deletions
30
packages/postgres-database/src/simcore_postgres_database/utils_workspaces_sql.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from simcore_postgres_database.models.groups import user_to_groups | ||
from simcore_postgres_database.models.workspaces_access_rights import ( | ||
workspaces_access_rights, | ||
) | ||
from sqlalchemy import func | ||
from sqlalchemy.dialects.postgresql import BOOLEAN, INTEGER | ||
from sqlalchemy.sql import Subquery, select | ||
|
||
|
||
def create_my_workspace_access_rights_subquery(user_id: int) -> Subquery: | ||
return ( | ||
select( | ||
workspaces_access_rights.c.workspace_id, | ||
func.json_build_object( | ||
"read", | ||
func.max(workspaces_access_rights.c.read.cast(INTEGER)).cast(BOOLEAN), | ||
"write", | ||
func.max(workspaces_access_rights.c.write.cast(INTEGER)).cast(BOOLEAN), | ||
"delete", | ||
func.max(workspaces_access_rights.c.delete.cast(INTEGER)).cast(BOOLEAN), | ||
).label("my_access_rights"), | ||
) | ||
.select_from( | ||
workspaces_access_rights.join( | ||
user_to_groups, user_to_groups.c.gid == workspaces_access_rights.c.gid | ||
) | ||
) | ||
.where(user_to_groups.c.uid == user_id) | ||
.group_by(workspaces_access_rights.c.workspace_id) | ||
).subquery("my_workspace_access_rights_subquery") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.