dashboard_snapshot.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package models
  2. import "time"
  3. // DashboardSnapshot model
  4. type DashboardSnapshot struct {
  5. Id int64
  6. Name string
  7. Key string
  8. DeleteKey string
  9. OrgId int64
  10. UserId int64
  11. External bool
  12. ExternalUrl string
  13. Expires time.Time
  14. Created time.Time
  15. Updated time.Time
  16. Dashboard map[string]interface{}
  17. }
  18. // DashboardSnapshotDTO without dashboard map
  19. type DashboardSnapshotDTO struct {
  20. Id int64 `json:"id"`
  21. Name string `json:"name"`
  22. Key string `json:"key"`
  23. DeleteKey string `json:"deleteKey"`
  24. OrgId int64 `json:"orgId"`
  25. UserId int64 `json:"userId"`
  26. External bool `json:"external"`
  27. ExternalUrl string `json:"externalUrl"`
  28. Expires time.Time `json:"expires"`
  29. Created time.Time `json:"created"`
  30. Updated time.Time `json:"updated"`
  31. }
  32. // -----------------
  33. // COMMANDS
  34. type CreateDashboardSnapshotCommand struct {
  35. Dashboard map[string]interface{} `json:"dashboard" binding:"Required"`
  36. Name string `json:"name" binding:"Required"`
  37. Expires int64 `json:"expires"`
  38. // these are passed when storing an external snapshot ref
  39. External bool `json:"external"`
  40. Key string `json:"key"`
  41. DeleteKey string `json:"deleteKey"`
  42. OrgId int64 `json:"-"`
  43. UserId int64 `json:"-"`
  44. Result *DashboardSnapshot
  45. }
  46. type DeleteDashboardSnapshotCommand struct {
  47. DeleteKey string `json:"-"`
  48. }
  49. type GetDashboardSnapshotQuery struct {
  50. Key string
  51. Result *DashboardSnapshot
  52. }
  53. type DashboardSnapshots []*DashboardSnapshot
  54. type GetDashboardSnapshotsQuery struct {
  55. Name string
  56. Limit int
  57. OrgId int64
  58. Result DashboardSnapshots
  59. }