feeds.hrl 2.3 KB

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