| 1234567891011121314151617181920212223242526272829 |
- const Objection = require('objection')
- const Schmervice = require('@hapipal/schmervice')
-
- const ProfileModel = require('../models/profile')
- const ResponseModel = require('../models/response')
-
- const ProfileService = require('../services/profile')
-
- const ProfileProfilesRoute = require('../routes/profile/profiles')
-
- module.exports = {
- name: 'profile-plugin',
- version: '1.0.0',
- register: async (server, options) => {
- await server.registerModel(ProfileModel)
- await server.registerModel(ResponseModel)
-
- // 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(ProfileService)
-
- await server.route(ProfileProfilesRoute)
- },
- }
|