feeds.hrl 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. title,
  12. 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, id}).
  30. -record(media, {
  31. id,
  32. title :: iolist(),
  33. width,
  34. height,
  35. html :: iolist(),
  36. url :: iolist(),
  37. version,
  38. thumbnail_url :: iolist(),
  39. type :: {atom(), atom() | string()},
  40. thumbnail_height}).
  41. -record(comment, {
  42. id, %% {comment_id, entry_id}
  43. comment_id, %% generowane przez id_seq
  44. entry_id, %% index
  45. content, %% text of comment
  46. author_id,
  47. creation_time,
  48. media = [], %% for oembed
  49. parent,
  50. comments,
  51. comments_rear,
  52. next,
  53. prev }).
  54. -record(entry_likes, {
  55. entry_id, % this is a general entry_id. Every same entry in different feeds has the same id
  56. one_like_head, % this is a head for linked list of {user, time} tupples
  57. total_count % it's easier to keep it than count
  58. }).
  59. -record(user_likes, {
  60. user_id,
  61. one_like_head,
  62. total_count
  63. }).
  64. -record(one_like, {
  65. id, % just a number
  66. user_id, % who likes
  67. entry_id, % what
  68. feed_id, % where
  69. created_time, % when
  70. next
  71. }).
  72. -record(hidden_feed, {id}).
  73. % Statistics. We have to keep count of user entries and comments.
  74. % Gathering it the old way will work very ineffective with more users to come.
  75. % And comments from user record are somehow always undefined. Either it fails, or it is used somewhere else
  76. -record(user_etries_count, {
  77. user_id, % user id
  78. entries = 0, % number of entries
  79. comments = 0 % number of comments
  80. }).