選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

profile.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637
  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. module.exports = {
  12. name: 'profile-plugin',
  13. version: '1.0.0',
  14. register: async (server, options) => {
  15. await server.registerModel(ProfileModel)
  16. await server.registerModel(ResponseModel)
  17. await server.registerModel(ZipCodeModel)
  18. // Bind to global context
  19. // So we can use Objection transactions
  20. server.bind({
  21. transaction: fn => Objection.transaction(server.knex(), fn),
  22. })
  23. await server.register(Schmervice)
  24. server.registerService(ProfileService)
  25. await server.route(ProfileScoreRoute)
  26. await server.route(ProfileRespondRoute)
  27. await server.route(ProfileUpdateRoute)
  28. await server.route(ProfileMatchRoute)
  29. },
  30. }