add
This commit is contained in:
36
app_core/db/models.py
Normal file
36
app_core/db/models.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, func, UniqueConstraint
|
||||
from .database import Base
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "workolik_users"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("email", name="uq_workolik_users_email"),
|
||||
)
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
email = Column(String(255), nullable=False, unique=True, index=True)
|
||||
password_hash = Column(String(255), nullable=False)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
|
||||
|
||||
class EmailLog(Base):
|
||||
__tablename__ = "email_logs"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
sent_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
recipients = Column(String(1024), nullable=False)
|
||||
subject = Column(String(255), nullable=False)
|
||||
status = Column(String(50), nullable=False) # sent / failed
|
||||
error = Column(String(1024))
|
||||
date_for = Column(String(32), nullable=False)
|
||||
|
||||
class TriumphDebtorMapping(Base):
|
||||
__tablename__ = "triumph_debtor_mappings"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
code = Column(String(50))
|
||||
name = Column(String(255))
|
||||
dbmacc = Column(String(50))
|
||||
outlet = Column(String(255))
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
||||
Reference in New Issue
Block a user