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.

48 lines
1.9 KiB

  1. import { Plugin } from '@nuxt/types'
  2. import { FromApiLabelItemListRepository } from '@/repositories/label/api'
  3. import { FromApiMemberItemListRepository } from '@/repositories/member/api'
  4. import { FromApiUserItemListRepository } from '@/repositories/user/api'
  5. import { FromApiRoleItemListRepository } from '@/repositories/role/api'
  6. import { FromApiProjectItemListRepository } from '@/repositories/project/api'
  7. import { LabelApplicationService } from '@/services/application/label.service'
  8. import { MemberApplicationService } from '@/services/application/member.service'
  9. import { UserApplicationService } from '@/services/application/user.service'
  10. import { RoleApplicationService } from '@/services/application/role.service'
  11. import { ProjectApplicationService } from '@/services/application/project.service'
  12. export interface Services {
  13. label: LabelApplicationService,
  14. member: MemberApplicationService,
  15. user: UserApplicationService,
  16. role: RoleApplicationService,
  17. project: ProjectApplicationService
  18. }
  19. declare module 'vue/types/vue' {
  20. interface Vue {
  21. readonly $services: Services
  22. }
  23. }
  24. const plugin: Plugin = (context, inject) => {
  25. const labelRepository = new FromApiLabelItemListRepository()
  26. const label = new LabelApplicationService(labelRepository)
  27. const memberRepository = new FromApiMemberItemListRepository()
  28. const member = new MemberApplicationService(memberRepository)
  29. const userRepository = new FromApiUserItemListRepository()
  30. const user = new UserApplicationService(userRepository)
  31. const roleRepository = new FromApiRoleItemListRepository()
  32. const role = new RoleApplicationService(roleRepository)
  33. const projectRepository = new FromApiProjectItemListRepository()
  34. const project = new ProjectApplicationService(projectRepository)
  35. const services: Services = {
  36. label,
  37. member,
  38. user,
  39. role,
  40. project
  41. }
  42. inject('services', services)
  43. }
  44. export default plugin