Initial Switch to V2. Completely Overhauled Backend, Frontend and General Structure.
This commit is contained in:
23
backend/staff/orm.py
Normal file
23
backend/staff/orm.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from datetime import datetime, timezone
|
||||
from sqlalchemy import Boolean, Column, DateTime, String
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
from database.postgres import Base
|
||||
|
||||
|
||||
def _now():
|
||||
return datetime.now(timezone.utc)
|
||||
|
||||
|
||||
class Staff(Base):
|
||||
__tablename__ = "staff"
|
||||
|
||||
id = Column(String(128), primary_key=True) # Firestore doc ID during transition
|
||||
firestore_id = Column(String(128), unique=True) # same as id during transition
|
||||
email = Column(String(256), unique=True, nullable=False)
|
||||
name = Column(String(255), nullable=False)
|
||||
role = Column(String(64), nullable=False, default="staff")
|
||||
permissions = Column(JSONB, nullable=False, default=dict)
|
||||
hashed_password = Column(String(256), nullable=False)
|
||||
is_active = Column(Boolean, nullable=False, default=True)
|
||||
created_at = Column(DateTime(timezone=True), nullable=False, default=_now)
|
||||
updated_at = Column(DateTime(timezone=True), nullable=False, default=_now, onupdate=_now)
|
||||
Reference in New Issue
Block a user