You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

profile.js 1.7KB

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