lambda/src/models/member.py

24 lines
963 B
Python

import enum
from sqlalchemy import Column, Integer, String, TIMESTAMP, Text, ForeignKey, Enum, UniqueConstraint, func
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
class MemberStatusEnum(enum.Enum):
active = 'active'
inactive = 'inactive'
Base = declarative_base()
class Member(Base):
__tablename__ = 'member'
__table_args__ = (UniqueConstraint('id'),)
id = Column(Integer, primary_key=True, autoincrement=True)
first_name = Column(String(50), nullable=False)
last_name = Column(String(50), nullable=False)
email = Column(String(100), nullable=False, unique=True)
phone = Column(String(20), nullable=True)
register_date = Column(TIMESTAMP, nullable=True, server_default=func.now())
status = Column(Enum(MemberStatusEnum), nullable=True, default=MemberStatusEnum.active)
last_updated = Column(TIMESTAMP, nullable=True)