-
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import enum
|
||||
|
||||
from sqlalchemy import Enum as SAEnum
|
||||
|
||||
|
||||
class AdminRole(str, enum.Enum):
|
||||
SUPER_ADMIN = "super_admin" # everything, incl. managing admin accounts
|
||||
ADMIN = "admin" # all content + enquiries, incl. deletes
|
||||
EDITOR = "editor" # content (projects/services/testimonials/site content), read enquiries
|
||||
|
||||
|
||||
class EnquiryStatus(str, enum.Enum):
|
||||
NEW = "new"
|
||||
CONTACTED = "contacted"
|
||||
SITE_VISIT_SCHEDULED = "site_visit_scheduled"
|
||||
QUOTATION_SENT = "quotation_sent"
|
||||
CONVERTED = "converted"
|
||||
REJECTED = "rejected"
|
||||
|
||||
|
||||
class PropertyType(str, enum.Enum):
|
||||
RESIDENTIAL = "residential"
|
||||
COMMERCIAL = "commercial"
|
||||
INDUSTRIAL = "industrial"
|
||||
OTHER = "other"
|
||||
|
||||
|
||||
class ProjectCategory(str, enum.Enum):
|
||||
RESIDENTIAL = "residential"
|
||||
COMMERCIAL = "commercial"
|
||||
|
||||
|
||||
class ProjectStatus(str, enum.Enum):
|
||||
ONGOING = "ongoing"
|
||||
COMPLETED = "completed"
|
||||
|
||||
|
||||
def db_enum(enum_cls: type[enum.Enum], name: str) -> SAEnum:
|
||||
"""Portable enum stored as VARCHAR + CHECK constraint (easy to extend in migrations)."""
|
||||
return SAEnum(
|
||||
enum_cls,
|
||||
name=name,
|
||||
native_enum=False,
|
||||
create_constraint=True,
|
||||
length=32,
|
||||
values_callable=lambda e: [m.value for m in e],
|
||||
validate_strings=True,
|
||||
)
|
||||
Reference in New Issue
Block a user