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.

36 lines
974 B

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. }
  22. type Pet struct {
  23. gorm.Model `json:"-"`
  24. Id int `json:"id" gorm:"primary_key"`
  25. Name string `json:"name"`
  26. Categories PetCategory `json:"category" gorm:"ForeignKey:PetId"`
  27. PhotoUrlJson []string `json:"photoUrls" gorm:"-"`
  28. PhotoUrls []PetPhoto `json:"-" gorm:"ForeignKey:PetId"`
  29. Tags []PetTag `json:"tags" gorm:"ForeignKey:PetId"`
  30. Status string `json:"status"`
  31. }