feeds.hrl 2.4 KB

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