-
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
Is677/trial account #3352
Is677/trial account #3352
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3352 +/- ##
=======================================
Coverage 83.0% 83.0%
=======================================
Files 808 811 +3
Lines 34261 34410 +149
Branches 1358 1358
=======================================
+ Hits 28437 28593 +156
+ Misses 5643 5636 -7
Partials 181 181
Flags with carried forward coverage won't be shown. Click here to find out more.
|
93a69f4
to
1d734e5
Compare
a9482c3
to
3b1270a
Compare
54bd382
to
9fcbd01
Compare
9fcbd01
to
be3ccb1
Compare
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.
great!, some minor comments, thanks !
...es-database/src/simcore_postgres_database/migration/versions/ead667546b12_user_expiration.py
Show resolved
Hide resolved
@@ -102,11 +103,11 @@ async def get_user_profile(app: web.Application, user_id: UserID) -> Dict[str, A | |||
"organizations": user_standard_groups, | |||
"all": all_group, | |||
} | |||
return user_profile | |||
return ProfileGet.parse_obj(user_profile) |
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.
minor: does it make sense to create first the dictionary and then right away the pydantic model?
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.
we are composing a dict and then using the model to validate the entire structure.
If we would have the user_profile
in one go I would definitively use the model constructor but it is not the case.
body = await request.json() | ||
updates = ProfileUpdate.parse_obj(body) |
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.
minor: why not using the parse_body_as method? it works beautifully.
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.
parse_body_as
will create a tmp model and include the model class as __root__
and the it calls model.parse_obj
. That is handy when you have classes not derived from BaseModel
. If your class is derived from BaseModel
calling the free function is a unnecessary overhead.
If you do not understand what I mean, just check the implementation
https://github.com/pydantic/pydantic/blob/main/pydantic/tools.py#L38
e7732b7
to
ec6d3a4
Compare
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.
👍 Please have look at my questions below
services/web/server/src/simcore_service_webserver/users_bg_tasks.py
Outdated
Show resolved
Hide resolved
7c915e9
to
db1a8ec
Compare
db1a8ec
to
78a8095
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
What do these changes do?
A user account can have an expiration date. Expired users access is blocked with 401.
packages/postgres-database
users.expires_at
column used for account expiration.users
tableopenapi
specsservices/web/server
MSG_USER_EXPIRED
users
entrypointGARBAGE_COLLECTOR_EXPIRED_USERS_CHECK_INTERVAL_S
(defaults to 6h interval)Related issue/s
How to test
Checklist
make openapi-specs
,git commit ...
and thenmake version-*
)cd packages/postgres-database
,make setup-commit
,sc-pg review -m "my changes"