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 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. const Objection = require('objection')
  2. const Schmervice = require('@hapipal/schmervice')
  3. const ProfileModel = require('../models/profile')
  4. const TagModel = require('../models/tag')
  5. const TagAssociationModel = require('../models/tag-association')
  6. const AspectModel = require('../models/aspect')
  7. const AspectLabelModel = require('../models/aspect_label')
  8. const ResponseModel = require('../models/response')
  9. const ZipCodeModel = require('../models/zip-code')
  10. const MatchQueueModel = require('../models/matchqueue')
  11. const ProfileService = require('../services/profile')
  12. const MatchQueueService = require('../services/matchqueue')
  13. const MatchService = require('../services/match')
  14. const ProfileScoreRoute = require('../routes/profile/score')
  15. const ProfileUpdateRoute = require('../routes/profile/update')
  16. const ProfileRespondRoute = require('../routes/profile/respond')
  17. const ProfileMatchRoute = require('../routes/profile/match')
  18. const ProfileQueueRoute = require('../routes/profile/queue')
  19. const ProfileGetRoute = require('../routes/profile/get')
  20. const ProfilePatchQueueRoute = require('../routes/profile/patch-queue')
  21. module.exports = {
  22. name: 'profile-plugin',
  23. version: '1.0.0',
  24. register: async (server, options) => {
  25. await server.registerModel(ProfileModel)
  26. await server.registerModel(TagModel)
  27. await server.registerModel(TagAssociationModel)
  28. await server.registerModel(AspectModel)
  29. await server.registerModel(AspectLabelModel)
  30. await server.registerModel(ResponseModel)
  31. await server.registerModel(ZipCodeModel)
  32. await server.registerModel(MatchQueueModel)
  33. // Bind to global context
  34. // So we can use Objection transactions
  35. server.bind({
  36. transaction: fn => Objection.transaction(server.knex(), fn),
  37. })
  38. await server.register(Schmervice)
  39. await server.registerService(ProfileService)
  40. await server.registerService(MatchQueueService)
  41. await server.registerService(MatchService)
  42. await server.route(ProfileScoreRoute)
  43. await server.route(ProfileRespondRoute)
  44. await server.route(ProfileUpdateRoute)
  45. await server.route(ProfileMatchRoute)
  46. await server.route(ProfileQueueRoute)
  47. await server.route(ProfileGetRoute)
  48. await server.route(ProfilePatchQueueRoute)
  49. },
  50. }