-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
♻️ web-server: Refactor users
domain for improved layer separation and upgrading to asyncpg
#6937
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6937 +/- ##
==========================================
- Coverage 88.10% 83.36% -4.75%
==========================================
Files 1592 1616 +24
Lines 62326 63258 +932
Branches 2012 2068 +56
==========================================
- Hits 54912 52732 -2180
- Misses 7078 10179 +3101
- Partials 336 347 +11
Continue to review full report in Codecov by Sentry.
|
ed2a0d5
to
b358fb4
Compare
b358fb4
to
8e3bedb
Compare
packages/models-library/src/models_library/api_schemas_webserver/_base.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/users/_users_repository.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/users/_users_repository.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, I like it. left a few comments. Thanks
packages/models-library/src/models_library/api_schemas_webserver/_base.py
Outdated
Show resolved
Hide resolved
packages/models-library/src/models_library/api_schemas_webserver/groups.py
Outdated
Show resolved
Hide resolved
packages/models-library/src/models_library/api_schemas_webserver/groups.py
Show resolved
Hide resolved
packages/postgres-database/src/simcore_postgres_database/utils_groups_extra_properties.py
Show resolved
Hide resolved
packages/postgres-database/src/simcore_postgres_database/utils_models.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/users/_users_repository.py
Show resolved
Hide resolved
|
||
async with pass_or_acquire_connection(engine, connection) as conn: | ||
result = await conn.stream( | ||
sa.select(*(users.columns[name] for name in return_column_names)).where( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if I pass []
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. I would say that the current code would returns None, but it has been a waste to transmit that ...
services/web/server/src/simcore_service_webserver/users/_users_repository.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/users/_users_repository.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍 All good
Quality Gate passedIssues Measures |
What do these changes do?
The
users
plugin has quite some old functionality so before adding further logic into it, I decided to do some refactoring to align with the conventions and libraries we should be using.Layer Separation:
rest-controller
,service
, andrepository
layers within theusers
domain.api
is now a pure interface for other domains.Schema and Domain Model Separation:
schema.to_model()
andschema.from_model()
.Repository Migration:
aiopg
withasyncpg
across all repository code.groups_extra_properties
) where necessary, though some duplication exists for now.**Misc: **
User Enums: Moved user-related enums to the
common-library
for broader reuse.Related issue/s
How to test
Dev-ops
None