All files / projects/organization-management/src/app/pages organization-management-routing.module.ts

23.25% Statements 10/43
100% Branches 0/0
0% Functions 0/33
45% Lines 9/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 9226x 26x   26x 26x   26x 26x 26x             26x                                                                                                                                                     26x  
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
 
import { authorizationToggleGuard } from 'ish-core/authorization-toggle.module';
import { featureToggleGuard } from 'ish-core/feature-toggle.module';
 
import { fetchCostCentersGuard } from '../guards/fetch-cost-centers.guard';
import { fetchUsersGuard } from '../guards/fetch-users.guard';
import { redirectFirstToParentGuard } from '../guards/redirect-first-to-parent.guard';
 
/**
 * routes for the organization management
 *
 * visible for testing
 */
export const routes: Routes = [
  { path: '', redirectTo: 'cost-centers', pathMatch: 'full' },
  {
    path: 'users',
    loadChildren: () => import('./users/users-page.module').then(m => m.UsersPageModule),
    data: { permission: 'APP_B2B_MANAGE_USERS' },
    canActivate: [fetchUsersGuard, authorizationToggleGuard],
  },
  {
    path: 'users/create',
    loadChildren: () => import('./user-create/user-create-page.module').then(m => m.UserCreatePageModule),
    data: { permission: 'APP_B2B_MANAGE_USERS' },
    canActivate: [redirectFirstToParentGuard, authorizationToggleGuard],
  },
  {
    path: 'users/:B2BCustomerLogin',
    loadChildren: () => import('./user-detail/user-detail-page.module').then(m => m.UserDetailPageModule),
    canActivate: [fetchUsersGuard, authorizationToggleGuard],
    data: {
      onlyInitialUsers: true,
      permission: 'APP_B2B_MANAGE_USERS',
    },
  },
  {
    path: 'users/:B2BCustomerLogin/profile',
    loadChildren: () =>
      import('./user-edit-profile/user-edit-profile-page.module').then(m => m.UserEditProfilePageModule),
    canActivate: [redirectFirstToParentGuard, authorizationToggleGuard],
    data: { permission: 'APP_B2B_MANAGE_USERS' },
  },
  {
    path: 'users/:B2BCustomerLogin/roles',
    loadChildren: () => import('./user-edit-roles/user-edit-roles-page.module').then(m => m.UserEditRolesPageModule),
    canActivate: [redirectFirstToParentGuard, authorizationToggleGuard],
    data: { permission: 'APP_B2B_MANAGE_USERS' },
  },
  {
    path: 'users/:B2BCustomerLogin/budget',
    loadChildren: () => import('./user-edit-budget/user-edit-budget-page.module').then(m => m.UserEditBudgetPageModule),
    canActivate: [redirectFirstToParentGuard, authorizationToggleGuard],
    data: { permission: 'APP_B2B_MANAGE_USERS' },
  },
  {
    path: 'cost-centers',
    canActivate: [featureToggleGuard, fetchCostCentersGuard],
    data: { feature: 'costCenters' },
    loadChildren: () => import('./cost-centers/cost-centers-page.module').then(m => m.CostCentersPageModule),
  },
  {
    path: 'cost-centers/create',
    loadChildren: () =>
      import('./cost-center-create/cost-center-create-page.module').then(m => m.CostCenterCreatePageModule),
    canActivate: [redirectFirstToParentGuard],
  },
  {
    path: 'cost-centers/:CostCenterId',
    loadChildren: () =>
      import('./cost-center-detail/cost-center-detail-page.module').then(m => m.CostCenterDetailPageModule),
  },
  {
    path: 'cost-centers/:CostCenterId/edit',
    loadChildren: () => import('./cost-center-edit/cost-center-edit-page.module').then(m => m.CostCenterEditPageModule),
    canActivate: [redirectFirstToParentGuard],
  },
  {
    path: 'cost-centers/:CostCenterId/buyers',
    loadChildren: () =>
      import('./cost-center-buyers/cost-center-buyers-page.module').then(m => m.CostCenterBuyersPageModule),
    canActivate: [redirectFirstToParentGuard, fetchUsersGuard],
  },
];
 
@NgModule({
  imports: [RouterModule.forChild(routes)],
})
export class OrganizationManagementRoutingModule {}