feeds.hrl 2.4 KB

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