placidenduwayo 2 роки тому
джерело
коміт
89b4950f70
31 змінених файлів з 437 додано та 493 видалено
  1. 2
    100
      db_users_projects_companies.json
  2. 6
    9
      src/app/app.module.ts
  3. 19
    20
      src/app/ngrx/companies/companies.actions.ts
  4. 45
    44
      src/app/ngrx/companies/companies.reducer.ts
  5. 14
    11
      src/app/ngrx/companies/company.action.types.ts
  6. 26
    15
      src/app/ngrx/companies/effects.company.create.ts
  7. 1
    1
      src/app/ngrx/companies/effects.company.get.ts
  8. 49
    29
      src/app/ngrx/companies/effects.company.update.delete.ts
  9. 24
    16
      src/app/ngrx/projects/effects.project.create.ts
  10. 48
    26
      src/app/ngrx/projects/effects.project.get.ts
  11. 0
    1
      src/app/ngrx/projects/effects.project.update.delete.ts
  12. 6
    6
      src/app/ngrx/projects/project.action.types.ts
  13. 84
    75
      src/app/ngrx/projects/projects.actions.ts
  14. 23
    22
      src/app/ngrx/projects/projects.reducer.ts
  15. 1
    1
      src/app/ngrx/users/effects.user.get.ts
  16. 1
    2
      src/app/ngrx/users/effects.user.update.delete.ts
  17. 12
    11
      src/app/ngrx/users/user.action.types.ts
  18. 43
    46
      src/app/ngrx/users/users.actions.ts
  19. 18
    19
      src/app/ngrx/users/users.reducer.ts
  20. 3
    2
      src/app/pages/accueil/accueil/accueil.component.html
  21. 0
    8
      src/app/pages/base-nav-menu/base-nav-menu.component.html
  22. 1
    13
      src/app/pages/base-nav-menu/base-nav-menu.component.ts
  23. 1
    1
      src/app/pages/companies-manager/companies-management/company-nav-bar/company-nav-bar.component.ts
  24. 4
    2
      src/app/pages/companies-manager/companies-management/company-s-projects/company-s-projects.component.ts
  25. 0
    1
      src/app/pages/projects-manager/projects-management/project-with-company-associated/project-with-company-associated.component.ts
  26. 2
    7
      src/app/pages/projects-manager/projects-management/project-with-user-associated/project-with-user-associated-list/project-with-user-associated-list.component.ts
  27. 0
    1
      src/app/pages/users-manager/users-management/user-create/user-create.component.ts
  28. 1
    1
      src/app/pages/users-manager/users-management/user-s-projects/user-s-projects.component.ts
  29. 1
    2
      src/app/pages/users-manager/users-management/users-management.component.ts
  30. 1
    0
      src/app/shared/models/company/company.model.ts
  31. 1
    1
      src/app/shared/services/projects.service.ts

+ 2
- 100
db_users_projects_companies.json Переглянути файл

@@ -9,56 +9,14 @@
9 9
     {
10 10
       "id": 4,
11 11
       "companyName": "Company-4",
12
-      "companyType": "PROSPECT",
13
-      "creationDate": "05 18 2022"
14
-    },
15
-    {
16
-      "id": 3,
17
-      "companyName": "Company-3",
18 12
       "companyType": "CLIENT",
19 13
       "creationDate": "05 18 2022"
20 14
     },
21 15
     {
22
-      "id": 5,
23
-      "companyName": "Company-1",
24
-      "companyType": "CLIENT",
25
-      "creationDate": "06 09 2022"
26
-    },
27
-    {
28
-      "id": 6,
29
-      "companyName": "Company-2",
30
-      "companyType": "CLIENT",
31
-      "creationDate": "06 09 2022"
32
-    },
33
-    {
34
-      "id": 7,
35
-      "companyName": "Company-5",
36
-      "companyType": "CLIENT",
37
-      "creationDate": "06 09 2022"
38
-    },
39
-    {
40 16
       "id": 8,
41 17
       "companyName": "company-6",
42 18
       "companyType": "PROSPECT",
43 19
       "creationDate": "06 09 2022"
44
-    },
45
-    {
46
-      "id": 9,
47
-      "companyName": "Company-7",
48
-      "companyType": "PROSPECT",
49
-      "creationDate": "06 09 2022"
50
-    },
51
-    {
52
-      "id": 10,
53
-      "companyName": "Company-8",
54
-      "companyType": "CLIENT",
55
-      "creationDate": "06 09 2022"
56
-    },
57
-    {
58
-      "id": 11,
59
-      "companyName": "Company-9",
60
-      "companyType": "PROSPECT",
61
-      "creationDate": "06 09 2022"
62 20
     }
63 21
   ],
64 22
   "users": [
@@ -119,48 +77,6 @@
119 77
       "id": 6
120 78
     },
121 79
     {
122
-      "address": {
123
-        "numRue": 44,
124
-        "nomRue": "Rue Notre Dame des Victoires",
125
-        "bp": 75002,
126
-        "ville": "Paris",
127
-        "pays": "France"
128
-      },
129
-      "creationDate": "05 15 2022",
130
-      "firstname": "Marion",
131
-      "lastname": "Jaillot",
132
-      "email": "marion.jaillot@natan.fr",
133
-      "id": 9
134
-    },
135
-    {
136
-      "address": {
137
-        "numRue": 44,
138
-        "nomRue": "Rue Notre Dame des Victoires",
139
-        "bp": 75002,
140
-        "ville": "Paris",
141
-        "pays": "France"
142
-      },
143
-      "creationDate": "05 15 2022",
144
-      "firstname": "avraham",
145
-      "lastname": "Benassaya",
146
-      "email": "avraham.benassaya@natan.fr",
147
-      "id": 10
148
-    },
149
-    {
150
-      "id": 11,
151
-      "firstname": "Charles",
152
-      "lastname": "Benassaya",
153
-      "email": "charles.benassaya@natan.fr",
154
-      "address": {
155
-        "numRue": 44,
156
-        "nomRue": "Rue Notre Dame des Victoires",
157
-        "bp": 75002,
158
-        "ville": "Paris",
159
-        "pays": "France"
160
-      },
161
-      "creationDate": "05 15 2022"
162
-    },
163
-    {
164 80
       "id": 12,
165 81
       "firstname": "Placide",
166 82
       "lastname": "Nduwayo",
@@ -189,20 +105,6 @@
189 105
       "creationDate": "05 15 2022"
190 106
     },
191 107
     {
192
-      "id": 15,
193
-      "firstname": "Rayene",
194
-      "lastname": "Bessrour",
195
-      "email": "rayene.bessrour@natan.fr",
196
-      "address": {
197
-        "numRue": 44,
198
-        "nomRue": "Rue Notre Dame des Victoires",
199
-        "bp": 75004,
200
-        "ville": "Paris",
201
-        "pays": "France"
202
-      },
203
-      "creationDate": "05 15 2022"
204
-    },
205
-    {
206 108
       "id": 19,
207 109
       "firstname": "Syrine",
208 110
       "lastname": "Ait Haddadene",
@@ -267,7 +169,7 @@
267 169
       "projectName": "Project-test",
268 170
       "priority": 1,
269 171
       "creationDate": "06 08 2022",
270
-      "companyId": 11,
172
+      "companyId": 8,
271 173
       "description": "project for test adding ",
272 174
       "userId": 12,
273 175
       "state": "IN PROGRESS"
@@ -279,7 +181,7 @@
279 181
       "creationDate": "06 09 2022",
280 182
       "companyId": 8,
281 183
       "description": "Project description here",
282
-      "userId": 3,
184
+      "userId": 4,
283 185
       "state": "IN PROGRESS"
284 186
     }
285 187
   ]

+ 6
- 9
src/app/app.module.ts Переглянути файл

@@ -1,6 +1,6 @@
1 1
 import { CompanyCreateEffects } from './ngrx/companies/effects.company.create';
2 2
 import { CompanyUpdateDeleteEffects } from './ngrx/companies/effects.company.update.delete';
3
-import { CompanyGetSearchEffects } from './ngrx/companies/effects.company.get';
3
+import { CompanyGetEffects } from './ngrx/companies/effects.company.get';
4 4
 import { BaseNavMenuComponent } from './pages/base-nav-menu/base-nav-menu.component';
5 5
 import { FormsModule } from '@angular/forms';
6 6
 import { AccueilModule } from './pages/accueil/accueil.module';
@@ -18,21 +18,19 @@ import { LayoutModule } from '@angular/cdk/layout';
18 18
 import { MatToolbarModule } from '@angular/material/toolbar';
19 19
 import { MatButtonModule } from '@angular/material/button';
20 20
 import { MatSidenavModule } from '@angular/material/sidenav';
21
-import { MatIconModule } from '@angular/material/icon';
22 21
 import { MatListModule } from '@angular/material/list';
23 22
 import { MatMenuModule } from '@angular/material/menu';
24 23
 import { EffectsModule } from '@ngrx/effects';
25 24
 import { StoreModule } from '@ngrx/store';
26 25
 import { StoreDevtoolsModule } from '@ngrx/store-devtools';
27 26
 import { UserCreateEffects } from './ngrx/users/effects.user.create';
28
-import { UserGetSearchEffects } from './ngrx/users/effects.user.get';
29
-import { UserUpdateEffects } from './ngrx/users/effects.user.update.delete';
27
+import { UserGetEffects } from './ngrx/users/effects.user.get';
28
+import { UserUpdateDeleteEffects } from './ngrx/users/effects.user.update.delete';
30 29
 import { userReducer } from './ngrx/users/users.reducer';
31 30
 import { projectReducer } from './ngrx/projects/projects.reducer';
32 31
 import { ProjectUpdateEffects } from './ngrx/projects/effects.project.update.delete';
33 32
 import { ProjectCreateEffects } from './ngrx/projects/effects.project.create';
34 33
 import { ProjectGetEffects } from './ngrx/projects/effects.project.get';
35
-import { DatePipe } from '@angular/common';
36 34
 import { companyReducer } from './ngrx/companies/companies.reducer';
37 35
 
38 36
 @NgModule({
@@ -51,7 +49,6 @@ import { companyReducer } from './ngrx/companies/companies.reducer';
51 49
     MatToolbarModule,
52 50
     MatButtonModule,
53 51
     MatSidenavModule,
54
-    MatIconModule,
55 52
     MatListModule,
56 53
     MatMenuModule,
57 54
     StoreModule.forRoot({
@@ -61,12 +58,12 @@ import { companyReducer } from './ngrx/companies/companies.reducer';
61 58
     }),
62 59
     EffectsModule.forRoot([
63 60
       UserCreateEffects,
64
-      UserGetSearchEffects,
65
-      UserUpdateEffects,
61
+      UserGetEffects,
62
+      UserUpdateDeleteEffects,
66 63
       ProjectCreateEffects,
67 64
       ProjectGetEffects,
68 65
       ProjectUpdateEffects,
69
-      CompanyGetSearchEffects,
66
+      CompanyGetEffects,
70 67
       CompanyUpdateDeleteEffects,
71 68
       CompanyCreateEffects
72 69
     ]),

+ 19
- 20
src/app/ngrx/companies/companies.actions.ts Переглянути файл

@@ -3,22 +3,6 @@ import { Action } from '@ngrx/store';
3 3
 import { Company } from 'src/app/shared/models/company/company.model';
4 4
 /** all actions related to company */
5 5
 
6
-//get all companies
7
-export class GetAllCompaniesAction implements Action {
8
-  type: CompanyActionTypes = CompanyActionTypes.GET_ALL_COMPANIES;
9
-  constructor(public payload: any) {}
10
-}
11
-
12
-export class GetAllCompaniesActionSuccess implements Action {
13
-  type: CompanyActionTypes = CompanyActionTypes.GET_ALL_COMPANIES_SUCCESS;
14
-  constructor(public payload: Company[]) {}
15
-}
16
-
17
-export class GetAllCompaniesActionError implements Action {
18
-  type: CompanyActionTypes = CompanyActionTypes.GET_ALL_COMPANIES_ERROR;
19
-  constructor(public payload: string) {}
20
-}
21
-
22 6
 //create form to create company
23 7
 export class CreateCompanyFormAddAction implements Action {
24 8
   type: CompanyActionTypes = CompanyActionTypes.CREATE_COMPANY_FORM_ADD;
@@ -52,6 +36,22 @@ export class SaveCompanyFormDataAddActionError implements Action {
52 36
   constructor(public payload: string) {}
53 37
 }
54 38
 
39
+//get all companies
40
+export class GetAllCompaniesAction implements Action {
41
+  type: CompanyActionTypes = CompanyActionTypes.GET_ALL_COMPANIES;
42
+  constructor(public payload: any) {}
43
+}
44
+
45
+export class GetAllCompaniesActionSuccess implements Action {
46
+  type: CompanyActionTypes = CompanyActionTypes.GET_ALL_COMPANIES_SUCCESS;
47
+  constructor(public payload: Company[]) {}
48
+}
49
+
50
+export class GetAllCompaniesActionError implements Action {
51
+  type: CompanyActionTypes = CompanyActionTypes.GET_ALL_COMPANIES_ERROR;
52
+  constructor(public payload: string) {}
53
+}
54
+
55 55
 //create form to update company
56 56
 export class CreateFormToUpdateCompanyAction implements Action {
57 57
   type: CompanyActionTypes = CompanyActionTypes.CREATE_COMPANY_FORM_UPDATE;
@@ -120,17 +120,16 @@ export class GetCompany_S_ProjectsError implements Action {
120 120
   constructor(public payload: string) {}
121 121
 }
122 122
 
123
-
124 123
 export type CompanyActionUnion =
125
-  | GetAllCompaniesAction
126
-  | GetAllCompaniesActionSuccess
127
-  | GetAllCompaniesActionError
128 124
   | CreateCompanyFormAddAction
129 125
   | CreateCompanyFormAddActionSuccess
130 126
   | CreateCompanyFormAddActionError
131 127
   | SaveCompanyFormDataAddAction
132 128
   | SaveCompanyFormDataAddActionSuccess
133 129
   | SaveCompanyFormDataAddActionError
130
+  | GetAllCompaniesAction
131
+  | GetAllCompaniesActionSuccess
132
+  | GetAllCompaniesActionError
134 133
   | CreateFormToUpdateCompanyAction
135 134
   | CreateFormToUpdateCompanyActionSuccess
136 135
   | CreateFormToUpdateCompanyActionError

+ 45
- 44
src/app/ngrx/companies/companies.reducer.ts Переглянути файл

@@ -19,6 +19,51 @@ export function companyReducer(state: CompanyState = companyInitialState, action
19 19
 ) : CompanyState {
20 20
 
21 21
   switch (action.type) {
22
+
23
+    //create form to add company
24
+    case CompanyActionTypes.CREATE_COMPANY_FORM_ADD:
25
+      return{
26
+        ...state,
27
+        msgState: MsgState.FORM_LOADING,
28
+      };
29
+
30
+    case CompanyActionTypes.CREATE_COMPANY_FORM_ADD_SUCCESS:
31
+      return{
32
+        ...state,
33
+        msgState: MsgState.FORM_LOADED
34
+      };
35
+    case CompanyActionTypes.CREATE_COMPANY_FORM_ADD_ERROR:
36
+      return{
37
+        ...state,
38
+        msgState: MsgState.ERR,
39
+        serverMsgError: (<CompanyActionUnion> action).payload
40
+      };
41
+
42
+    // save company with form data
43
+    case CompanyActionTypes.SAVE_COMPANY_FORM_DATA_ADD:
44
+      return{
45
+        ...state,
46
+        msgState: MsgState.ADD
47
+      };
48
+
49
+    case CompanyActionTypes.SAVE_COMPANY_FORM_DATA_ADD_SUCCESS:
50
+      let createdCompany: Company = (<CompanyActionUnion> action).payload;
51
+      let companiesListCopy3 : Company[] = [...state.companiesList];
52
+      companiesListCopy3.push(createdCompany);
53
+
54
+      return{
55
+        ...state,
56
+        msgState: MsgState.ADDED,
57
+        companiesList: companiesListCopy3
58
+      };
59
+
60
+    case CompanyActionTypes.SAVE_COMPANY_FORM_DATA_ADD_ERROR:
61
+      return{
62
+        ...state,
63
+        msgState: MsgState.ERR,
64
+        serverMsgError: (<CompanyActionUnion> action).payload
65
+      };
66
+
22 67
     // get all companies
23 68
     case CompanyActionTypes.GET_ALL_COMPANIES:
24 69
       return {
@@ -134,50 +179,6 @@ export function companyReducer(state: CompanyState = companyInitialState, action
134 179
           serverMsgError: (<CompanyActionUnion> action).payload
135 180
         };
136 181
 
137
-      //create form to add company
138
-      case CompanyActionTypes.CREATE_COMPANY_FORM_ADD:
139
-        return{
140
-          ...state,
141
-          msgState: MsgState.FORM_LOADING,
142
-        };
143
-
144
-      case CompanyActionTypes.CREATE_COMPANY_FORM_ADD_SUCCESS:
145
-        return{
146
-          ...state,
147
-          msgState: MsgState.FORM_LOADED
148
-        };
149
-      case CompanyActionTypes.CREATE_COMPANY_FORM_ADD_ERROR:
150
-        return{
151
-          ...state,
152
-          msgState: MsgState.ERR,
153
-          serverMsgError: (<CompanyActionUnion> action).payload
154
-        };
155
-
156
-      // save company with form data
157
-      case CompanyActionTypes.SAVE_COMPANY_FORM_DATA_ADD:
158
-        return{
159
-          ...state,
160
-          msgState: MsgState.ADD
161
-        };
162
-
163
-      case CompanyActionTypes.SAVE_COMPANY_FORM_DATA_ADD_SUCCESS:
164
-        let createdCompany: Company = (<CompanyActionUnion> action).payload;
165
-        let companiesListCopy3 : Company[] = [...state.companiesList];
166
-        companiesListCopy3.push(createdCompany);
167
-
168
-        return{
169
-          ...state,
170
-          msgState: MsgState.ADDED,
171
-          companiesList: companiesListCopy3
172
-        };
173
-
174
-      case CompanyActionTypes.SAVE_COMPANY_FORM_DATA_ADD_ERROR:
175
-        return{
176
-          ...state,
177
-          msgState: MsgState.ERR,
178
-          serverMsgError: (<CompanyActionUnion> action).payload
179
-        };
180
-
181 182
     default:
182 183
       return { ...state };
183 184
   }

+ 14
- 11
src/app/ngrx/companies/company.action.types.ts Переглянути файл

@@ -1,4 +1,17 @@
1 1
 export enum CompanyActionTypes {
2
+
3
+  /** List of all action types for managing companies */
4
+
5
+   //create a company form to add a project
6
+   CREATE_COMPANY_FORM_ADD = '[Company] CREATE COMPANY FORM ADD',
7
+   CREATE_COMPANY_FORM_ADD_SUCCESS = '[Company] CREATE COMPANY FORM ADD SUCCESS',
8
+   CREATE_COMPANY_FORM_ADD_ERROR = '[Company] CREATE COMPANY FORM ADD ERROR',
9
+
10
+   //save a company form data
11
+   SAVE_COMPANY_FORM_DATA_ADD = '[Company] SAVE COMPANY FORM DATA ADD',
12
+   SAVE_COMPANY_FORM_DATA_ADD_SUCCESS = '[Company] SAVE COMPANY FORM DATA ADD SUCCESS',
13
+   SAVE_COMPANY_FORM_DATA_ADD_ERROR = '[Company] SAVE COMPANY FORM DATA ADD ERROR',
14
+
2 15
   //get all companies action
3 16
   GET_ALL_COMPANIES = '[Company] GET ALL COMPANIES',
4 17
   GET_ALL_COMPANIES_SUCCESS = '[Company] GET ALL COMPANIES SUCCESS',
@@ -22,15 +35,5 @@ export enum CompanyActionTypes {
22 35
   // Get company's pprjects
23 36
   GET_COMPANY_S_PROJECTS = 'GET COMPANY\'S PROJECT',
24 37
   GET_COMPANY_S_PROJECTS_SUCCESS = 'GET COMPANY\'S PROJECT SUCCESS',
25
-  GET_COMPANY_S_PROJECTS_ERROR = 'GET COMPANY\'S PROJECT ERROR',
26
-
27
-  //create a company form to add a project
28
-  CREATE_COMPANY_FORM_ADD = '[Company] CREATE COMPANY FORM ADD',
29
-  CREATE_COMPANY_FORM_ADD_SUCCESS = '[Company] CREATE COMPANY FORM ADD SUCCESS',
30
-  CREATE_COMPANY_FORM_ADD_ERROR = '[Company] CREATE COMPANY FORM ADD ERROR',
31
-
32
-  //save a company form data
33
-  SAVE_COMPANY_FORM_DATA_ADD = '[Company] SAVE COMPANY FORM DATA ADD',
34
-  SAVE_COMPANY_FORM_DATA_ADD_SUCCESS = '[Company] SAVE COMPANY FORM DATA ADD SUCCESS',
35
-  SAVE_COMPANY_FORM_DATA_ADD_ERROR = '[Company] SAVE COMPANY FORM DATA ADD ERROR'
38
+  GET_COMPANY_S_PROJECTS_ERROR = 'GET COMPANY\'S PROJECT ERROR'
36 39
 }

+ 26
- 15
src/app/ngrx/companies/effects.company.create.ts Переглянути файл

@@ -1,6 +1,11 @@
1 1
 import { Company } from 'src/app/shared/models/company/company.model';
2 2
 import { CompanyActionTypes } from './company.action.types';
3
-import { CompanyActionUnion, CreateCompanyFormAddActionSuccess, SaveCompanyFormDataAddActionSuccess, SaveCompanyFormDataAddActionError } from './companies.actions';
3
+import {
4
+  CompanyActionUnion,
5
+  CreateCompanyFormAddActionSuccess,
6
+  SaveCompanyFormDataAddActionSuccess,
7
+  SaveCompanyFormDataAddActionError,
8
+} from './companies.actions';
4 9
 import { map, Observable, mergeMap, catchError, of } from 'rxjs';
5 10
 import { CompaniesServices } from './../../shared/services/companies.service';
6 11
 import { Actions, createEffect, ofType } from '@ngrx/effects';
@@ -15,25 +20,31 @@ export class CompanyCreateEffects {
15 20
 
16 21
   // create company form to add company
17 22
   createFormToAddCompanyEffect: Observable<CompanyActionUnion> = createEffect(
18
-    () => this.companyActions.pipe(
23
+    () =>
24
+      this.companyActions.pipe(
19 25
         ofType(CompanyActionTypes.CREATE_COMPANY_FORM_ADD),
20
-        map((action: CompanyActionUnion) =>{
21
-          return new CreateCompanyFormAddActionSuccess()
26
+        map(() => {
27
+          return new CreateCompanyFormAddActionSuccess();
22 28
         })
23 29
       )
24 30
   );
25 31
 
26 32
   // save company form data
27
-  saveCompanyFormDataAddEffect : Observable<CompanyActionUnion> = createEffect(
28
-    () => this.companyActions.pipe(
29
-      ofType(CompanyActionTypes.SAVE_COMPANY_FORM_DATA_ADD),
30
-      mergeMap( (action : CompanyActionUnion)  =>{
31
-        return this.companiesService.createCompany(action.payload).pipe(
32
-          map ( (company: Company) => new SaveCompanyFormDataAddActionSuccess(company)),
33
-          catchError( err => of(new SaveCompanyFormDataAddActionError( err.message)))
34
-        )
35
-      })
36
-    )
33
+  saveCompanyFormDataAddEffect: Observable<CompanyActionUnion> = createEffect(
34
+    () =>
35
+      this.companyActions.pipe(
36
+        ofType(CompanyActionTypes.SAVE_COMPANY_FORM_DATA_ADD),
37
+        mergeMap((action: CompanyActionUnion) => {
38
+          return this.companiesService.createCompany(action.payload).pipe(
39
+            map(
40
+              (company: Company) =>
41
+                new SaveCompanyFormDataAddActionSuccess(company)
42
+            ),
43
+            catchError((err) =>
44
+              of(new SaveCompanyFormDataAddActionError(err.message))
45
+            )
46
+          );
47
+        })
48
+      )
37 49
   );
38
-
39 50
 }

+ 1
- 1
src/app/ngrx/companies/effects.company.get.ts Переглянути файл

@@ -13,7 +13,7 @@ import { Actions, createEffect, ofType } from '@ngrx/effects';
13 13
 import { Company } from 'src/app/shared/models/company/company.model';
14 14
 
15 15
 @Injectable()
16
-export class CompanyGetSearchEffects {
16
+export class CompanyGetEffects {
17 17
   constructor(
18 18
     private companyActions: Actions,
19 19
     private companiesService: CompaniesServices

+ 49
- 29
src/app/ngrx/companies/effects.company.update.delete.ts Переглянути файл

@@ -1,5 +1,13 @@
1 1
 import { CompanyActionTypes } from './company.action.types';
2
-import { CompanyActionUnion, CreateFormToUpdateCompanyActionSuccess, CreateFormToUpdateCompanyActionError, UpdateCompanyWithFormDataActionSuccess, UpdateCompanyWithFormDataActionError, DeleteCompanyAction, DeleteCompanyActionSuccess, DeleteCompanyActionError } from './companies.actions';
2
+import {
3
+  CompanyActionUnion,
4
+  CreateFormToUpdateCompanyActionSuccess,
5
+  CreateFormToUpdateCompanyActionError,
6
+  UpdateCompanyWithFormDataActionSuccess,
7
+  UpdateCompanyWithFormDataActionError,
8
+  DeleteCompanyActionSuccess,
9
+  DeleteCompanyActionError,
10
+} from './companies.actions';
3 11
 import { Observable, mergeMap, map, catchError, of } from 'rxjs';
4 12
 import { Actions, createEffect, ofType } from '@ngrx/effects';
5 13
 import { CompaniesServices } from './../../shared/services/companies.service';
@@ -14,41 +22,53 @@ export class CompanyUpdateDeleteEffects {
14 22
   ) {}
15 23
 
16 24
   //create form to update company effect
17
-  createFormToUpdateCompanyEffect : Observable<CompanyActionUnion> = createEffect(
18
-    () => this.companyActions.pipe(
19
-      ofType(CompanyActionTypes.CREATE_COMPANY_FORM_UPDATE),
20
-      mergeMap((action: CompanyActionUnion) =>{
21
-        return this.companiesService.getCompanyById(action.payload.id).pipe(
22
-          map( (company: Company) => new CreateFormToUpdateCompanyActionSuccess(company)),
23
-          catchError(err => of(new CreateFormToUpdateCompanyActionError(err.message)))
24
-        )
25
-      })
26
-    )
27
-  );
25
+  createFormToUpdateCompanyEffect: Observable<CompanyActionUnion> =
26
+    createEffect(() =>
27
+      this.companyActions.pipe(
28
+        ofType(CompanyActionTypes.CREATE_COMPANY_FORM_UPDATE),
29
+        mergeMap((action: CompanyActionUnion) => {
30
+          return this.companiesService.getCompanyById(action.payload.id).pipe(
31
+            map(
32
+              (company: Company) =>
33
+                new CreateFormToUpdateCompanyActionSuccess(company)
34
+            ),
35
+            catchError((err) =>
36
+              of(new CreateFormToUpdateCompanyActionError(err.message))
37
+            )
38
+          );
39
+        })
40
+      )
41
+    );
28 42
 
29 43
   //update company with form data
30 44
 
31
-  updateCompanyWithFormDataEffect : Observable<CompanyActionUnion> = createEffect(
32
-    () => this.companyActions.pipe(
33
-      ofType(CompanyActionTypes.UPDATE_COMPANY_WITH_FORM_DATA),
34
-      mergeMap((action: CompanyActionUnion)=>{
35
-        return this.companiesService.updateCompany(action.payload).pipe(
36
-          map((company: Company) => new UpdateCompanyWithFormDataActionSuccess(company)),
37
-          catchError(err=> of(new UpdateCompanyWithFormDataActionError(err.message)))
38
-        )
39
-      })
40
-    )
41
-  );
45
+  updateCompanyWithFormDataEffect: Observable<CompanyActionUnion> =
46
+    createEffect(() =>
47
+      this.companyActions.pipe(
48
+        ofType(CompanyActionTypes.UPDATE_COMPANY_WITH_FORM_DATA),
49
+        mergeMap((action: CompanyActionUnion) => {
50
+          return this.companiesService.updateCompany(action.payload).pipe(
51
+            map(
52
+              (company: Company) =>
53
+                new UpdateCompanyWithFormDataActionSuccess(company)
54
+            ),
55
+            catchError((err) =>
56
+              of(new UpdateCompanyWithFormDataActionError(err.message))
57
+            )
58
+          );
59
+        })
60
+      )
61
+    );
42 62
 
43 63
   // delete a company
44
-  deleteCompany: Observable<CompanyActionUnion> = createEffect(
45
-    () => this.companyActions.pipe(
64
+  deleteCompany: Observable<CompanyActionUnion> = createEffect(() =>
65
+    this.companyActions.pipe(
46 66
       ofType(CompanyActionTypes.DELETE_COMPANY),
47
-      mergeMap((action: CompanyActionUnion)=>{
67
+      mergeMap((action: CompanyActionUnion) => {
48 68
         return this.companiesService.deleteCompany(action.payload.id).pipe(
49
-          map(()=>new DeleteCompanyActionSuccess(action.payload)),
50
-          catchError(err=> of(new DeleteCompanyActionError(err.message)))
51
-        )
69
+          map(() => new DeleteCompanyActionSuccess(action.payload)),
70
+          catchError((err) => of(new DeleteCompanyActionError(err.message)))
71
+        );
52 72
       })
53 73
     )
54 74
   );

+ 24
- 16
src/app/ngrx/projects/effects.project.create.ts Переглянути файл

@@ -1,5 +1,10 @@
1 1
 import { ProjectActionTypes } from './project.action.types';
2
-import { ProjectActionUnion, CreateProjectFormAddAction, SaveProjectFormDataActionSuccess, SaveProjectFormDataActionError, CreateProjectFormAddActionSuccess } from './projects.actions';
2
+import {
3
+  ProjectActionUnion,
4
+  SaveProjectFormDataActionSuccess,
5
+  SaveProjectFormDataActionError,
6
+  CreateProjectFormAddActionSuccess,
7
+} from './projects.actions';
3 8
 import { map, Observable, mergeMap, catchError, of } from 'rxjs';
4 9
 import { ProjectsServices } from './../../shared/services/projects.service';
5 10
 import { Actions, createEffect, ofType } from '@ngrx/effects';
@@ -8,33 +13,36 @@ import { Project } from 'src/app/shared/models/project/project.model';
8 13
 
9 14
 @Injectable()
10 15
 export class ProjectCreateEffects {
11
-
12 16
   constructor(
13 17
     private projectActions: Actions,
14 18
     private projectsService: ProjectsServices
15 19
   ) {}
16 20
 
17 21
   //create project form effect
18
-  createAddProjectFormEffect:Observable<ProjectActionUnion> = createEffect(
19
-    ()=> this.projectActions.pipe(
20
-      ofType((ProjectActionTypes.CREATE_PROJECT_FORM_ADD)),
21
-      map( (projectAction: ProjectActionUnion)=>{
22
-        return new CreateProjectFormAddActionSuccess(projectAction.payload);
23
-      })
24
-    )
22
+  createAddProjectFormEffect: Observable<ProjectActionUnion> = createEffect(
23
+    () =>
24
+      this.projectActions.pipe(
25
+        ofType(ProjectActionTypes.CREATE_PROJECT_FORM_ADD),
26
+        map((projectAction: ProjectActionUnion) => {
27
+          return new CreateProjectFormAddActionSuccess(projectAction.payload);
28
+        })
29
+      )
25 30
   );
26 31
 
27 32
   //save project form data effect
28
-  saveProjectFormDataEffect : Observable<ProjectActionUnion> = createEffect(
29
-    ()=> this.projectActions.pipe(
33
+  saveProjectFormDataEffect: Observable<ProjectActionUnion> = createEffect(() =>
34
+    this.projectActions.pipe(
30 35
       ofType(ProjectActionTypes.SAVE_PROJECT_FORM_DATA),
31
-      mergeMap( (action: ProjectActionUnion) =>{
36
+      mergeMap((action: ProjectActionUnion) => {
32 37
         return this.projectsService.createProject(action.payload).pipe(
33
-          map((project: Project)=> new SaveProjectFormDataActionSuccess(project)),
34
-          catchError(err=>of(new SaveProjectFormDataActionError(err.message)))
35
-        )
38
+          map(
39
+            (project: Project) => new SaveProjectFormDataActionSuccess(project)
40
+          ),
41
+          catchError((err) =>
42
+            of(new SaveProjectFormDataActionError(err.message))
43
+          )
44
+        );
36 45
       })
37 46
     )
38 47
   );
39
-
40 48
 }

+ 48
- 26
src/app/ngrx/projects/effects.project.get.ts Переглянути файл

@@ -1,6 +1,14 @@
1 1
 import { Project } from './../../shared/models/project/project.model';
2 2
 import { ProjectActionTypes } from './project.action.types';
3
-import { ProjectActionUnion, GetAllProjectsActionSuccess, GetAllProjectsActionError, GetProjectWithUserAssociatedActionSuccess, GetProjectWithUserAssociatedActionError, GetProjectWithCompanyAssociatedActionSuccess, GetProjectWithCompanyAssociatedActionError } from './projects.actions';
3
+import {
4
+  ProjectActionUnion,
5
+  GetAllProjectsActionSuccess,
6
+  GetAllProjectsActionError,
7
+  GetProjectWithUserAssociatedActionSuccess,
8
+  GetProjectWithUserAssociatedActionError,
9
+  GetProjectWithCompanyAssociatedActionSuccess,
10
+  GetProjectWithCompanyAssociatedActionError,
11
+} from './projects.actions';
4 12
 import { Observable, mergeMap, map, catchError, of } from 'rxjs';
5 13
 import { Actions, createEffect, ofType } from '@ngrx/effects';
6 14
 import { ProjectsServices } from './../../shared/services/projects.service';
@@ -14,13 +22,15 @@ export class ProjectGetEffects {
14 22
   ) {}
15 23
 
16 24
   //get all projects
17
-  getAllProjectsEffect: Observable<ProjectActionUnion> = createEffect(
18
-    () => this.projectActions.pipe(
25
+  getAllProjectsEffect: Observable<ProjectActionUnion> = createEffect(() =>
26
+    this.projectActions.pipe(
19 27
       ofType(ProjectActionTypes.GET_ALL_PROJECTS),
20
-      mergeMap((action: ProjectActionUnion)=>{
28
+      mergeMap((action: ProjectActionUnion) => {
21 29
         return this.projectsService.getAllProjects().pipe(
22
-          map( (projects: Project[] )=> new GetAllProjectsActionSuccess(projects)),
23
-          catchError( err => of(new GetAllProjectsActionError(err.message)))
30
+          map(
31
+            (projects: Project[]) => new GetAllProjectsActionSuccess(projects)
32
+          ),
33
+          catchError((err) => of(new GetAllProjectsActionError(err.message)))
24 34
         );
25 35
       })
26 36
     )
@@ -28,27 +38,39 @@ export class ProjectGetEffects {
28 38
 
29 39
   //get project with user associated
30 40
   getProjectWithUserAssociated: Observable<ProjectActionUnion> = createEffect(
31
-    () => this.projectActions.pipe(
32
-      ofType(ProjectActionTypes.GET_PROJECT_WITH_USER_ASSOCIATED),
33
-      mergeMap( (action: ProjectActionUnion)=>{
34
-        return this.projectsService.getProjectWithUserAsociated().pipe(
35
-          map((listAny:any)=> new GetProjectWithUserAssociatedActionSuccess(listAny)),
36
-          catchError(err => of(new GetProjectWithUserAssociatedActionError(err.message)))
37
-        )
38
-      })
39
-    )
41
+    () =>
42
+      this.projectActions.pipe(
43
+        ofType(ProjectActionTypes.GET_PROJECT_WITH_USER_ASSOCIATED),
44
+        mergeMap((action: ProjectActionUnion) => {
45
+          return this.projectsService.getProjectWithUserAsociated().pipe(
46
+            map(
47
+              (listAny: any) =>
48
+                new GetProjectWithUserAssociatedActionSuccess(listAny)
49
+            ),
50
+            catchError((err) =>
51
+              of(new GetProjectWithUserAssociatedActionError(err.message))
52
+            )
53
+          );
54
+        })
55
+      )
40 56
   );
41 57
 
42 58
   //get project with company associated
43
-  getProjectWithCompanyAssociated: Observable<ProjectActionUnion> = createEffect(
44
-    () => this.projectActions.pipe(
45
-      ofType(ProjectActionTypes.GET_PROJECT_WITH_COMPANY_ASSOCIATED),
46
-      mergeMap( (action: ProjectActionUnion)=>{
47
-        return this.projectsService.getProjectWithCompanyAssociated().pipe(
48
-          map((listAny:any)=> new GetProjectWithCompanyAssociatedActionSuccess(listAny)),
49
-          catchError(err => of(new GetProjectWithCompanyAssociatedActionError(err.message)))
50
-        )
51
-      })
52
-    )
53
-  );
59
+  getProjectWithCompanyAssociated: Observable<ProjectActionUnion> =
60
+    createEffect(() =>
61
+      this.projectActions.pipe(
62
+        ofType(ProjectActionTypes.GET_PROJECT_WITH_COMPANY_ASSOCIATED),
63
+        mergeMap((action: ProjectActionUnion) => {
64
+          return this.projectsService.getProjectWithCompanyAssociated().pipe(
65
+            map(
66
+              (listAny: any) =>
67
+                new GetProjectWithCompanyAssociatedActionSuccess(listAny)
68
+            ),
69
+            catchError((err) =>
70
+              of(new GetProjectWithCompanyAssociatedActionError(err.message))
71
+            )
72
+          );
73
+        })
74
+      )
75
+    );
54 76
 }

+ 0
- 1
src/app/ngrx/projects/effects.project.update.delete.ts Переглянути файл

@@ -7,7 +7,6 @@ import {
7 7
   UpdateProjectWithFormDataActionSuccess,
8 8
   UpdateProjectWithFormDataActionError,
9 9
   DeleteProjectActionSuccess,
10
-  DeleteProjectActionError,
11 10
 } from './projects.actions';
12 11
 import { Observable, mergeMap, map, catchError, of } from 'rxjs';
13 12
 import { Actions, createEffect, ofType } from '@ngrx/effects';

+ 6
- 6
src/app/ngrx/projects/project.action.types.ts Переглянути файл

@@ -1,12 +1,7 @@
1
-/** Project actions types */
1
+/** All project action types */
2 2
 
3 3
 export enum ProjectActionTypes{
4 4
 
5
-  //get all project action
6
-  GET_ALL_PROJECTS = '[Project] GET ALL PROJECTS',
7
-  GET_ALL_PROJECTS_SUCCESS = '[Project] GET ALL PROJECTS SUCCESS',
8
-  GET_ALL_PROJECTS_ERROR = '[Project] GET ALL PROJECTS ERROR',
9
-
10 5
   //create project form to add a project
11 6
   CREATE_PROJECT_FORM_ADD = '[Project] CREATE PROJECT FORM ADD',
12 7
   CREATE_PROJECT_FORM_ADD_SUCCESS = '[Project] CREATE PROJECT FORM ADD SUCCESS',
@@ -17,6 +12,11 @@ export enum ProjectActionTypes{
17 12
   SAVE_PROJECT_FORM_DATA_SUCCESS ='[Project] SAVE PROJECT FORM DATA SUCCESS',
18 13
   SAVE_PROJECT_FORM_DATA_ERROR ='[Project] SAVE PROJECT FORM DATA ERROR',
19 14
 
15
+  //get all project action
16
+  GET_ALL_PROJECTS = '[Project] GET ALL PROJECTS',
17
+  GET_ALL_PROJECTS_SUCCESS = '[Project] GET ALL PROJECTS SUCCESS',
18
+  GET_ALL_PROJECTS_ERROR = '[Project] GET ALL PROJECTS ERROR',
19
+
20 20
   // create form to update project
21 21
   CREATE_PROJECT_FORM_UPDATE = '[Project] CREATE PROJECT FORM UPDATE',
22 22
   CREATE_PROJECT_FORM_UPDATE_SUCCESS = '[Project] CREATE PROJECT FORM UPDATE SUCCESS',

+ 84
- 75
src/app/ngrx/projects/projects.actions.ts Переглянути файл

@@ -2,139 +2,148 @@ import { Project } from './../../shared/models/project/project.model';
2 2
 import { ProjectActionTypes } from './project.action.types';
3 3
 import { Action } from '@ngrx/store';
4 4
 
5
-/** create actions related to projects */
6
-
7
-//create get all project action
8
-export class GetAllProjectsAction implements Action {
9
-  type: ProjectActionTypes = ProjectActionTypes.GET_ALL_PROJECTS;
10
-  constructor(public payload: any) {}
11
-}
12
-
13
-export class GetAllProjectsActionSuccess implements Action {
14
-  type: ProjectActionTypes = ProjectActionTypes.GET_ALL_PROJECTS_SUCCESS;
15
-  constructor(public payload: Project[]) {}
16
-}
17
-
18
-export class GetAllProjectsActionError implements Action {
19
-  type: ProjectActionTypes = ProjectActionTypes.GET_ALL_PROJECTS_ERROR;
20
-  constructor(public payload: string) {}
21
-}
5
+/** create all actions for managing  projects */
22 6
 
23 7
 //create project form to add a project
24
-
25
-export class CreateProjectFormAddAction implements Action{
8
+export class CreateProjectFormAddAction implements Action {
26 9
   type: ProjectActionTypes = ProjectActionTypes.CREATE_PROJECT_FORM_ADD;
27
-  constructor (public payload: any){}
10
+  constructor(public payload: any) {}
28 11
 }
29 12
 
30
-export class CreateProjectFormAddActionSuccess implements Action{
13
+export class CreateProjectFormAddActionSuccess implements Action {
31 14
   type: ProjectActionTypes = ProjectActionTypes.CREATE_PROJECT_FORM_ADD_SUCCESS;
32
-  constructor (public payload: any){}
15
+  constructor(public payload: any) {}
33 16
 }
34 17
 
35
-export class CreateProjectFormAddActionError implements Action{
18
+export class CreateProjectFormAddActionError implements Action {
36 19
   type: ProjectActionTypes = ProjectActionTypes.CREATE_PROJECT_FORM_ADD_ERROR;
37
-  constructor (public payload: string){}
20
+  constructor(public payload: string) {}
38 21
 }
39 22
 
40 23
 //save project form data
41
-export class SaveProjectFormDataAction implements Action{
24
+export class SaveProjectFormDataAction implements Action {
42 25
   type: ProjectActionTypes = ProjectActionTypes.SAVE_PROJECT_FORM_DATA;
43
-  constructor (public payload: Project){}
26
+  constructor(public payload: Project) {}
44 27
 }
45
-//save project form data
46
-export class SaveProjectFormDataActionSuccess implements Action{
28
+
29
+export class SaveProjectFormDataActionSuccess implements Action {
47 30
   type: ProjectActionTypes = ProjectActionTypes.SAVE_PROJECT_FORM_DATA_SUCCESS;
48
-  constructor (public payload: Project){}
31
+  constructor(public payload: Project) {}
49 32
 }
50
-//save project form data
51
-export class SaveProjectFormDataActionError implements Action{
33
+
34
+export class SaveProjectFormDataActionError implements Action {
52 35
   type: ProjectActionTypes = ProjectActionTypes.SAVE_PROJECT_FORM_DATA_ERROR;
53
-  constructor (public payload: string){}
36
+  constructor(public payload: string) {}
37
+}
38
+
39
+// get all projects action
40
+export class GetAllProjectsAction implements Action {
41
+  type: ProjectActionTypes = ProjectActionTypes.GET_ALL_PROJECTS;
42
+  constructor(public payload: any) {}
43
+}
44
+
45
+export class GetAllProjectsActionSuccess implements Action {
46
+  type: ProjectActionTypes = ProjectActionTypes.GET_ALL_PROJECTS_SUCCESS;
47
+  constructor(public payload: Project[]) {}
48
+}
49
+
50
+export class GetAllProjectsActionError implements Action {
51
+  type: ProjectActionTypes = ProjectActionTypes.GET_ALL_PROJECTS_ERROR;
52
+  constructor(public payload: string) {}
54 53
 }
55 54
 
56 55
 //create form for project update
57
-export class CreateProjectFormUpdateAction implements Action{
56
+export class CreateProjectFormUpdateAction implements Action {
58 57
   type: ProjectActionTypes = ProjectActionTypes.CREATE_PROJECT_FORM_UPDATE;
59
-  constructor(public payload: Project){}
58
+  constructor(public payload: Project) {}
60 59
 }
61 60
 
62
-export class CreateProjectFormUpdateActionSuccess implements Action{
63
-  type: ProjectActionTypes = ProjectActionTypes.CREATE_PROJECT_FORM_UPDATE_SUCCESS;
64
-  constructor(public payload: Project){}
61
+export class CreateProjectFormUpdateActionSuccess implements Action {
62
+  type: ProjectActionTypes =
63
+    ProjectActionTypes.CREATE_PROJECT_FORM_UPDATE_SUCCESS;
64
+  constructor(public payload: Project) {}
65 65
 }
66 66
 
67
-export class CreateProjectFormUpdateActionError implements Action{
68
-  type: ProjectActionTypes = ProjectActionTypes.CREATE_PROJECT_FORM_UPDATE_ERROR;
69
-  constructor(public payload: string){}
67
+export class CreateProjectFormUpdateActionError implements Action {
68
+  type: ProjectActionTypes =
69
+    ProjectActionTypes.CREATE_PROJECT_FORM_UPDATE_ERROR;
70
+  constructor(public payload: string) {}
70 71
 }
71 72
 
72 73
 // update project with form data
73
-export class UpdateProjectWithFormDataAction implements Action{
74
+export class UpdateProjectWithFormDataAction implements Action {
74 75
   type: ProjectActionTypes = ProjectActionTypes.UPDATE_PROJECT_WITH_FORM_DATA;
75
-  constructor (public payload: Project){}
76
+  constructor(public payload: Project) {}
76 77
 }
77
-export class UpdateProjectWithFormDataActionSuccess implements Action{
78
-  type: ProjectActionTypes = ProjectActionTypes.UPDATE_PROJECT_WITH_FORM_DATA_SUCCESS;
79
-  constructor (public payload: Project){}
78
+export class UpdateProjectWithFormDataActionSuccess implements Action {
79
+  type: ProjectActionTypes =
80
+    ProjectActionTypes.UPDATE_PROJECT_WITH_FORM_DATA_SUCCESS;
81
+  constructor(public payload: Project) {}
80 82
 }
81
-export class UpdateProjectWithFormDataActionError implements Action{
82
-  type: ProjectActionTypes = ProjectActionTypes.UPDATE_PROJECT_WITH_FORM_DATA_ERROR;
83
-  constructor (public payload: string){}
83
+export class UpdateProjectWithFormDataActionError implements Action {
84
+  type: ProjectActionTypes =
85
+    ProjectActionTypes.UPDATE_PROJECT_WITH_FORM_DATA_ERROR;
86
+  constructor(public payload: string) {}
84 87
 }
85 88
 
86 89
 // delete a project
87
-export class DeleteProjectAction implements Action{
90
+export class DeleteProjectAction implements Action {
88 91
   type: ProjectActionTypes = ProjectActionTypes.DELETE_PROJECT;
89
-  constructor(public payload: Project){}
92
+  constructor(public payload: Project) {}
90 93
 }
91
-export class DeleteProjectActionSuccess implements Action{
94
+export class DeleteProjectActionSuccess implements Action {
92 95
   type: ProjectActionTypes = ProjectActionTypes.DELETE_PROJECT_SUCCESS;
93
-  constructor(public payload: Project){}
96
+  constructor(public payload: Project) {}
94 97
 }
95
-export class DeleteProjectActionError implements Action{
98
+export class DeleteProjectActionError implements Action {
96 99
   type: ProjectActionTypes = ProjectActionTypes.DELETE_PROJECT_ERROR;
97
-  constructor(public payload: string){}
100
+  constructor(public payload: string) {}
98 101
 }
99 102
 
100 103
 // get project with user associated
101
-export class GetProjectWithUserAssociatedAction implements Action{
102
-  type: ProjectActionTypes = ProjectActionTypes.GET_PROJECT_WITH_USER_ASSOCIATED;
103
-  constructor(public payload: any){}
104
+export class GetProjectWithUserAssociatedAction implements Action {
105
+  type: ProjectActionTypes =
106
+    ProjectActionTypes.GET_PROJECT_WITH_USER_ASSOCIATED;
107
+  constructor(public payload: any) {}
104 108
 }
105
-export class GetProjectWithUserAssociatedActionSuccess implements Action{
106
-  type: ProjectActionTypes = ProjectActionTypes.GET_PROJECT_WITH_USER_ASSOCIATED_SUCCESS;
107
-  constructor(public payload: any){}
109
+export class GetProjectWithUserAssociatedActionSuccess implements Action {
110
+  type: ProjectActionTypes =
111
+    ProjectActionTypes.GET_PROJECT_WITH_USER_ASSOCIATED_SUCCESS;
112
+  constructor(public payload: any) {}
108 113
 }
109
-export class GetProjectWithUserAssociatedActionError implements Action{
110
-  type: ProjectActionTypes = ProjectActionTypes.GET_PROJECT_WITH_USER_ASSOCIATED_ERROR;
111
-  constructor(public payload: string){}
114
+export class GetProjectWithUserAssociatedActionError implements Action {
115
+  type: ProjectActionTypes =
116
+    ProjectActionTypes.GET_PROJECT_WITH_USER_ASSOCIATED_ERROR;
117
+  constructor(public payload: string) {}
112 118
 }
113 119
 
114 120
 // get project with company associated
115
-export class GetProjectWithCompanyAssociatedAction implements Action{
116
-  type: ProjectActionTypes = ProjectActionTypes.GET_PROJECT_WITH_COMPANY_ASSOCIATED;
117
-  constructor(public payload: any){}
121
+export class GetProjectWithCompanyAssociatedAction implements Action {
122
+  type: ProjectActionTypes =
123
+    ProjectActionTypes.GET_PROJECT_WITH_COMPANY_ASSOCIATED;
124
+  constructor(public payload: any) {}
118 125
 }
119
-export class GetProjectWithCompanyAssociatedActionSuccess implements Action{
120
-  type: ProjectActionTypes = ProjectActionTypes.GET_PROJECT_WITH_COMPANY_ASSOCIATED_SUCCESS;
121
-  constructor(public payload: any){}
126
+export class GetProjectWithCompanyAssociatedActionSuccess implements Action {
127
+  type: ProjectActionTypes =
128
+    ProjectActionTypes.GET_PROJECT_WITH_COMPANY_ASSOCIATED_SUCCESS;
129
+  constructor(public payload: any) {}
122 130
 }
123
-export class GetProjectWithCompanyAssociatedActionError implements Action{
124
-  type: ProjectActionTypes = ProjectActionTypes.GET_PROJECT_WITH_COMPANY_ASSOCIATED_ERROR;
125
-  constructor(public payload: string){}
131
+export class GetProjectWithCompanyAssociatedActionError implements Action {
132
+  type: ProjectActionTypes =
133
+    ProjectActionTypes.GET_PROJECT_WITH_COMPANY_ASSOCIATED_ERROR;
134
+  constructor(public payload: string) {}
126 135
 }
127 136
 
128 137
 export type ProjectActionUnion =
129
-  | GetAllProjectsAction
130
-  | GetAllProjectsActionSuccess
131
-  | GetAllProjectsActionError
132 138
   | CreateProjectFormAddAction
133 139
   | CreateProjectFormAddActionSuccess
134 140
   | CreateProjectFormAddActionError
135 141
   | SaveProjectFormDataAction
136 142
   | SaveProjectFormDataActionSuccess
137 143
   | SaveProjectFormDataActionError
144
+  | GetAllProjectsAction
145
+  | GetAllProjectsActionSuccess
146
+  | GetAllProjectsActionError
138 147
   | CreateProjectFormUpdateAction
139 148
   | CreateProjectFormUpdateActionSuccess
140 149
   | CreateProjectFormUpdateActionError

+ 23
- 22
src/app/ngrx/projects/projects.reducer.ts Переглянути файл

@@ -5,7 +5,8 @@ import { ProjectState } from './project.state';
5 5
 import { ProjectActionTypes } from './project.action.types';
6 6
 import { Project } from 'src/app/shared/models/project/project.model';
7 7
 
8
-/** a reducer need first initial state and action to perform */
8
+/** a reducer is used to perform actions from component.
9
+ a reducer needs first initial state and action to perform */
9 10
 
10 11
 const projectInitState: ProjectState = {
11 12
   currentProject: null,
@@ -20,29 +21,8 @@ export function projectReducer(
20 21
 ): ProjectState {
21 22
 
22 23
   switch (action.type) {
23
-    // get all projects action reducer
24
-    case ProjectActionTypes.GET_ALL_PROJECTS:
25
-      return {
26
-        ...state,
27
-        msgState: MsgState.LOADING,
28
-      };
29
-
30
-    case ProjectActionTypes.GET_ALL_PROJECTS_SUCCESS:
31
-      return {
32
-        ...state,
33
-        msgState: MsgState.LOADED,
34
-        projectsList: (<ProjectActionUnion>action).payload,
35
-      };
36
-
37
-    case ProjectActionTypes.GET_ALL_PROJECTS_ERROR:
38
-      return {
39
-        ...state,
40
-        msgState: MsgState.ERR,
41
-        serverErrorMsg: (<ProjectActionUnion>action).payload,
42
-      };
43 24
 
44 25
     // create project form to add action reducer
45
-
46 26
     case ProjectActionTypes.CREATE_PROJECT_FORM_ADD:
47 27
       return {
48 28
         ...state,
@@ -81,6 +61,27 @@ export function projectReducer(
81 61
         projectsList: projectsListCopy1,
82 62
       };
83 63
 
64
+    // get all projects action reducer
65
+    case ProjectActionTypes.GET_ALL_PROJECTS:
66
+      return {
67
+        ...state,
68
+        msgState: MsgState.LOADING,
69
+      };
70
+
71
+    case ProjectActionTypes.GET_ALL_PROJECTS_SUCCESS:
72
+      return {
73
+        ...state,
74
+        msgState: MsgState.LOADED,
75
+        projectsList: (<ProjectActionUnion>action).payload,
76
+      };
77
+
78
+    case ProjectActionTypes.GET_ALL_PROJECTS_ERROR:
79
+      return {
80
+        ...state,
81
+        msgState: MsgState.ERR,
82
+        serverErrorMsg: (<ProjectActionUnion>action).payload,
83
+      };
84
+
84 85
     // create form to update project
85 86
     case ProjectActionTypes.CREATE_PROJECT_FORM_UPDATE:
86 87
       return {

+ 1
- 1
src/app/ngrx/users/effects.user.get.ts Переглянути файл

@@ -14,7 +14,7 @@ import { User } from 'src/app/shared/models/user/user.model';
14 14
 import { UserActionTypes } from './user.action.types';
15 15
 
16 16
 @Injectable()
17
-export class UserGetSearchEffects {
17
+export class UserGetEffects {
18 18
   constructor(
19 19
     private userActions: Actions,
20 20
     private usersService: UsersServices,

+ 1
- 2
src/app/ngrx/users/effects.user.update.delete.ts Переглянути файл

@@ -13,11 +13,10 @@ import { Injectable } from '@angular/core';
13 13
 import { Actions, createEffect, ofType } from '@ngrx/effects';
14 14
 import { User } from 'src/app/shared/models/user/user.model';
15 15
 import { UserActionTypes } from './user.action.types';
16
-import { Router } from '@angular/router';
17 16
 
18 17
 @Injectable()
19 18
 
20
-export class UserUpdateEffects {
19
+export class UserUpdateDeleteEffects {
21 20
   constructor(
22 21
     private usersService: UsersServices,
23 22
     private effectActions: Actions

+ 12
- 11
src/app/ngrx/users/user.action.types.ts Переглянути файл

@@ -1,13 +1,8 @@
1
-/**type of actions*/
1
+/**all action types for user management*/
2 2
 
3 3
 export enum UserActionTypes {
4 4
 
5
-  // action: get all users
6
-  GET_ALL_USERS = '[User] GET ALL USERS',
7
-  GET_ALL_USERS_SUCCESS = '[User] GET-ALL USERS SUCCESS',
8
-  GET_ALL_USERS_ERROR = '[User] GET ALL USERS ERROR',
9
-
10
-  // action of button: create a user form
5
+  // user form to a user
11 6
   CREATE_FORM_ADD_USER = '[User] USER FORM ADD',
12 7
   CREATE_FORM_ADD_USER_SUCCESS = '[User] USER FORM ADD SUCCESS',
13 8
   CREATE_FORM_ADD_USER_ERROR = '[User] USER FORM ADD ERROR',
@@ -17,7 +12,13 @@ export enum UserActionTypes {
17 12
   SAVE_USERFORM_ADD_SUCCESS = '[User] SAVE USER SUCCESS',
18 13
   SAVE_USERFORM_ADD_ERROR = '[User] SAVE USER ERROR',
19 14
 
20
-  // action: create form to edit a user
15
+  // get all users
16
+  GET_ALL_USERS = '[User] GET ALL USERS',
17
+  GET_ALL_USERS_SUCCESS = '[User] GET-ALL USERS SUCCESS',
18
+  GET_ALL_USERS_ERROR = '[User] GET ALL USERS ERROR',
19
+
20
+
21
+  // create form to edit a user
21 22
   CREATE_FORM_USER_EDIT = '[User] USER FORM EDIT',
22 23
   CREATE_FORM_USER_EDIT_SUCCESS = '[User] USER FORM EDIT SUCCESS',
23 24
   CREATE_FORM_USER_EDIT_ERROR = '[User] USER FORM EDIT ERROR',
@@ -28,17 +29,17 @@ export enum UserActionTypes {
28 29
   UPDATE_USER_FORM_ERROR = '[User] USER FORM UPDATE ERROR',
29 30
 
30 31
 
31
-  // action: delete a user
32
+  // delete a user
32 33
   DELETE_A_USER = '[User] DELETE A USER',
33 34
   DELETE_A_USER_SUCCESS = '[User] DELETE A USER SUCCESS',
34 35
   DELETE_A_USER_ERROR = '[User] DELETE A USER ERROR',
35 36
 
36
-  //action : load user's projects
37
+  // load user's projects
37 38
 
38 39
   GET_USER_S_PROJECTS = 'GET USER\'S PROJECTS',
39 40
   GET_USER_S_PROJECTS_SUCCESS = 'GET USER\'S PROJECTS SUCCESS',
40 41
   GET_USER_S_PROJECTS_ERROR = 'GET USER\'S PROJECTS ERROR',
41 42
 
42
-  //action:navigate to another component
43
+  // navigate to another component
43 44
   NAVIGATE_TO_USER_S_PROJECTS_COMPONENT_SUCCESS = 'NAVIGATE TO USER\'S PROJECTS COMPONENT SUCCESS'
44 45
 }

+ 43
- 46
src/app/ngrx/users/users.actions.ts Переглянути файл

@@ -2,29 +2,9 @@ import { Action } from '@ngrx/store';
2 2
 import { User } from 'src/app/shared/models/user/user.model';
3 3
 import { UserActionTypes } from './user.action.types';
4 4
 
5
-
6 5
 /**create actions related to a user*/
7 6
 
8
-//get all users actions
9
-
10
-export class GetAllUsersAction implements Action {
11
-  type: UserActionTypes = UserActionTypes.GET_ALL_USERS;
12
-
13
-  constructor(public payload: any) {}
14
-}
15
-
16
-export class GetAllUsersActionSuccess implements Action {
17
-  type: UserActionTypes = UserActionTypes.GET_ALL_USERS_SUCCESS;
18
-  constructor(public payload: User[]) {}
19
-}
20
-
21
-export class GetAllUsersActionError implements Action {
22
-  type: UserActionTypes = UserActionTypes.GET_ALL_USERS_ERROR;
23
-  constructor(public payload: string) {}
24
-}
25
-
26 7
 // Actios of creating a user form to add user
27
-
28 8
 export class CreateFormUserAddAction implements Action {
29 9
   type: UserActionTypes = UserActionTypes.CREATE_FORM_ADD_USER;
30 10
   constructor(public payload: any) {}
@@ -41,23 +21,40 @@ export class CreateFormUserAddActionError implements Action {
41 21
 }
42 22
 
43 23
 //actions of saving a user form data
44
-export class SaveUserFormAddAction implements Action{
24
+export class SaveUserFormAddAction implements Action {
45 25
   type: UserActionTypes = UserActionTypes.SAVE_USERFORM_ADD;
46
-  constructor(public payload: User){}
26
+  constructor(public payload: User) {}
47 27
 }
48 28
 
49
-export class SaveUserFormAddActionSuccess implements Action{
29
+export class SaveUserFormAddActionSuccess implements Action {
50 30
   type: UserActionTypes = UserActionTypes.SAVE_USERFORM_ADD_SUCCESS;
51
-  constructor(public payload: User){}
31
+  constructor(public payload: User) {}
52 32
 }
53 33
 
54
-export class SaveUserFormAddActionError implements Action{
34
+export class SaveUserFormAddActionError implements Action {
55 35
   type: UserActionTypes = UserActionTypes.SAVE_USERFORM_ADD_ERROR;
56
-  constructor(public payload: string){}
36
+  constructor(public payload: string) {}
57 37
 }
58 38
 
59
-// Actions of creating a user form to edit user
39
+//get all users actions
40
+export class GetAllUsersAction implements Action {
41
+  type: UserActionTypes = UserActionTypes.GET_ALL_USERS;
42
+
43
+  constructor(public payload: any) {}
44
+}
45
+
46
+export class GetAllUsersActionSuccess implements Action {
47
+  type: UserActionTypes = UserActionTypes.GET_ALL_USERS_SUCCESS;
48
+  constructor(public payload: User[]) {}
49
+}
60 50
 
51
+export class GetAllUsersActionError implements Action {
52
+  type: UserActionTypes = UserActionTypes.GET_ALL_USERS_ERROR;
53
+  constructor(public payload: string) {}
54
+}
55
+
56
+
57
+// Actions of creating a user form to edit user
61 58
 export class CreareFormUserEditAction implements Action {
62 59
   type: UserActionTypes = UserActionTypes.CREATE_FORM_USER_EDIT;
63 60
 
@@ -76,20 +73,19 @@ export class CreareFormUserEditActionActionError implements Action {
76 73
 
77 74
 // action of updating user from user data form
78 75
 
79
-export class UpdateUserFormAction implements Action{
76
+export class UpdateUserFormAction implements Action {
80 77
   type: UserActionTypes = UserActionTypes.UPDATE_USER_FORM;
81
-  constructor(public payload: User){}
78
+  constructor(public payload: User) {}
82 79
 }
83 80
 
84
-export class UpdateUserFormActionSuccess implements Action{
81
+export class UpdateUserFormActionSuccess implements Action {
85 82
   type: UserActionTypes = UserActionTypes.UPDATE_USER_FORM_SUCCESS;
86
-  constructor(public payload: User){}
83
+  constructor(public payload: User) {}
87 84
 }
88 85
 
89
-export class UpdateUserFormActionError implements Action{
90
-
86
+export class UpdateUserFormActionError implements Action {
91 87
   type: UserActionTypes = UserActionTypes.UPDATE_USER_FORM_ERROR;
92
-  constructor(public payload: string){}
88
+  constructor(public payload: string) {}
93 89
 }
94 90
 
95 91
 // Actions of deleting a user
@@ -110,37 +106,38 @@ export class DeleteUserActionError implements Action {
110 106
 }
111 107
 
112 108
 //Action of loading user's projects
113
-export class GetUser_S_Projects implements Action{
109
+export class GetUser_S_Projects implements Action {
114 110
   type: UserActionTypes = UserActionTypes.GET_USER_S_PROJECTS;
115
-  constructor(public payload: any){}
111
+  constructor(public payload: any) {}
116 112
 }
117 113
 
118
-export class GetUser_S_ProjectsSuccess implements Action{
114
+export class GetUser_S_ProjectsSuccess implements Action {
119 115
   type: UserActionTypes = UserActionTypes.GET_USER_S_PROJECTS_SUCCESS;
120
-  constructor(public payload: any){}
116
+  constructor(public payload: any) {}
121 117
 }
122 118
 
123
-export class GetUser_S_ProjectsError implements Action{
119
+export class GetUser_S_ProjectsError implements Action {
124 120
   type: UserActionTypes = UserActionTypes.GET_USER_S_PROJECTS_ERROR;
125
-  constructor(public payload: string){}
121
+  constructor(public payload: string) {}
126 122
 }
127 123
 
128 124
 //action of navigating to another component
129
-export class NavigateActionSuccess implements Action{
130
-  type: UserActionTypes = UserActionTypes.NAVIGATE_TO_USER_S_PROJECTS_COMPONENT_SUCCESS
131
-  constructor(public payload: any){}
125
+export class NavigateActionSuccess implements Action {
126
+  type: UserActionTypes =
127
+    UserActionTypes.NAVIGATE_TO_USER_S_PROJECTS_COMPONENT_SUCCESS;
128
+  constructor(public payload: any) {}
132 129
 }
133 130
 
134 131
 export type UserActionUnion =
135
-  | GetAllUsersAction
136
-  | GetAllUsersActionSuccess
137
-  | GetAllUsersActionError
138 132
   | CreateFormUserAddAction
139 133
   | CreateFormUserAddActionSuccess
140 134
   | CreateFormUserAddActionError
141 135
   | SaveUserFormAddAction
142 136
   | SaveUserFormAddActionSuccess
143 137
   | SaveUserFormAddActionError
138
+  | GetAllUsersAction
139
+  | GetAllUsersActionSuccess
140
+  | GetAllUsersActionError
144 141
   | CreareFormUserEditAction
145 142
   | CreareFormUserEditActionSuccess
146 143
   | CreareFormUserEditActionActionError

+ 18
- 19
src/app/ngrx/users/users.reducer.ts Переглянути файл

@@ -21,26 +21,7 @@ export function userReducer(
21 21
   action: Action
22 22
 ): UserState {
23 23
 
24
-
25 24
   switch (action.type) {
26
-    // get all users actions
27
-    case UserActionTypes.GET_ALL_USERS:
28
-      return { ...state, msgState: MsgState.LOADING };
29
-
30
-    case UserActionTypes.GET_ALL_USERS_SUCCESS:
31
-      return {
32
-        ...state,
33
-        msgState: MsgState.LOADED,
34
-        usersList: (<UserActionUnion>action).payload,
35
-      };
36
-
37
-    case UserActionTypes.GET_ALL_USERS_ERROR:
38
-      return {
39
-        ...state,
40
-        msgState: MsgState.ERR,
41
-        serverMsgError: (<UserActionUnion>action).payload
42
-      };
43
-
44 25
 
45 26
     // create a user form action to add a suer
46 27
     case UserActionTypes.CREATE_FORM_ADD_USER:
@@ -87,6 +68,24 @@ export function userReducer(
87 68
         serverMsgError: (<UserActionUnion>action).payload
88 69
       };
89 70
 
71
+    // get all users actions
72
+    case UserActionTypes.GET_ALL_USERS:
73
+      return { ...state, msgState: MsgState.LOADING };
74
+
75
+    case UserActionTypes.GET_ALL_USERS_SUCCESS:
76
+      return {
77
+        ...state,
78
+        msgState: MsgState.LOADED,
79
+        usersList: (<UserActionUnion>action).payload,
80
+      };
81
+
82
+    case UserActionTypes.GET_ALL_USERS_ERROR:
83
+      return {
84
+        ...state,
85
+        msgState: MsgState.ERR,
86
+        serverMsgError: (<UserActionUnion>action).payload
87
+      };
88
+
90 89
     // create a edit user form actions
91 90
     case UserActionTypes.CREATE_FORM_USER_EDIT:
92 91
       return {

+ 3
- 2
src/app/pages/accueil/accueil/accueil.component.html Переглянути файл

@@ -4,9 +4,10 @@
4 4
 
5 5
     <div>
6 6
       <div class="card-body">
7
-        <h4 class="card-title">Welcome to Natan</h4>
7
+        <h4 class="card-title p-2">Welcome to Natan</h4>
8 8
         <p class="card-text p-2">NATAN est palindrome</p>
9
-        <p class="card-text">Ce qui fait de NATAN le meilleur</p>
9
+        <p class="card-text p-2">Ce qui fait de NATAN le meilleur</p>
10
+        <p class="card-text">For all collaborators, NATAN wishes you the best</p>
10 11
       </div>
11 12
     </div>
12 13
 

+ 0
- 8
src/app/pages/base-nav-menu/base-nav-menu.component.html Переглянути файл

@@ -17,14 +17,6 @@
17 17
 
18 18
   <mat-sidenav-content>
19 19
     <mat-toolbar>
20
-      <button
21
-      type="button"
22
-      aria-label="Toggle sidenav"
23
-      mat-icon-button
24
-      (click)="drawer.toggle()"
25
-      *ngIf="isHandset$ | async">
26
-      <mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
27
-    </button>
28 20
       <span>Users, Projects and Companies Management</span>
29 21
     </mat-toolbar>
30 22
     <!-- Add Content Here -->

+ 1
- 13
src/app/pages/base-nav-menu/base-nav-menu.component.ts Переглянути файл

@@ -20,17 +20,5 @@ export class BaseNavMenuComponent {
20 20
       shareReplay()
21 21
     );
22 22
 
23
-  constructor(
24
-    private breakpointObserver: BreakpointObserver,
25
-    private router: Router,
26
-    private store: Store<{ userReducerKey: UserState }>,
27
-  ) {}
28
-
29
-  onUserCreate(): void {
30
-    this.router.navigateByUrl('/user-create');
31
-  }
32
-
33
-  onUsersGetAll(){
34
-    this.store.dispatch(new GetAllUsersAction({}));
35
-  }
23
+  constructor(private breakpointObserver: BreakpointObserver) {}
36 24
 }

+ 1
- 1
src/app/pages/companies-manager/companies-management/company-nav-bar/company-nav-bar.component.ts Переглянути файл

@@ -1,7 +1,7 @@
1 1
 import { Router } from '@angular/router';
2 2
 import { GetAllCompaniesAction } from './../../../../ngrx/companies/companies.actions';
3 3
 import { CompanyState } from './../../../../ngrx/companies/company.state';
4
-import { Component, OnInit } from '@angular/core';
4
+import { Component } from '@angular/core';
5 5
 import { Store } from '@ngrx/store';
6 6
 
7 7
 @Component({

+ 4
- 2
src/app/pages/companies-manager/companies-management/company-s-projects/company-s-projects.component.ts Переглянути файл

@@ -1,4 +1,4 @@
1
-import { Observable } from 'rxjs';
1
+import { map, Observable } from 'rxjs';
2 2
 import { MsgState } from './../../../../ngrx/msg.state';
3 3
 import { GetCompany_S_Projects } from './../../../../ngrx/companies/companies.actions';
4 4
 import { CompanyState } from './../../../../ngrx/companies/company.state';
@@ -21,7 +21,9 @@ export class CompanySProjectsComponent implements OnInit {
21 21
   ngOnInit(): void {
22 22
 
23 23
     this.store.dispatch(new GetCompany_S_Projects({}));
24
-    this.companyState$ = this.store.select('companyReducerKey');
24
+    this.companyState$ = this.store.pipe(
25
+      map( state => state.companyReducerKey)
26
+    )
25 27
   }
26 28
 
27 29
 }

+ 0
- 1
src/app/pages/projects-manager/projects-management/project-with-company-associated/project-with-company-associated.component.ts Переглянути файл

@@ -19,7 +19,6 @@ export class ProjectWithCompanyAssociatedComponent implements OnInit {
19 19
 
20 20
   ngOnInit(): void {
21 21
 
22
-
23 22
     this.store.dispatch(new GetProjectWithCompanyAssociatedAction({}));
24 23
     this.projectState$= this.store.select('projectReducerKey');
25 24
   }

+ 2
- 7
src/app/pages/projects-manager/projects-management/project-with-user-associated/project-with-user-associated-list/project-with-user-associated-list.component.ts Переглянути файл

@@ -1,16 +1,11 @@
1
-import { Component, Input, OnInit } from '@angular/core';
1
+import { Component, Input } from '@angular/core';
2 2
 
3 3
 @Component({
4 4
   selector: 'app-project-with-user-associated-list',
5 5
   templateUrl: './project-with-user-associated-list.component.html',
6 6
   styleUrls: ['./project-with-user-associated-list.component.css']
7 7
 })
8
-export class ProjectWithUserAssociatedListComponent implements OnInit {
8
+export class ProjectWithUserAssociatedListComponent {
9 9
 
10
-  constructor() { }
11 10
   @Input() inputProjectsListWithUserAssociated!: any;
12
-
13
-  ngOnInit(): void {
14
-  }
15
-
16 11
 }

+ 0
- 1
src/app/pages/users-manager/users-management/user-create/user-create.component.ts Переглянути файл

@@ -1,5 +1,4 @@
1 1
 import { Router } from '@angular/router';
2
-import { GetAllUsersAction } from 'src/app/ngrx/users/users.actions';
3 2
 import { DatePipe } from '@angular/common';
4 3
 import { UsersServices } from '../../../../shared/services/users.service';
5 4
 import { User } from '../../../../shared/models/user/user.model';

+ 1
- 1
src/app/pages/users-manager/users-management/user-s-projects/user-s-projects.component.ts Переглянути файл

@@ -1,6 +1,6 @@
1 1
 import { MsgState } from './../../../../ngrx/msg.state';
2 2
 import { Observable } from 'rxjs';
3
-import { GetUser_S_Projects, UserActionUnion } from './../../../../ngrx/users/users.actions';
3
+import { GetUser_S_Projects } from './../../../../ngrx/users/users.actions';
4 4
 import { UserState } from './../../../../ngrx/users/user.state';
5 5
 import { Component, OnInit } from '@angular/core';
6 6
 import { Store } from '@ngrx/store';

+ 1
- 2
src/app/pages/users-manager/users-management/users-management.component.ts Переглянути файл

@@ -24,8 +24,7 @@ export class UsersManagementComponent implements OnInit {
24 24
   constructor(private store: Store<{ userReducerKey: UserState }>) {}
25 25
 
26 26
   ngOnInit(): void {
27
-   // this.userState$ = this.store.select('userReducerKey');
28
-    //or
27
+
29 28
     this.userState$ = this.store.pipe(
30 29
       map( (userState) => userState.userReducerKey),
31 30
     )

+ 1
- 0
src/app/shared/models/company/company.model.ts Переглянути файл

@@ -1,5 +1,6 @@
1 1
 import { DatePipe } from '@angular/common';
2 2
 import { CompanyType } from './company.type';
3
+
3 4
 export class Company{
4 5
   id!: number;
5 6
   companyName!: string;

+ 1
- 1
src/app/shared/services/projects.service.ts Переглянути файл

@@ -1,6 +1,6 @@
1 1
 import { HttpClient, HttpErrorResponse } from '@angular/common/http';
2 2
 import { Injectable, OnInit } from '@angular/core';
3
-import { catchError, Observable, retry, throwError } from 'rxjs';
3
+import { catchError, Observable, throwError } from 'rxjs';
4 4
 import { environment } from 'src/environments/environment';
5 5
 import { Project } from '../models/project/project.model';
6 6
 

Powered by TurnKey Linux.