feat: enhance organization management; add member registration and validation, update user registration flow, and improve enum handling
This commit is contained in:
@@ -8,7 +8,7 @@ from pydantic import BaseModel, ConfigDict
|
||||
from sqlalchemy import DateTime, Enum as SqlEnum, ForeignKey, Integer, UniqueConstraint, func
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.models.base import Base
|
||||
from app.models.base import Base, enum_values
|
||||
|
||||
|
||||
class OrganizationRole(StrEnum):
|
||||
@@ -30,7 +30,11 @@ class OrganizationMember(Base):
|
||||
organization_id: Mapped[int] = mapped_column(ForeignKey("organizations.id", ondelete="CASCADE"))
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id", ondelete="CASCADE"))
|
||||
role: Mapped[OrganizationRole] = mapped_column(
|
||||
SqlEnum(OrganizationRole, name="organization_role"),
|
||||
SqlEnum(
|
||||
OrganizationRole,
|
||||
name="organization_role",
|
||||
values_callable=enum_values,
|
||||
),
|
||||
nullable=False,
|
||||
default=OrganizationRole.MEMBER,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user