1
0

status.ts 997 B

1234567891011121314151617181920212223242526272829303132
  1. const router = require('express').Router()
  2. import {
  3. Block,
  4. Event,
  5. Era,
  6. Account,
  7. Member,
  8. Post,
  9. Category,
  10. Thread,
  11. Proposal,
  12. } from '../db/models'
  13. router.get('/', async (req: any, res: any, next: any) => {
  14. try {
  15. res.json({
  16. blocks: await Block.findAll().then((blocks: any) => blocks.length),
  17. events: await Event.findAll().then((blocks: any) => blocks.length),
  18. eras: await Era.findAll().then((blocks: any) => blocks.length),
  19. accounts: await Account.findAll().then((blocks: any) => blocks.length),
  20. members: await Member.findAll().then((blocks: any) => blocks.length),
  21. categories: await Category.findAll().then((blocks: any) => blocks.length),
  22. threads: await Thread.findAll().then((blocks: any) => blocks.length),
  23. posts: await Post.findAll().then((blocks: any) => blocks.length),
  24. proposals: await Proposal.findAll().then((blocks: any) => blocks.length),
  25. })
  26. } catch (err) {
  27. next(err)
  28. }
  29. })
  30. module.exports = router