Skip to content

Commit 0b73497

Browse files
committed
common
1 parent 396eb7a commit 0b73497

File tree

12 files changed

+19
-18
lines changed

12 files changed

+19
-18
lines changed

β€Žapi/specs/web-server/_users.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
from simcore_service_webserver.users._notifications_handlers import (
2626
_NotificationPathParams,
2727
)
28-
from simcore_service_webserver.users._schemas import PreRegisteredUserGet
2928
from simcore_service_webserver.users._tokens_handlers import _TokenPathParams
29+
from simcore_service_webserver.users.common._schemas import PreRegisteredUserGet
3030
from simcore_service_webserver.users.schemas import (
3131
PermissionGet,
3232
ThirdPartyToken,

β€Žservices/web/server/src/simcore_service_webserver/users/_notifications_handlers.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
UserNotificationPatch,
2727
get_notification_key,
2828
)
29-
from ._schemas import UsersRequestContext
29+
from .common._schemas import UsersRequestContext
3030
from .schemas import Permission, PermissionGet
3131

3232
_logger = logging.getLogger(__name__)

β€Žservices/web/server/src/simcore_service_webserver/users/_tokens_handlers.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from ..security.decorators import permission_required
1616
from ..utils_aiohttp import envelope_json_response
1717
from . import _tokens
18-
from ._schemas import UsersRequestContext
18+
from .common._schemas import UsersRequestContext
1919
from .exceptions import TokenNotFoundError
2020
from .schemas import TokenCreate
2121

β€Žservices/web/server/src/simcore_service_webserver/users/_users_rest.pyβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
from ..security.decorators import permission_required
2222
from ..utils_aiohttp import envelope_json_response
2323
from . import _users_service, api
24-
from ._constants import FMSG_MISSING_CONFIG_WITH_OEC
25-
from ._schemas import PreRegisteredUserGet, UsersRequestContext
24+
from .common._constants import FMSG_MISSING_CONFIG_WITH_OEC
25+
from .common._schemas import PreRegisteredUserGet, UsersRequestContext
2626
from .exceptions import (
2727
AlreadyPreRegisteredError,
2828
MissingGroupExtraPropertiesForProductError,

β€Žservices/web/server/src/simcore_service_webserver/users/_users_service.pyβ€Ž

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pycountry
44
from aiohttp import web
5-
from models_library.api_schemas_webserver.users import PreRegisteredUserGet, UserGet
5+
from models_library.api_schemas_webserver.users import UserGet
66
from models_library.emails import LowerCaseEmailStr
77
from models_library.payments import UserInvoiceAddress
88
from models_library.products import ProductName
@@ -12,7 +12,8 @@
1212

1313
from ..db.plugin import get_asyncpg_engine
1414
from . import _users_repository
15-
from ._models import UserCredentialsTuple
15+
from .common._models import UserCredentialsTuple
16+
from .common._schemas import PreRegisteredUserGet
1617
from .exceptions import AlreadyPreRegisteredError
1718
from .schemas import Permission
1819

@@ -58,17 +59,17 @@ async def set_user_as_deleted(app: web.Application, *, user_id: UserID) -> None:
5859
)
5960

6061

61-
def _glob_to_sql_like(glob_pattern: str) -> str:
62-
# Escape SQL LIKE special characters in the glob pattern
63-
sql_like_pattern = glob_pattern.replace("%", r"\%").replace("_", r"\_")
64-
# Convert glob wildcards to SQL LIKE wildcards
65-
return sql_like_pattern.replace("*", "%").replace("?", "_")
66-
67-
6862
async def search_users(
6963
app: web.Application, email_glob: str, *, include_products: bool = False
7064
) -> list[UserGet]:
7165
# NOTE: this search is deploy-wide i.e. independent of the product!
66+
67+
def _glob_to_sql_like(glob_pattern: str) -> str:
68+
# Escape SQL LIKE special characters in the glob pattern
69+
sql_like_pattern = glob_pattern.replace("%", r"\%").replace("_", r"\_")
70+
# Convert glob wildcards to SQL LIKE wildcards
71+
return sql_like_pattern.replace("*", "%").replace("?", "_")
72+
7273
rows = await _users_repository.search_users_and_get_profile(
7374
get_asyncpg_engine(app), email_like=_glob_to_sql_like(email_glob)
7475
)

β€Žservices/web/server/src/simcore_service_webserver/users/api.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
from ..login.storage import AsyncpgStorage, get_plugin_storage
3838
from ..security.api import clean_auth_policy_cache
3939
from . import _users_repository
40-
from ._models import ToUserUpdateDB
4140
from ._preferences_api import get_frontend_user_preferences_aggregation
4241
from ._users_service import (
4342
get_user_credentials,
4443
get_user_invoice_address,
4544
set_user_as_deleted,
4645
)
46+
from .common._models import ToUserUpdateDB
4747
from .exceptions import (
4848
MissingGroupExtraPropertiesForProductError,
4949
UserNameDuplicateError,

β€Žservices/web/server/src/simcore_service_webserver/users/common/__init__.pyβ€Ž

Whitespace-only changes.

β€Žservices/web/server/src/simcore_service_webserver/users/_schemas.pyβ€Ž renamed to β€Žservices/web/server/src/simcore_service_webserver/users/common/_schemas.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
1818
from servicelib.request_keys import RQT_USERID_KEY
1919

20-
from .._constants import RQ_PRODUCT_KEY
20+
from ..._constants import RQ_PRODUCT_KEY
2121

2222

2323
class UsersRequestContext(BaseModel):

0 commit comments

Comments
Β (0)