feeds.hrl 2.1 KB

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