1
0

index.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 ConsulStake from './councilstake'
  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(ConsulStake, { 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. Consul.belongsTo(Council)
  42. Consul.belongsTo(Member)
  43. Consul.hasMany(ConsulStake, { as: 'voters' })
  44. Consul.hasMany(ProposalVote, { as: 'votes' })
  45. ConsulStake.belongsTo(Consul)
  46. ConsulStake.belongsTo(Member)
  47. Channel.belongsTo(Member, { as: 'owner' })
  48. Category.hasMany(Thread)
  49. Category.belongsTo(Moderation)
  50. Thread.belongsTo(Moderation)
  51. Post.belongsTo(Moderation)
  52. Moderation.hasMany(Category)
  53. Moderation.hasMany(Thread)
  54. Moderation.hasMany(Post)
  55. Moderation.belongsTo(Account, { as: 'moderator' })
  56. Thread.belongsTo(Category)
  57. Thread.belongsTo(Member, { as: 'creator' })
  58. Thread.hasMany(Post)
  59. Post.belongsTo(Thread)
  60. Post.belongsTo(Member, { as: 'author' })
  61. Post.belongsTo(Member, { as: 'moderator' })
  62. Proposal.belongsTo(Member, { as: 'author' })
  63. Proposal.hasMany(ProposalPost, { as: 'posts' })
  64. Proposal.hasMany(ProposalVote, { as: 'votes' })
  65. ProposalPost.belongsTo(Proposal)
  66. ProposalPost.belongsTo(Member, { as: 'author' })
  67. ProposalVote.belongsTo(Proposal)
  68. ProposalVote.belongsTo(Consul)
  69. ProposalVote.belongsTo(Member)
  70. export {
  71. Account,
  72. Balance,
  73. Block,
  74. Channel,
  75. Council,
  76. Consul,
  77. ConsulStake,
  78. Era,
  79. Event,
  80. Member,
  81. Proposal,
  82. ProposalPost,
  83. ProposalVote,
  84. Category,
  85. Thread,
  86. Post,
  87. Moderation,
  88. }