feeds.hrl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. -record(feed, {
  2. id,
  3. top,
  4. aclver,
  5. entries_count=0}).
  6. -record(iterator, {
  7. id,
  8. object,
  9. prev,
  10. type,
  11. next}).
  12. -record(entry, {
  13. id, % {entry_id, feed_id} we want to hold in key information about feed
  14. entry_id, % these fields
  15. feed_id, % are for secondary indexes
  16. from, % author
  17. to,
  18. title,
  19. description,
  20. created, % time
  21. hidden,
  22. access,
  23. shared,
  24. starred,
  25. deleted,
  26. likes,
  27. likes_count,
  28. comments,
  29. comments_rear,
  30. comments_count,
  31. media = [], %% for oembed
  32. etc, %% field to link additional info
  33. type = {user, normal},
  34. next,
  35. prev}).
  36. -record(id_seq, {thing, id}).
  37. -record(media, {
  38. id,
  39. title :: iolist(),
  40. width,
  41. height,
  42. html :: iolist(),
  43. url :: iolist(),
  44. version,
  45. thumbnail_url :: iolist(),
  46. type :: {atom(), atom() | string()},
  47. thumbnail_height}).
  48. -record(comment, {
  49. id, %% {comment_id, entry_id}
  50. comment_id, %% generowane przez id_seq
  51. entry_id, %% index
  52. content, %% text of comment
  53. author_id,
  54. creation_time,
  55. media = [], %% for oembed
  56. parent,
  57. comments,
  58. comments_rear,
  59. next,
  60. prev }).
  61. -record(entry_likes, {
  62. entry_id, % this is a general entry_id. Every same entry in different feeds has the same id
  63. one_like_head, % this is a head for linked list of {user, time} tupples
  64. total_count % it's easier to keep it than count
  65. }).
  66. -record(user_likes, {
  67. user_id,
  68. one_like_head,
  69. total_count
  70. }).
  71. -record(one_like, {
  72. id, % just a number
  73. user_id, % who likes
  74. entry_id, % what
  75. feed_id, % where
  76. created_time, % when
  77. next
  78. }).
  79. -record(hidden_feed, {id}).
  80. % Statistics. We have to keep count of user entries and comments.
  81. % Gathering it the old way will work very ineffective with more users to come.
  82. % And comments from user record are somehow always undefined. Either it fails, or it is used somewhere else
  83. -record(user_etries_count, {
  84. user_id, % user id
  85. entries = 0, % number of entries
  86. comments = 0 % number of comments
  87. }).