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.4KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 ZipCodeModel = require('../models/zip-code')
  6. const ProfileService = require('../services/profile')
  7. const ProfileScoreRoute = require('../routes/profile/score')
  8. const ProfileUpdateRoute = require('../routes/profile/update')
  9. const ProfileRespondRoute = require('../routes/profile/respond')
  10. const ProfileMatchRoute = require('../routes/profile/match')
  11. const ProfileQueueRoute = require('../routes/profile/queue')
  12. module.exports = {
  13. name: 'profile-plugin',
  14. version: '1.0.0',
  15. register: async (server, options) => {
  16. await server.registerModel(ProfileModel)
  17. await server.registerModel(ResponseModel)
  18. await server.registerModel(ZipCodeModel)
  19. // Bind to global context
  20. // So we can use Objection transactions
  21. server.bind({
  22. transaction: fn => Objection.transaction(server.knex(), fn),
  23. })
  24. await server.register(Schmervice)
  25. server.registerService(ProfileService)
  26. await server.route(ProfileScoreRoute)
  27. await server.route(ProfileRespondRoute)
  28. await server.route(ProfileUpdateRoute)
  29. await server.route(ProfileMatchRoute)
  30. await server.route(ProfileQueueRoute)
  31. },
  32. }