feeds.hrl 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. -include("kvs.hrl").
  2. -record(feed, {?CONTAINER, aclver}).
  3. -record(entry, {?ITERATOR(feed), % {entry_id, feed_id}
  4. entry_id,
  5. from,
  6. to,
  7. title,
  8. description,
  9. created,
  10. hidden,
  11. access,
  12. shared,
  13. starred,
  14. deleted,
  15. likes,
  16. likes_count,
  17. media = [],
  18. etc, %% field to link additional info
  19. type = {user, normal}}).
  20. -record(id_seq, {thing, id}).
  21. -record(media, {
  22. id,
  23. title :: iolist(),
  24. width,
  25. height,
  26. html :: iolist(),
  27. url :: iolist(),
  28. version,
  29. thumbnail_url :: iolist(),
  30. type :: {atom(), atom() | string()},
  31. thumbnail_height}).
  32. -record(comment, {?ITERATOR(feed), % {comment_id, entry_id}
  33. comment_id,
  34. entry_id,
  35. content,
  36. from,
  37. created,
  38. media = [],
  39. parent}).
  40. -record(entry_views, {?CONTAINER}).
  41. -record(user_view, {?ITERATOR(entry_views), user}).
  42. -record(entry_likes, {
  43. entry_id, % this is a general entry_id. Every same entry in different feeds has the same id
  44. one_like_head, % this is a head for linked list of {user, time} tupples
  45. total_count % it's easier to keep it than count
  46. }).
  47. -record(user_likes, {
  48. user_id,
  49. one_like_head,
  50. total_count
  51. }).
  52. -record(one_like, {
  53. id, % just a number
  54. user_id, % who likes
  55. entry_id, % what
  56. feed_id, % where
  57. created_time, % when
  58. next
  59. }).
  60. -record(hidden_feed, {id}).
  61. % Statistics. We have to keep count of user entries and comments.
  62. % Gathering it the old way will work very ineffective with more users to come.
  63. % And comments from user record are somehow always undefined. Either it fails, or it is used somewhere else
  64. -record(user_etries_count, {
  65. user_id, % user id
  66. entries = 0, % number of entries
  67. comments = 0 % number of comments
  68. }).