token_relation.py 724 B

123456789101112131415161718192021222324252627282930
  1. from enum import Enum
  2. from sqlmodel import Field
  3. from app.models.base_model import BaseModel, TimeStampMixin, PrimaryKeyMixin
  4. class RelationType(str, Enum):
  5. Assistant = "assistant"
  6. File = "file"
  7. Thread = "thread"
  8. Action = "action"
  9. class TokenRelationBase(BaseModel):
  10. token_id: str = Field(nullable=False)
  11. relation_type: RelationType = Field(nullable=False)
  12. relation_id: str = Field(nullable=False)
  13. class TokenRelation(TokenRelationBase, TimeStampMixin, PrimaryKeyMixin, table=True):
  14. pass
  15. class TokenRelationQuery(TokenRelationBase):
  16. pass
  17. class TokenRelationDelete(BaseModel):
  18. relation_type: RelationType = Field(nullable=False)
  19. relation_id: str = Field(nullable=False)