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(media, {
  21. id,
  22. title :: iolist(),
  23. width,
  24. height,
  25. html :: iolist(),
  26. url :: iolist(),
  27. version,
  28. thumbnail_url :: iolist(),
  29. type :: {atom(), atom() | string()},
  30. thumbnail_height}).
  31. -record(comment, {?ITERATOR(feed), % {comment_id, entry_id}
  32. comment_id,
  33. entry_id,
  34. content,
  35. from,
  36. created,
  37. media = [],
  38. parent}).
  39. -record(entry_views, {?CONTAINER}).
  40. -record(user_view, {?ITERATOR(entry_views), user, created}).
  41. -record(like, {?ITERATOR(feed), user_id, entry_id, created}).
  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. }).