Contact Info Specification - NFSandbox/sh_trade_backend GitHub Wiki
Data Model
class ContactInfo(SQLBaseModel):
user_id: Mapped[int] = mapped_column(ForeignKey("user.user_id"))
contact_type: Mapped[ContactInfoType] = mapped_column()
contact_info: Mapped[LongString] = mapped_column()
verified: Mapped[bool] = mapped_column(default=False)
internal: Mapped[bool] = mapped_column(default=False)
...
Basically, the ContactInfo
entity could be considered a KV(key-value) storage of user contact info.
verified
If this contact info has been verified by the system. IfTrue
, it should means that we could determine this contact info is belong to the user.interal
If True, then this contact info should only be used internally or used in other features of the system. Interanl contact info should not be displayed as user contact info. One of the example isvxid
ortelegram_user_id
which may used to send notifications to users on WeChat and Telegram.
Integration With SuperTokens
We user sign up with SuperTokens facility, the email will be directly added to contact info with verified = True
. However this does not means user has already passed the email verification. Instead, Supertokens will in charge of verify user's email and return PermissionDenied error if not verified when user try to sign in to an account with unverified AHU email.