Add terms of service acceptance date to user table (#1046)

* add tos_acceptance_date column to user

* send 451 UNAVAILABLE_FOR_LEGAL_REASONS status

* add create user REST endpoint

* adapt text-frontend to ToS requirements

* set DEBUG_IGNORE_TOS_ACCEPTANCE default to True (temporary change)

* update down revision to f60958968ff8
This commit is contained in:
Andreas Köpf
2023-02-01 23:53:21 +01:00
committed by GitHub
parent e0df9f0b7c
commit bbf038677c
12 changed files with 127 additions and 8 deletions
@@ -80,6 +80,7 @@ class OasstErrorCode(IntEnum):
USER_NOT_SPECIFIED = 4000
USER_DISABLED = 4001
USER_NOT_FOUND = 4002
USER_HAS_NOT_ACCEPTED_TOS = 4003
EMOJI_OP_UNSUPPORTED = 5000
@@ -39,6 +39,7 @@ class FrontEndUser(User):
streak_days: Optional[int] = None
streak_last_day_date: Optional[datetime] = None
last_activity_date: Optional[datetime] = None
tos_acceptance_date: Optional[datetime] = None
class PageResult(BaseModel):
@@ -499,3 +500,10 @@ class MessageEmojiRequest(BaseModel):
user: User
op: EmojiOp = EmojiOp.togggle
emoji: EmojiCode
class CreateFrontendUserRequest(User):
show_on_leaderboard: bool = True
enabled: bool = True
tos_acceptance: Optional[bool] = None
notes: Optional[str] = None