feat: add organization-related models and update schemas for organization management
This commit is contained in:
29
backend/app/models/organization_members.py
Normal file
29
backend/app/models/organization_members.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from sqlalchemy import UniqueConstraint
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
from app.core.time import utcnow
|
||||
|
||||
|
||||
class OrganizationMember(SQLModel, table=True):
|
||||
__tablename__ = "organization_members"
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"organization_id",
|
||||
"user_id",
|
||||
name="uq_organization_members_org_user",
|
||||
),
|
||||
)
|
||||
|
||||
id: UUID = Field(default_factory=uuid4, primary_key=True)
|
||||
organization_id: UUID = Field(foreign_key="organizations.id", index=True)
|
||||
user_id: UUID = Field(foreign_key="users.id", index=True)
|
||||
role: str = Field(default="member", index=True)
|
||||
all_boards_read: bool = Field(default=False)
|
||||
all_boards_write: bool = Field(default=False)
|
||||
created_at: datetime = Field(default_factory=utcnow)
|
||||
updated_at: datetime = Field(default_factory=utcnow)
|
||||
Reference in New Issue
Block a user