feat: enhance organization management; add member registration and validation, update user registration flow, and improve enum handling
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
"""Declarative base for SQLAlchemy models."""
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import StrEnum
|
||||
from typing import TypeVar
|
||||
|
||||
from sqlalchemy.orm import DeclarativeBase, declared_attr
|
||||
|
||||
EnumT = TypeVar("EnumT", bound=StrEnum)
|
||||
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
"""Base class that configures naming conventions."""
|
||||
@@ -8,3 +15,9 @@ class Base(DeclarativeBase):
|
||||
@declared_attr.directive
|
||||
def __tablename__(cls) -> str: # type: ignore[misc]
|
||||
return cls.__name__.lower()
|
||||
|
||||
|
||||
def enum_values(enum_cls: type[EnumT]) -> list[str]:
|
||||
"""Return enum member values to keep DB representation stable."""
|
||||
|
||||
return [member.value for member in enum_cls]
|
||||
|
||||
Reference in New Issue
Block a user