index.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import Account from './account'
  2. import Balance from './balance'
  3. import Block from './block'
  4. import Channel from './channel'
  5. import Council from './council'
  6. import Consul from './councilseat'
  7. import Commitment from './commitment'
  8. import Era from './era'
  9. import Event from './event'
  10. import Proposal from './proposal'
  11. import ProposalPost from './proposalpost'
  12. import ProposalVote from './proposalvote'
  13. import Member from './member'
  14. import Category from './category'
  15. import Thread from './thread'
  16. import Post from './post'
  17. import Moderation from './moderation'
  18. Member.hasMany(Account)
  19. Member.belongsTo(Account, { as: 'root', constraints: false })
  20. Member.belongsTo(Account, { as: 'controller', constraints: false })
  21. Member.hasMany(Consul, { as: 'terms' })
  22. Member.hasMany(Commitment, { as: 'votes' })
  23. Member.hasMany(Category)
  24. Member.hasMany(Thread)
  25. Member.hasMany(Post)
  26. Member.hasMany(Proposal)
  27. Account.belongsTo(Member)
  28. Account.hasMany(Balance)
  29. Account.hasMany(Block, { as: 'validated', foreignKey: 'validatorKey' })
  30. Account.hasMany(Moderation)
  31. Balance.belongsTo(Account)
  32. Balance.belongsTo(Era)
  33. Era.hasMany(Balance)
  34. Era.hasMany(Block)
  35. Block.belongsTo(Account, { as: 'validator' })
  36. Block.belongsTo(Era)
  37. Block.hasMany(Event)
  38. Event.belongsTo(Block)
  39. Council.hasMany(Consul)
  40. Council.hasMany(Proposal)
  41. Council.hasMany(Commitment)
  42. Consul.belongsTo(Council)
  43. Consul.belongsTo(Member)
  44. Consul.hasMany(Commitment, { as: 'voters' })
  45. Consul.hasMany(ProposalVote, { as: 'votes' })
  46. Commitment.belongsTo(Consul)
  47. Commitment.belongsTo(Member)
  48. Commitment.belongsTo(Council)
  49. Channel.belongsTo(Member, { as: 'owner' })
  50. Category.hasMany(Thread)
  51. Category.belongsTo(Moderation)
  52. Thread.belongsTo(Moderation)
  53. Post.belongsTo(Moderation)
  54. Moderation.hasMany(Category)
  55. Moderation.hasMany(Thread)
  56. Moderation.hasMany(Post)
  57. Moderation.belongsTo(Account, { as: 'moderator' })
  58. Thread.belongsTo(Category)
  59. Thread.belongsTo(Member, { as: 'creator' })
  60. Thread.hasMany(Post)
  61. Post.belongsTo(Thread)
  62. Post.belongsTo(Member, { as: 'author' })
  63. Post.belongsTo(Member, { as: 'moderator' })
  64. Proposal.belongsTo(Member, { as: 'author' })
  65. Proposal.hasMany(ProposalPost, { as: 'posts' })
  66. Proposal.hasMany(ProposalVote, { as: 'votes' })
  67. ProposalPost.belongsTo(Proposal)
  68. ProposalPost.belongsTo(Member, { as: 'author' })
  69. ProposalVote.belongsTo(Proposal)
  70. ProposalVote.belongsTo(Consul)
  71. ProposalVote.belongsTo(Member)
  72. export {
  73. Account,
  74. Balance,
  75. Block,
  76. Channel,
  77. Council,
  78. Consul,
  79. Commitment,
  80. Era,
  81. Event,
  82. Member,
  83. Proposal,
  84. ProposalPost,
  85. ProposalVote,
  86. Category,
  87. Thread,
  88. Post,
  89. Moderation,
  90. }