feat: add organization-related models and update schemas for organization management
This commit is contained in:
19
backend/app/models/organizations.py
Normal file
19
backend/app/models/organizations.py
Normal file
@@ -0,0 +1,19 @@
|
||||
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 Organization(SQLModel, table=True):
|
||||
__tablename__ = "organizations"
|
||||
__table_args__ = (UniqueConstraint("name", name="uq_organizations_name"),)
|
||||
|
||||
id: UUID = Field(default_factory=uuid4, primary_key=True)
|
||||
name: str = Field(index=True)
|
||||
created_at: datetime = Field(default_factory=utcnow)
|
||||
updated_at: datetime = Field(default_factory=utcnow)
|
||||
Reference in New Issue
Block a user