-
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.
- Loading branch information
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
services/web/server/src/simcore_service_webserver/users/_models.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,14 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
# | ||
# REST models | ||
# | ||
class ProfilePrivacyGet(BaseModel): | ||
hide_fullname: bool | ||
hide_email: bool | ||
|
||
|
||
class ProfilePrivacyUpdate(BaseModel): | ||
hide_fullname: bool | None = None | ||
hide_email: bool | None = None |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
from simcore_postgres_database.models.users import UserRole | ||
|
||
from ..utils import gravatar_hash | ||
from ._models import ProfilePrivacyGet, ProfilePrivacyUpdate | ||
|
||
|
||
# | ||
|
@@ -66,6 +67,7 @@ class ProfileGet(BaseModel): | |
alias="expirationDate", | ||
) | ||
|
||
privacy: ProfilePrivacyGet = ProfilePrivacyGet(hide_fullname=True, hide_email=True) | ||
preferences: AggregatedPreferences | ||
|
||
model_config = ConfigDict( | ||
|
@@ -74,6 +76,7 @@ class ProfileGet(BaseModel): | |
populate_by_name=True, | ||
json_schema_extra={ | ||
"examples": [ | ||
# 1. with gravatar | ||
{ | ||
"id": 1, | ||
"login": "[email protected]", | ||
|
@@ -82,6 +85,7 @@ class ProfileGet(BaseModel): | |
"gravatar_id": "205e460b479e2e5b48aec07710c08d50", | ||
"preferences": {}, | ||
}, | ||
# 2. with expiration date | ||
{ | ||
"id": 42, | ||
"login": "[email protected]", | ||
|
@@ -117,6 +121,8 @@ class ProfileUpdate(BaseModel): | |
first_name: FirstNameStr | None = None | ||
last_name: LastNameStr | None = None | ||
|
||
privacy: ProfilePrivacyUpdate | None = None | ||
|
||
model_config = ConfigDict( | ||
json_schema_extra={ | ||
"example": { | ||
|