AI ニジカ綜合
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.2 KiB

  1. from __future__ import annotations
  2. from datetime import datetime
  3. from eloquent import Model
  4. class Answer (Model):
  5. id: int
  6. query_id: int
  7. character: int
  8. content: str
  9. answer_type: int
  10. sent_at: datetime
  11. answered: bool
  12. __timestamps__ = False
  13. @property
  14. def query (
  15. self,
  16. ) -> Query:
  17. return self.belongs_to (Query)
  18. class Query (Model):
  19. id: int
  20. user_id: int | None
  21. target_character: int
  22. content: str
  23. image_url: str | None
  24. query_type: int
  25. model: int
  26. sent_at: datetime
  27. answered: bool
  28. __timestamps__ = False
  29. @property
  30. def user (
  31. self,
  32. ) -> User:
  33. return self.belongs_to (User)
  34. @property
  35. def answer_histories (
  36. self,
  37. ) -> list[QueryAnswerHistory]:
  38. return self.has_many (QueryAnswerHistory)
  39. class QueryAnswerHistory (Model):
  40. id: int
  41. query_id: int
  42. answer_id: int
  43. class User (Model):
  44. id: int
  45. platform: int
  46. code: str
  47. name: str
  48. icon: bytes