Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

profile.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435
  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 ProfileScoreRoute = require('../routes/profile/score')
  8. const ProfileCreateRoute = require('../routes/profile/create')
  9. const ProfileUpdateRoute = require('../routes/profile/update')
  10. module.exports = {
  11. name: 'profile-plugin',
  12. version: '1.0.0',
  13. register: async (server, options) => {
  14. await server.registerModel(ProfileModel)
  15. await server.registerModel(ResponseModel)
  16. // Bind to global context
  17. // So we can use Objection transactions
  18. server.bind({
  19. transaction: fn => Objection.transaction(server.knex(), fn),
  20. })
  21. await server.register(Schmervice)
  22. server.registerService(ProfileService)
  23. await server.route(ProfileProfilesRoute)
  24. await server.route(ProfileScoreRoute)
  25. await server.route(ProfileCreateRoute)
  26. await server.route(ProfileUpdateRoute)
  27. },
  28. }