Skip to content

Commit 47d8bc5

Browse files
committed
migration
1 parent d5f2e7e commit 47d8bc5

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""new users.privacy_hide_username column
2+
3+
Revision ID: 8403acca8759
4+
Revises: f7f3c835f38a
5+
Create Date: 2025-03-20 14:08:48.321587+00:00
6+
7+
"""
8+
9+
import sqlalchemy as sa
10+
from alembic import op
11+
12+
# revision identifiers, used by Alembic.
13+
revision = "8403acca8759"
14+
down_revision = "f7f3c835f38a"
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# ### commands auto generated by Alembic - please adjust! ###
21+
op.add_column(
22+
"users",
23+
sa.Column(
24+
"privacy_hide_username",
25+
sa.Boolean(),
26+
server_default=sa.text("false"),
27+
nullable=False,
28+
),
29+
)
30+
# ### end Alembic commands ###
31+
32+
33+
def downgrade():
34+
# ### commands auto generated by Alembic - please adjust! ###
35+
op.drop_column("users", "privacy_hide_username")
36+
# ### end Alembic commands ###

services/web/server/src/simcore_service_webserver/users/_users_repository.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ async def get_user_or_raise(
154154

155155

156156
async def get_user_primary_group_id(
157-
engine: AsyncEngine, connection: AsyncConnection | None = None, *, user_id: UserID
157+
engine: AsyncEngine,
158+
connection: AsyncConnection | None = None,
159+
*,
160+
user_id: UserID,
158161
) -> GroupID:
159162
async with pass_or_acquire_connection(engine, connection) as conn:
160163
primary_gid: GroupID | None = await conn.scalar(
@@ -182,7 +185,7 @@ async def get_users_ids_in_group(
182185
return {row.uid async for row in result}
183186

184187

185-
async def get_user_id_from_pgid(app: web.Application, primary_gid: int) -> UserID:
188+
async def get_user_id_from_pgid(app: web.Application, *, primary_gid: int) -> UserID:
186189
async with pass_or_acquire_connection(engine=get_asyncpg_engine(app)) as conn:
187190
user_id: UserID = await conn.scalar(
188191
sa.select(

services/web/server/src/simcore_service_webserver/users/_users_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ async def get_user_primary_group_id(app: web.Application, user_id: UserID) -> Gr
122122

123123

124124
async def get_user_id_from_gid(app: web.Application, primary_gid: GroupID) -> UserID:
125-
return await _users_repository.get_user_id_from_pgid(app, primary_gid)
125+
return await _users_repository.get_user_id_from_pgid(app, primary_gid=primary_gid)
126126

127127

128128
async def search_users(

0 commit comments

Comments
 (0)