folders.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package models
  2. import (
  3. "errors"
  4. "time"
  5. )
  6. // Typed errors
  7. var (
  8. ErrFolderNotFound = errors.New("Folder not found")
  9. ErrFolderVersionMismatch = errors.New("The folder has been changed by someone else")
  10. ErrFolderTitleEmpty = errors.New("Folder title cannot be empty")
  11. ErrFolderWithSameUIDExists = errors.New("A folder with the same uid already exists")
  12. ErrFolderFailedGenerateUniqueUid = errors.New("Failed to generate unique folder id")
  13. )
  14. type Folder struct {
  15. Id int64
  16. Title string
  17. Slug string
  18. OrgId int64
  19. Version int
  20. Created time.Time
  21. Updated time.Time
  22. UpdatedBy int64
  23. CreatedBy int64
  24. HasAcl bool
  25. }
  26. //
  27. // COMMANDS
  28. //
  29. type CreateFolderCommand struct {
  30. OrgId int64 `json:"-"`
  31. UserId int64 `json:"userId"`
  32. Title string `json:"title"`
  33. Result *Folder
  34. }
  35. type UpdateFolderCommand struct {
  36. OrgId int64 `json:"-"`
  37. UserId int64 `json:"userId"`
  38. Title string `json:"title"`
  39. Version int `json:"version"`
  40. Result *Folder
  41. }
  42. //
  43. // QUERIES
  44. //
  45. type DashboardFolder struct {
  46. Id int64 `json:"id"`
  47. Title string `json:"title"`
  48. }
  49. type GetFoldersForSignedInUserQuery struct {
  50. OrgId int64
  51. SignedInUser *SignedInUser
  52. Title string
  53. Result []*DashboardFolder
  54. }