Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031
  1. const Objection = require('objection')
  2. const Schmervice = require('@hapipal/schmervice')
  3. const ProfileModel = require('../models/profile')
  4. const ResponseModel = require('../models/response')
  5. const ProfileService = require('../services/profile')
  6. const ProfileProfilesRoute = require('../routes/profile/profiles')
  7. const ProfileCreateRoute = require('../routes/profile/create')
  8. module.exports = {
  9. name: 'profile-plugin',
  10. version: '1.0.0',
  11. register: async (server, options) => {
  12. await server.registerModel(ProfileModel)
  13. await server.registerModel(ResponseModel)
  14. // Bind to global context
  15. // So we can use Objection transactions
  16. server.bind({
  17. transaction: fn => Objection.transaction(server.knex(), fn),
  18. })
  19. await server.register(Schmervice)
  20. server.registerService(ProfileService)
  21. await server.route(ProfileProfilesRoute)
  22. await server.route(ProfileCreateRoute)
  23. },
  24. }