address.go 709 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package models
  2. import (
  3. "time"
  4. "github.com/qor5/admin/media/media_library"
  5. "github.com/qor5/admin/publish"
  6. )
  7. type Customer struct {
  8. ID uint `gorm:"primarykey"`
  9. Name string
  10. Addresses []*Address
  11. MembershipCard *MembershipCard
  12. }
  13. type Address struct {
  14. ID uint `gorm:"primarykey"`
  15. CustomerID uint
  16. Street string
  17. HomeImage media_library.MediaBox `sql:"type:text;"`
  18. UpdatedAt time.Time
  19. CreatedAt time.Time
  20. publish.Status
  21. Phones []*Phone
  22. }
  23. type Phone struct {
  24. ID uint `gorm:"primarykey"`
  25. AddressID uint
  26. Number int
  27. }
  28. type MembershipCard struct {
  29. ID uint `gorm:"primarykey"`
  30. CustomerID uint
  31. Number int
  32. ValidBefore *time.Time
  33. }