feeds.hrl 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_likes, {
  41. entry_id, % this is a general entry_id. Every same entry in different feeds has the same id
  42. one_like_head, % this is a head for linked list of {user, time} tupples
  43. total_count % it's easier to keep it than count
  44. }).
  45. -record(user_likes, {
  46. user_id,
  47. one_like_head,
  48. total_count
  49. }).
  50. -record(one_like, {
  51. id, % just a number
  52. user_id, % who likes
  53. entry_id, % what
  54. feed_id, % where
  55. created_time, % when
  56. next
  57. }).
  58. -record(hidden_feed, {id}).
  59. % Statistics. We have to keep count of user entries and comments.
  60. % Gathering it the old way will work very ineffective with more users to come.
  61. % And comments from user record are somehow always undefined. Either it fails, or it is used somewhere else
  62. -record(user_etries_count, {
  63. user_id, % user id
  64. entries = 0, % number of entries
  65. comments = 0 % number of comments
  66. }).