| 12345678910111213141516171819202122232425262728 |
- const Objection = require('objection')
- const Schmervice = require('@hapipal/schmervice')
-
- const ReponseKeyModel = require('../models/response-key')
-
- const ResponseService = require('../services/response')
-
- const ResponseQuestionsRoute = require('../routes/survey/questions')
-
- module.exports = {
- name: 'survey-plugin',
- version: '1.0.0',
- register: async (server, options) => {
- await server.registerModel(ReponseKeyModel)
-
- // Bind to global context
- // So we can use Objection transactions
- server.bind({
- transaction: fn => Objection.transaction(server.knex(), fn),
- })
-
- await server.register(Schmervice)
- server.registerService(ResponseService)
-
- await server.route(ResponseQuestionsRoute)
- },
- models: { ReponseKeyModel },
- }
|