You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

survey.js 813B

12345678910111213141516171819202122232425262728
  1. const Objection = require('objection')
  2. const Schmervice = require('@hapipal/schmervice')
  3. const ReponseKeyModel = require('../models/response-key')
  4. const ResponseService = require('../services/response')
  5. const ResponseQuestionsRoute = require('../routes/survey/questions')
  6. module.exports = {
  7. name: 'survey-plugin',
  8. version: '1.0.0',
  9. register: async (server, options) => {
  10. await server.registerModel(ReponseKeyModel)
  11. // Bind to global context
  12. // So we can use Objection transactions
  13. server.bind({
  14. transaction: fn => Objection.transaction(server.knex(), fn),
  15. })
  16. await server.register(Schmervice)
  17. server.registerService(ResponseService)
  18. await server.route(ResponseQuestionsRoute)
  19. },
  20. models: { ReponseKeyModel },
  21. }