Commit existing codebase
This commit is contained in:
commit
49bc902bb9
24 changed files with 1208 additions and 0 deletions
29
app/user/model.py
Normal file
29
app/user/model.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import enum
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import Column, String, Integer, DateTime, Enum, Date
|
||||
|
||||
from app.db import EntityBase
|
||||
|
||||
|
||||
class Sex(enum.Enum):
|
||||
"""Human sex according to ISO/IEC 5218."""
|
||||
|
||||
NOT_KNOWN = 0,
|
||||
MALE = 1,
|
||||
FEMALE = 2,
|
||||
NOT_APPLICABLE = 9
|
||||
|
||||
|
||||
class User(EntityBase):
|
||||
__tablename__ = "users"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
username = Column(String(length=32), unique=True, nullable=False)
|
||||
email = Column(String, unique=True, nullable=False)
|
||||
password = Column(String, nullable=False)
|
||||
given_name = Column(String(length=32), nullable=False)
|
||||
family_name = Column(String(length=32))
|
||||
sex = Column(Enum(Sex), nullable=False, default=Sex.NOT_KNOWN)
|
||||
birthdate = Column(Date)
|
||||
creation_date = Column(DateTime, nullable=False, default=datetime.utcnow())
|
||||
Loading…
Add table
Add a link
Reference in a new issue