A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
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.
 
 
 
 
 

70 line
3.0 KiB

  1. package writefreely
  2. import (
  3. "database/sql"
  4. )
  5. type (
  6. Collection struct {
  7. ID int64 `datastore:"id" json:"-"`
  8. Alias string `datastore:"alias" schema:"alias" json:"alias"`
  9. Title string `datastore:"title" schema:"title" json:"title"`
  10. Description string `datastore:"description" schema:"description" json:"description"`
  11. Direction string `schema:"dir" json:"dir,omitempty"`
  12. Language string `schema:"lang" json:"lang,omitempty"`
  13. StyleSheet string `datastore:"style_sheet" schema:"style_sheet" json:"style_sheet"`
  14. Script string `datastore:"script" schema:"script" json:"script,omitempty"`
  15. Public bool `datastore:"public" json:"public"`
  16. Visibility collVisibility `datastore:"private" json:"-"`
  17. Format string `datastore:"format" json:"format,omitempty"`
  18. Views int64 `json:"views"`
  19. OwnerID int64 `datastore:"owner_id" json:"-"`
  20. PublicOwner bool `datastore:"public_owner" json:"-"`
  21. PreferSubdomain bool `datastore:"prefer_subdomain" json:"-"`
  22. Domain string `datastore:"domain" json:"domain,omitempty"`
  23. IsDomainActive bool `datastore:"is_active" json:"-"`
  24. IsSecure bool `datastore:"is_secure" json:"-"`
  25. CustomHandle string `datastore:"handle" json:"-"`
  26. Email string `json:"email,omitempty"`
  27. URL string `json:"url,omitempty"`
  28. app *app
  29. }
  30. CollectionObj struct {
  31. Collection
  32. TotalPosts int `json:"total_posts"`
  33. Owner *User `json:"owner,omitempty"`
  34. Posts *[]PublicPost `json:"posts,omitempty"`
  35. }
  36. SubmittedCollection struct {
  37. // Data used for updating a given collection
  38. ID int64
  39. OwnerID uint64
  40. // Form helpers
  41. PreferURL string `schema:"prefer_url" json:"prefer_url"`
  42. Privacy int `schema:"privacy" json:"privacy"`
  43. Pass string `schema:"password" json:"password"`
  44. Federate bool `schema:"federate" json:"federate"`
  45. MathJax bool `schema:"mathjax" json:"mathjax"`
  46. Handle string `schema:"handle" json:"handle"`
  47. // Actual collection values updated in the DB
  48. Alias *string `schema:"alias" json:"alias"`
  49. Title *string `schema:"title" json:"title"`
  50. Description *string `schema:"description" json:"description"`
  51. StyleSheet *sql.NullString `schema:"style_sheet" json:"style_sheet"`
  52. Script *sql.NullString `schema:"script" json:"script"`
  53. Visibility *int `schema:"visibility" json:"public"`
  54. Format *sql.NullString `schema:"format" json:"format"`
  55. PreferSubdomain *bool `schema:"prefer_subdomain" json:"prefer_subdomain"`
  56. Domain *sql.NullString `schema:"domain" json:"domain"`
  57. }
  58. CollectionFormat struct {
  59. Format string
  60. }
  61. )
  62. // collVisibility represents the visibility level for the collection.
  63. type collVisibility int