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.

37 lines
1.0 KiB

3 years ago
3 years ago
  1. package models
  2. import "gorm.io/gorm"
  3. type PetCategory struct {
  4. gorm.Model `json:"-"`
  5. Id int `json:"id" gorm:"primary_key"`
  6. PetId int `json:"-"`
  7. Name string `json:"name"`
  8. }
  9. type PetTag struct {
  10. gorm.Model `json:"-"`
  11. Id int `json:"id" gorm:"primary_key"`
  12. PetId int `json:"-"`
  13. Name string `json:"name"`
  14. }
  15. type PetPhoto struct {
  16. gorm.Model `json:"-"`
  17. Id int `gorm:"primary_key"`
  18. PetId int `json:"-"`
  19. Url string `gorm:"-"`
  20. FileName string `json:"-"`
  21. AdditionalMetadata string `json:"-"`
  22. }
  23. type Pet struct {
  24. gorm.Model `json:"-"`
  25. Id int `json:"id" gorm:"primary_key"`
  26. Name string `json:"name"`
  27. Categories PetCategory `json:"category" gorm:"ForeignKey:PetId"`
  28. PhotoUrlJson []string `json:"photoUrls" gorm:"-"`
  29. PhotoUrls []PetPhoto `json:"-" gorm:"ForeignKey:PetId"`
  30. Tags []PetTag `json:"tags" gorm:"ForeignKey:PetId"`
  31. Status string `json:"status"`
  32. }