Skip to content

Commit

Permalink
[FEATURE][WS-1698] add UserServiceStatus to user schema
Browse files Browse the repository at this point in the history
  • Loading branch information
chloechen committed Oct 11, 2022
1 parent 5048436 commit 8e69ad8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions awesome_sso/service/user/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ class Language(str, Enum):
ZH_TW = "zh-TW"


class UserServiceStatus(str, Enum):
ACTIVE = "active"
TRIAL_ENDED = "trial_ended"


class AwesomeUser(Document):
name: str
email: EmailStr
Expand Down
6 changes: 4 additions & 2 deletions awesome_sso/service/user/sync_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from awesome_exception.exceptions import InternalServerError, Unauthorized

from awesome_sso.service.settings import Settings
from awesome_sso.service.user.schema import AwesomeUserType
from awesome_sso.service.user.schema import AwesomeUserType, UserServiceStatus


async def sync_user(user: AwesomeUserType):
Expand Down Expand Up @@ -35,7 +35,9 @@ async def sync_user(user: AwesomeUserType):
{
"service_name": service["service_name"],
"external_domain": service["external_domain"],
"status": service["status"] if "status" in service else "trial_ended"
"status": service["status"]
if "status" in service
else UserServiceStatus.TRIAL_ENDED,
}
)
config_values["services"] = services_info
Expand Down

0 comments on commit 8e69ad8

Please sign in to comment.