diff --git a/src/app/modules/users/components/users-list/users-list.component.html b/src/app/modules/users/components/users-list/users-list.component.html
index 0f88995de..498d5e0dd 100644
--- a/src/app/modules/users/components/users-list/users-list.component.html
+++ b/src/app/modules/users/components/users-list/users-list.component.html
@@ -10,7 +10,7 @@
User Email |
Names |
- Roles |
+ {{ isUserGroupsToggleOn ? 'Groups' : 'Roles' }} |
@@ -19,20 +19,35 @@
{{ user.email }} |
{{ user.name }} |
-
+
admin
test
+
+
+
+ admin
+
+ test
+
|
diff --git a/src/app/modules/users/components/users-list/users-list.component.spec.ts b/src/app/modules/users/components/users-list/users-list.component.spec.ts
index 53441835c..efdc37085 100644
--- a/src/app/modules/users/components/users-list/users-list.component.spec.ts
+++ b/src/app/modules/users/components/users-list/users-list.component.spec.ts
@@ -1,17 +1,34 @@
+import { FeatureManagerService } from 'src/app/modules/shared/feature-toggles/feature-toggle-manager.service';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
-
import { NgxPaginationModule } from 'ngx-pagination';
import { UsersListComponent } from './users-list.component';
-import { UserActionTypes, UserState, LoadUsers, GrantRoleUser, RevokeRoleUser } from '../../store';
+import {
+ UserActionTypes,
+ UserState,
+ LoadUsers,
+ GrantRoleUser,
+ RevokeRoleUser,
+ AddUserToGroup,
+ RemoveUserFromGroup,
+} from '../../store';
+import { User } from '../../../user/models/user';
import { ActionsSubject } from '@ngrx/store';
import { DataTablesModule } from 'angular-datatables';
+import { Observable, of } from 'rxjs';
+import { FeatureToggleProvider } from 'src/app/modules/shared/feature-toggles/feature-toggle-provider.service';
+import { AppConfigurationClient } from '@azure/app-configuration';
+import { FeatureFilterProvider } from '../../../shared/feature-toggles/filters/feature-filter-provider.service';
+import { AzureAdB2CService } from '../../../login/services/azure.ad.b2c.service';
describe('UsersListComponent', () => {
let component: UsersListComponent;
let fixture: ComponentFixture;
let store: MockStore;
const actionSub: ActionsSubject = new ActionsSubject();
+ const fakeAppConfigurationConnectionString = 'Endpoint=http://fake.foo;Id=fake.id;Secret=fake.secret';
+ let service: FeatureManagerService;
+ let fakeFeatureToggleProvider;
const state: UserState = {
data: [
@@ -19,6 +36,7 @@ describe('UsersListComponent', () => {
name: 'name',
email: 'email',
roles: ['admin', 'test'],
+ groups: ['time-tracker-admin', 'time-tracker-tester'],
id: 'id',
tenant_id: 'tenant id',
deleted: 'delete',
@@ -30,10 +48,20 @@ describe('UsersListComponent', () => {
beforeEach(
waitForAsync(() => {
+ fakeFeatureToggleProvider = new FeatureToggleProvider(
+ new AppConfigurationClient(fakeAppConfigurationConnectionString),
+ new FeatureFilterProvider(new AzureAdB2CService())
+ );
+ service = new FeatureManagerService(fakeFeatureToggleProvider);
+
TestBed.configureTestingModule({
imports: [NgxPaginationModule, DataTablesModule],
declarations: [UsersListComponent],
- providers: [provideMockStore({ initialState: state }), { provide: ActionsSubject, useValue: actionSub }],
+ providers: [
+ provideMockStore({ initialState: state }),
+ { provide: ActionsSubject, useValue: actionSub },
+ { provide: FeatureManagerService, useValue: service }
+ ],
}).compileComponents();
})
);
@@ -91,6 +119,27 @@ describe('UsersListComponent', () => {
});
});
+ const actionGroupParams = [
+ { actionType: UserActionTypes.ADD_USER_TO_GROUP_SUCCESS },
+ { actionType: UserActionTypes.REMOVE_USER_FROM_GROUP_SUCCESS },
+ ];
+
+ actionGroupParams.map((param) => {
+ it(`When action ${param.actionType} is dispatched should triggered load Users action`, () => {
+ spyOn(store, 'dispatch');
+
+ const actionSubject = TestBed.inject(ActionsSubject) as ActionsSubject;
+ const action = {
+ type: param.actionType,
+ payload: state.data,
+ };
+
+ actionSubject.next(action);
+
+ expect(store.dispatch).toHaveBeenCalledWith(new LoadUsers());
+ });
+ });
+
const grantRoleTypes = [
{ roleId: 'admin', roleValue: 'time-tracker-admin' },
{ roleId: 'test', roleValue: 'time-tracker-tester' },
@@ -111,6 +160,32 @@ describe('UsersListComponent', () => {
});
});
+ const AddGroupTypes = [
+ { groupName: 'time-tracker-admin' },
+ { groupName: 'time-tracker-tester' }
+ ];
+
+ AddGroupTypes.map((param) => {
+ it(`When user switchGroup to ${param.groupName} and doesn't belong to any group, should add ${param.groupName} group to user`, () => {
+ const groupName = param.groupName;
+ const user = {
+ name: 'name',
+ email: 'email',
+ roles: [],
+ groups: [],
+ id: 'id',
+ tenant_id: 'tenant id',
+ deleted: 'delete',
+ } ;
+
+ spyOn(store, 'dispatch');
+
+ component.switchGroup(groupName, user);
+
+ expect(store.dispatch).toHaveBeenCalledWith(new AddUserToGroup(user.id, groupName));
+ });
+ });
+
const revokeRoleTypes = [
{ roleId: 'admin', roleValue: 'time-tracker-admin', userRoles: ['time-tracker-admin'] },
{ roleId: 'test', roleValue: 'time-tracker-tester', userRoles: ['time-tracker-tester'] },
@@ -131,6 +206,33 @@ describe('UsersListComponent', () => {
});
});
+ const removeGroupTypes = [
+ { groupName: 'time-tracker-admin', userGroups: ['time-tracker-admin'] },
+ { groupName: 'time-tracker-tester', userGroups: ['time-tracker-tester'] },
+ ];
+
+ removeGroupTypes.map((param) => {
+ it(`When user switchGroup to ${param.groupName} and belongs to group, should remove ${param.groupName} group from user`, () => {
+ const groupName = param.groupName;
+ const user = {
+ name: 'name',
+ email: 'email',
+ roles: [],
+ groups: param.userGroups,
+ id: 'id',
+ tenant_id: 'tenant id',
+ deleted: 'delete',
+ } ;
+
+
+ spyOn(store, 'dispatch');
+
+ component.switchGroup(groupName, user);
+
+ expect(store.dispatch).toHaveBeenCalledWith(new RemoveUserFromGroup(user.id, groupName));
+ });
+ });
+
it('on success load users, the data of roles should be an array', () => {
const actionSubject = TestBed.inject(ActionsSubject) as ActionsSubject;
const action = {
@@ -145,6 +247,20 @@ describe('UsersListComponent', () => {
});
});
+ it('on success load users, the data of groups should be an array', () => {
+ const actionSubject = TestBed.inject(ActionsSubject) as ActionsSubject;
+ const action = {
+ type: UserActionTypes.LOAD_USERS_SUCCESS,
+ payload: state.data,
+ };
+
+ actionSubject.next(action);
+
+ component.users.map((user) => {
+ expect(user.groups).toEqual(['time-tracker-admin', 'time-tracker-tester']);
+ });
+ });
+
it('on success load users, the datatable should be reloaded', async () => {
const actionSubject = TestBed.inject(ActionsSubject);
const action = {
@@ -158,6 +274,27 @@ describe('UsersListComponent', () => {
expect(component.dtElement.dtInstance.then).toHaveBeenCalled();
});
+ it('When Component is created, should call the feature toggle method', () => {
+ spyOn(component, 'isFeatureToggleActivated').and.returnValue(of(true));
+
+ component.ngOnInit();
+
+ expect(component.isFeatureToggleActivated).toHaveBeenCalled();
+ expect(component.isUserGroupsToggleOn).toBe(true);
+ });
+
+ const toggleValues = [true, false];
+ toggleValues.map((toggleValue) => {
+ it(`when FeatureToggle is ${toggleValue} should return ${toggleValue}`, () => {
+ spyOn(service, 'isToggleEnabledForUser').and.returnValue(of(toggleValue));
+
+ const isFeatureToggleActivated: Observable = component.isFeatureToggleActivated();
+
+ expect(service.isToggleEnabledForUser).toHaveBeenCalled();
+ isFeatureToggleActivated.subscribe((value) => expect(value).toEqual(toggleValue));
+ });
+ });
+
afterEach(() => {
component.dtTrigger.unsubscribe();
component.loadUsersSubscription.unsubscribe();
diff --git a/src/app/modules/users/components/users-list/users-list.component.ts b/src/app/modules/users/components/users-list/users-list.component.ts
index 864916486..fe57bdcc7 100644
--- a/src/app/modules/users/components/users-list/users-list.component.ts
+++ b/src/app/modules/users/components/users-list/users-list.component.ts
@@ -1,11 +1,18 @@
import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
-import { ActionsSubject, select, Store } from '@ngrx/store';
+import { ActionsSubject, select, Store, Action } from '@ngrx/store';
import { DataTableDirective } from 'angular-datatables';
-import { Observable, Subject, Subscription} from 'rxjs';
+import { Observable, Subject, Subscription } from 'rxjs';
import { delay, filter, map } from 'rxjs/operators';
import { FeatureManagerService } from 'src/app/modules/shared/feature-toggles/feature-toggle-manager.service';
import { User } from '../../models/users';
-import { GrantRoleUser, LoadUsers, RevokeRoleUser, UserActionTypes, AddUserToGroup, RemoveUserToGroup} from '../../store/user.actions';
+import {
+ GrantRoleUser,
+ LoadUsers,
+ RevokeRoleUser,
+ UserActionTypes,
+ AddUserToGroup,
+ RemoveUserFromGroup,
+} from '../../store/user.actions';
import { getIsLoading } from '../../store/user.selectors';
@Component({
@@ -24,8 +31,7 @@ export class UsersListComponent implements OnInit, OnDestroy, AfterViewInit {
dtOptions: any = {};
switchGroupsSubscription: Subscription;
isEnableToggleSubscription: Subscription;
- isUserRoleToggleOn;
- flakyToggle: true;
+ isUserGroupsToggleOn: boolean;
constructor(
private store: Store,
@@ -45,21 +51,12 @@ export class UsersListComponent implements OnInit, OnDestroy, AfterViewInit {
});
this.isEnableToggleSubscription = this.isFeatureToggleActivated().subscribe((flag) => {
- this.isUserRoleToggleOn = flag;
- console.log('in subscription', this.isUserRoleToggleOn);
+ this.isUserGroupsToggleOn = flag;
});
- this.switchGroupsSubscription = this.actionsSubject$
- .pipe(
- filter(
- (action: any) =>
- action.type === UserActionTypes.ADD_USER_TO_GROUP_SUCCESS ||
- action.type === UserActionTypes.REMOVE_USER_TO_GROUP_SUCCESS
- )
- )
+ this.switchGroupsSubscription = this.filterUserGroup()
.subscribe((action) => {
this.store.dispatch(new LoadUsers());
- this.rerenderDataTable();
});
this.switchRoleSubscription = this.actionsSubject$
@@ -102,17 +99,27 @@ export class UsersListComponent implements OnInit, OnDestroy, AfterViewInit {
: this.store.dispatch(new GrantRoleUser(userId, roleId));
}
- isFeatureToggleActivated() {
- return this.featureManagerService.isToggleEnabledForUser('ui-list-technologies').pipe(
- map((enabled) => {
- return enabled === true ? true : false;
- })
+ switchGroup(groupName: string, user: User): void {
+ this.store.dispatch(
+ user.groups.includes(groupName)
+ ? new RemoveUserFromGroup(user.id, groupName)
+ : new AddUserToGroup(user.id, groupName)
);
}
- switchGroups(userId: string, userGroups: string[], groupname: string, groupValue: string) {
- userGroups.includes(groupValue)
- ? this.store.dispatch(new RemoveUserToGroup(userId, groupname))
- : this.store.dispatch(new AddUserToGroup(userId, groupname));
+ isFeatureToggleActivated(): Observable {
+ return this.featureManagerService.isToggleEnabledForUser('switch-group')
+ .pipe(map((enabled: boolean) => enabled));
+ }
+
+ filterUserGroup(): Observable {
+ return this.actionsSubject$
+ .pipe(
+ filter(
+ (action: Action) =>
+ action.type === UserActionTypes.ADD_USER_TO_GROUP_SUCCESS ||
+ action.type === UserActionTypes.REMOVE_USER_FROM_GROUP_SUCCESS
+ )
+ );
}
}
diff --git a/src/app/modules/users/services/users.service.spec.ts b/src/app/modules/users/services/users.service.spec.ts
index 9d421a6c1..d8d50dbd9 100644
--- a/src/app/modules/users/services/users.service.spec.ts
+++ b/src/app/modules/users/services/users.service.spec.ts
@@ -52,58 +52,22 @@ describe('UsersService', () => {
expect(grantRoleRequest.request.method).toBe('POST');
});
-<<<<<<< HEAD
-<<<<<<< HEAD
it('add user to group', () => {
-=======
- it('add group to a User', () => {
->>>>>>> feat: TT-188 add & remove groups to user service
-=======
- it('add user to group', () => {
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
const userId = 'userId';
const group = 'admin';
const addGroupURL = `${service.baseUrl}/${userId}/groups/add`;
-<<<<<<< HEAD
-<<<<<<< HEAD
- service.addUserToGroup(userId, group).subscribe();
-=======
- service.addGroupToUser(userId, group).subscribe();
->>>>>>> feat: TT-188 add & remove groups to user service
-=======
service.addUserToGroup(userId, group).subscribe();
->>>>>>> refactor: TT-188 refactor some names
expect(httpMock.expectOne(addGroupURL).request.method).toBe('POST');
});
-<<<<<<< HEAD
-<<<<<<< HEAD
it('remove user from group', () => {
-=======
- it('remove group to a User', () => {
->>>>>>> feat: TT-188 add & remove groups to user service
-=======
- it('remove user from group', () => {
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
const userId = 'userId';
const group = 'admin';
const removeGroupURL = `${service.baseUrl}/${userId}/groups/remove`;
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
- service.removeUserFromGroup(userId, group).subscribe();
-=======
- service.removeGroupToUser(userId, group).subscribe();
->>>>>>> feat: TT-188 add & remove groups to user service
-=======
- service.removeUserToGroup(userId, group).subscribe();
->>>>>>> refactor: TT-188 refactor some names
-=======
service.removeUserFromGroup(userId, group).subscribe();
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
expect(httpMock.expectOne(removeGroupURL).request.method).toBe('POST');
});
diff --git a/src/app/modules/users/services/users.service.ts b/src/app/modules/users/services/users.service.ts
index a3edd5c83..40e97fec3 100644
--- a/src/app/modules/users/services/users.service.ts
+++ b/src/app/modules/users/services/users.service.ts
@@ -25,33 +25,13 @@ export class UsersService {
return this.http.post(url, null);
}
-<<<<<<< HEAD
-<<<<<<< HEAD
addUserToGroup(userId: string, group: string): Observable {
-=======
- addGroupToUser(userId: string, group: string): Observable {
->>>>>>> feat: TT-188 add & remove groups to user service
-=======
- addUserToGroup(userId: string, group: string): Observable {
->>>>>>> refactor: TT-188 refactor some names
return this.http.post(`${this.baseUrl}/${userId}/groups/add`, {
group_name: group,
});
}
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
- removeUserFromGroup(userId: string, group: string): Observable {
-=======
- removeGroupToUser(userId: string, group: string): Observable {
->>>>>>> feat: TT-188 add & remove groups to user service
-=======
- removeUserToGroup(userId: string, group: string): Observable {
->>>>>>> refactor: TT-188 refactor some names
-=======
removeUserFromGroup(userId: string, group: string): Observable {
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
return this.http.post(`${this.baseUrl}/${userId}/groups/remove`, {
group_name: group,
});
diff --git a/src/app/modules/users/store/user.actions.spec.ts b/src/app/modules/users/store/user.actions.spec.ts
index 05f7ccb59..ae1bb933f 100644
--- a/src/app/modules/users/store/user.actions.spec.ts
+++ b/src/app/modules/users/store/user.actions.spec.ts
@@ -53,8 +53,6 @@ describe('UserActions', () => {
expect(action.type).toEqual(actions.UserActionTypes.REVOKE_USER_ROLE_FAIL);
});
-<<<<<<< HEAD
-<<<<<<< HEAD
it('AddUserToGroup type is UserActionTypes.ADD_USER_TO_GROUP', () => {
const userId = 'userId';
const groupName = 'groupName';
@@ -77,7 +75,6 @@ describe('UserActions', () => {
});
it('RemoveUserFromGroup type is UserActionTypes.REMOVE_USER_FROM_GROUP', () => {
-<<<<<<< HEAD
const userId = 'userId';
const groupName = 'groupName';
const action = new actions.RemoveUserFromGroup(userId, groupName);
@@ -96,60 +93,5 @@ describe('UserActions', () => {
const action = new actions.RemoveUserFromGroupFail('error');
expect(action.type).toEqual(actions.UserActionTypes.REMOVE_USER_FROM_GROUP_FAIL);
-=======
- it('AddGroupToUser type is UserActionTypes.ADD_GROUP_TO_USER', () => {
-=======
- it('AddUserToGroup type is UserActionTypes.ADD_USER_TO_GROUP', () => {
->>>>>>> refactor: TT-188 refactor some names
- const userId = 'userId';
- const groupName = 'groupName';
- const action = new actions.AddUserToGroup(userId, groupName);
-
- expect(action.type).toEqual(actions.UserActionTypes.ADD_USER_TO_GROUP);
- });
-
- it('AddUserToGroupSuccess type is UserActionTypes.ADD_USER_TO_GROUP_SUCCESS', () => {
- const payload: User = { id: 'id', email: 'email', name: 'name' };
- const action = new actions.AddUserToGroupSuccess(payload);
-
- expect(action.type).toEqual(actions.UserActionTypes.ADD_USER_TO_GROUP_SUCCESS);
- });
-
- it('AddUserToGroupFail type is UserActionTypes.ADD_USER_TO_GROUP_FAIL', () => {
- const action = new actions.AddUserToGroupFail('error');
-
- expect(action.type).toEqual(actions.UserActionTypes.ADD_USER_TO_GROUP_FAIL);
- });
-
- it('RemoveUserToGroup type is UserActionTypes.REMOVE_USER_TO_GROUP', () => {
-=======
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
- const userId = 'userId';
- const groupName = 'groupName';
- const action = new actions.RemoveUserFromGroup(userId, groupName);
-
- expect(action.type).toEqual(actions.UserActionTypes.REMOVE_USER_FROM_GROUP);
- });
-
- it('RemoveUserFromGroupSuccess type is UserActionTypes.REMOVE_USER_FROM_GROUP_SUCCESS', () => {
- const payload: User = { id: 'id', email: 'email', name: 'name' };
- const action = new actions.RemoveUserFromGroupSuccess(payload);
-
- expect(action.type).toEqual(actions.UserActionTypes.REMOVE_USER_FROM_GROUP_SUCCESS);
- });
-
- it('RemoveUserFromGroupFail type is UserActionTypes.REMOVE_USER_FROM_GROUP_FAIL', () => {
- const action = new actions.RemoveUserFromGroupFail('error');
-
-<<<<<<< HEAD
-<<<<<<< HEAD
- expect(action.type).toEqual(actions.UserActionTypes.REMOVE_GROUP_TO_USER_FAIL);
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- expect(action.type).toEqual(actions.UserActionTypes.REMOVE_USER_TO_GROUP_FAIL);
->>>>>>> refactor: TT-188 refactor some names
-=======
- expect(action.type).toEqual(actions.UserActionTypes.REMOVE_USER_FROM_GROUP_FAIL);
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
});
});
diff --git a/src/app/modules/users/store/user.actions.ts b/src/app/modules/users/store/user.actions.ts
index 4ac160713..674fff5af 100644
--- a/src/app/modules/users/store/user.actions.ts
+++ b/src/app/modules/users/store/user.actions.ts
@@ -11,36 +11,12 @@ export enum UserActionTypes {
REVOKE_USER_ROLE = '[User] REVOKE_USER_ROLE',
REVOKE_USER_ROLE_SUCCESS = '[User] REVOKE_USER_ROLE_SUCCESS',
REVOKE_USER_ROLE_FAIL = '[User] REVOKE_USER_ROLE_FAIL',
-<<<<<<< HEAD
-<<<<<<< HEAD
ADD_USER_TO_GROUP = '[User] ADD_USER_TO_GROUP',
ADD_USER_TO_GROUP_SUCCESS = '[User] ADD_USER_TO_GROUP_SUCCESS',
ADD_USER_TO_GROUP_FAIL = '[User] ADD_USER_TO_GROUP_FAIL',
REMOVE_USER_FROM_GROUP = '[User] REMOVE_USER_FROM_GROUP',
REMOVE_USER_FROM_GROUP_SUCCESS = '[User] REMOVE_USER_FROM_GROUP_SUCCESS',
REMOVE_USER_FROM_GROUP_FAIL = '[User] REMOVE_USER_FROM_GROUP_FAIL',
-=======
- ADD_GROUP_TO_USER = '[User] ADD_GROUP_TO_USER',
- ADD_GROUP_TO_USER_SUCCESS = '[User] ADD_GROUP_TO_USER_SUCCESS',
- ADD_GROUP_TO_USER_FAIL = '[User] ADD_GROUP_TO_USER_FAIL',
- REMOVE_GROUP_TO_USER = '[User] REMOVE_GROUP_TO_USER',
- REMOVE_GROUP_TO_USER_SUCCESS = '[User] REMOVE_GROUP_TO_USER_SUCCESS',
- REMOVE_GROUP_TO_USER_FAIL = '[User] REMOVE_GROUP_TO_USER_FAIL',
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- ADD_USER_TO_GROUP = '[User] ADD_USER_TO_GROUP',
- ADD_USER_TO_GROUP_SUCCESS = '[User] ADD_USER_TO_GROUP_SUCCESS',
- ADD_USER_TO_GROUP_FAIL = '[User] ADD_USER_TO_GROUP_FAIL',
-<<<<<<< HEAD
- REMOVE_USER_TO_GROUP = '[User] REMOVE_USER_TO_GROUP',
- REMOVE_USER_TO_GROUP_SUCCESS = '[User] REMOVE_USER_TO_GROUP_SUCCESS',
- REMOVE_USER_TO_GROUP_FAIL = '[User] REMOVE_USER_TO_GROUP_FAIL',
->>>>>>> refactor: TT-188 refactor some names
-=======
- REMOVE_USER_FROM_GROUP = '[User] REMOVE_USER_FROM_GROUP',
- REMOVE_USER_FROM_GROUP_SUCCESS = '[User] REMOVE_USER_FROM_GROUP_SUCCESS',
- REMOVE_USER_FROM_GROUP_FAIL = '[User] REMOVE_USER_FROM_GROUP_FAIL',
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
DEFAULT_USER = '[USER] DEFAULT_USER',
}
@@ -88,8 +64,6 @@ export class RevokeRoleUserFail implements Action {
constructor(public error: string) {}
}
-<<<<<<< HEAD
-<<<<<<< HEAD
export class AddUserToGroup implements Action {
public readonly type = UserActionTypes.ADD_USER_TO_GROUP;
constructor(public userId: string, public groupName: string) {}
@@ -107,7 +81,6 @@ export class AddUserToGroupFail implements Action {
export class RemoveUserFromGroup implements Action {
public readonly type = UserActionTypes.REMOVE_USER_FROM_GROUP;
-<<<<<<< HEAD
constructor(public userId: string, public groupName: string) {}
}
@@ -118,51 +91,6 @@ export class RemoveUserFromGroupSuccess implements Action {
export class RemoveUserFromGroupFail implements Action {
public readonly type = UserActionTypes.REMOVE_USER_FROM_GROUP_FAIL;
-=======
-export class AddGroupToUser implements Action {
- public readonly type = UserActionTypes.ADD_GROUP_TO_USER;
-=======
-export class AddUserToGroup implements Action {
- public readonly type = UserActionTypes.ADD_USER_TO_GROUP;
->>>>>>> refactor: TT-188 refactor some names
- constructor(public userId: string, public groupName: string) {}
-}
-
-export class AddUserToGroupSuccess implements Action {
- public readonly type = UserActionTypes.ADD_USER_TO_GROUP_SUCCESS;
- constructor(readonly payload: User) {}
-}
-
-export class AddUserToGroupFail implements Action {
- public readonly type = UserActionTypes.ADD_USER_TO_GROUP_FAIL;
- constructor(public error: string) {}
-}
-
-export class RemoveUserToGroup implements Action {
- public readonly type = UserActionTypes.REMOVE_USER_TO_GROUP;
-=======
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
- constructor(public userId: string, public groupName: string) {}
-}
-
-export class RemoveUserFromGroupSuccess implements Action {
- public readonly type = UserActionTypes.REMOVE_USER_FROM_GROUP_SUCCESS;
- constructor(readonly payload: User) {}
-}
-
-<<<<<<< HEAD
-<<<<<<< HEAD
-export class RemoveGroupToUserFail implements Action {
- public readonly type = UserActionTypes.REMOVE_GROUP_TO_USER_FAIL;
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
-export class RemoveUserToGroupFail implements Action {
- public readonly type = UserActionTypes.REMOVE_USER_TO_GROUP_FAIL;
->>>>>>> refactor: TT-188 refactor some names
-=======
-export class RemoveUserFromGroupFail implements Action {
- public readonly type = UserActionTypes.REMOVE_USER_FROM_GROUP_FAIL;
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
constructor(public error: string) {}
}
@@ -181,33 +109,9 @@ export type UserActions =
| RevokeRoleUser
| RevokeRoleUserSuccess
| RevokeRoleUserFail
-<<<<<<< HEAD
-<<<<<<< HEAD
- | AddUserToGroup
- | AddUserToGroupSuccess
- | AddUserToGroupFail
- | RemoveUserFromGroup
- | RemoveUserFromGroupSuccess
- | RemoveUserFromGroupFail;
-=======
- | AddGroupToUser
- | AddGroupToUserSuccess
- | AddGroupToUserFail
- | RemoveGroupToUser
- | RemoveGroupToUserSuccess
- | RemoveGroupToUserFail;
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
| AddUserToGroup
| AddUserToGroupSuccess
| AddUserToGroupFail
-<<<<<<< HEAD
- | RemoveUserToGroup
- | RemoveUserToGroupSuccess
- | RemoveUserToGroupFail;
->>>>>>> refactor: TT-188 refactor some names
-=======
| RemoveUserFromGroup
| RemoveUserFromGroupSuccess
| RemoveUserFromGroupFail;
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
diff --git a/src/app/modules/users/store/user.effects.spec.ts b/src/app/modules/users/store/user.effects.spec.ts
index 8f8e2162b..8aea60311 100644
--- a/src/app/modules/users/store/user.effects.spec.ts
+++ b/src/app/modules/users/store/user.effects.spec.ts
@@ -106,34 +106,16 @@ describe('UserEffects', () => {
});
});
-<<<<<<< HEAD
-<<<<<<< HEAD
it('action type is ADD_USER_TO_GROUP_SUCCESS when service is executed sucessfully', async () => {
const userId = 'userId';
const groupName = 'groupName';
actions$ = of({
type: UserActionTypes.ADD_USER_TO_GROUP,
-=======
- it('action type is ADD_GROUP_TO_USER_SUCCESS when service is executed sucessfully', async () => {
- const userId = 'userId';
- const groupName = 'groupName';
- actions$ = of({
- type: UserActionTypes.ADD_GROUP_TO_USER,
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- it('action type is ADD_USER_TO_GROUP_SUCCESS when service is executed sucessfully', async () => {
- const userId = 'userId';
- const groupName = 'groupName';
- actions$ = of({
- type: UserActionTypes.ADD_USER_TO_GROUP,
->>>>>>> refactor: TT-188 refactor some names
userId,
groupName,
});
spyOn(toastrService, 'success');
-<<<<<<< HEAD
-<<<<<<< HEAD
spyOn(service, 'addUserToGroup').and.returnValue(of(user));
effects.addUserToGroup$.subscribe((action) => {
@@ -147,35 +129,11 @@ describe('UserEffects', () => {
const groupName = 'groupName';
actions$ = of({
type: UserActionTypes.ADD_USER_TO_GROUP,
-=======
- spyOn(service, 'addGroupToUser').and.returnValue(of(user));
-=======
- spyOn(service, 'addUserToGroup').and.returnValue(of(user));
->>>>>>> refactor: TT-188 refactor some names
-
- effects.addUserToGroup$.subscribe((action) => {
- expect(toastrService.success).toHaveBeenCalledWith('Add user to group success');
- expect(action.type).toEqual(UserActionTypes.ADD_USER_TO_GROUP_SUCCESS);
- });
- });
-
- it('action type is ADD_USER_TO_GROUP_FAIL when service is executed and fail', async () => {
- const userId = 'userId';
- const groupName = 'groupName';
- actions$ = of({
-<<<<<<< HEAD
- type: UserActionTypes.ADD_GROUP_TO_USER,
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- type: UserActionTypes.ADD_USER_TO_GROUP,
->>>>>>> refactor: TT-188 refactor some names
userId,
groupName,
});
spyOn(toastrService, 'error');
-<<<<<<< HEAD
-<<<<<<< HEAD
spyOn(service, 'addUserToGroup').and.returnValue(throwError({ error: { message: 'error' } }));
effects.addUserToGroup$.subscribe((action) => {
@@ -185,47 +143,15 @@ describe('UserEffects', () => {
});
it('action type is REMOVE_USER_FROM_GROUP_SUCCESS when service is executed succesfully', async () => {
-<<<<<<< HEAD
- const userId = 'userId';
- const groupName = 'groupName';
- actions$ = of({
- type: UserActionTypes.REMOVE_USER_FROM_GROUP,
-=======
- spyOn(service, 'addGroupToUser').and.returnValue(throwError({ error: { message: 'error' } }));
-=======
- spyOn(service, 'addUserToGroup').and.returnValue(throwError({ error: { message: 'error' } }));
->>>>>>> refactor: TT-188 refactor some names
-
- effects.addUserToGroup$.subscribe((action) => {
- expect(toastrService.error).toHaveBeenCalled();
- expect(action.type).toEqual(UserActionTypes.ADD_USER_TO_GROUP_FAIL);
- });
- });
-
- it('action type is REMOVE_USER_TO_GROUP_SUCCESS when service is executed succesfully', async () => {
- const userId = 'userId';
- const groupName = 'groupName';
- actions$ = of({
-<<<<<<< HEAD
- type: UserActionTypes.REMOVE_GROUP_TO_USER,
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- type: UserActionTypes.REMOVE_USER_TO_GROUP,
->>>>>>> refactor: TT-188 refactor some names
-=======
const userId = 'userId';
const groupName = 'groupName';
actions$ = of({
type: UserActionTypes.REMOVE_USER_FROM_GROUP,
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
userId,
groupName,
});
spyOn(toastrService, 'success');
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
spyOn(service, 'removeUserFromGroup').and.returnValue(of(user));
effects.removeUserFromGroup$.subscribe((action) => {
@@ -239,69 +165,16 @@ describe('UserEffects', () => {
const groupName = 'groupName';
actions$ = of({
type: UserActionTypes.REMOVE_USER_FROM_GROUP,
-=======
- spyOn(service, 'removeGroupToUser').and.returnValue(of(user));
-=======
- spyOn(service, 'removeUserToGroup').and.returnValue(of(user));
->>>>>>> refactor: TT-188 refactor some names
-=======
- spyOn(service, 'removeUserFromGroup').and.returnValue(of(user));
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
-
- effects.removeUserFromGroup$.subscribe((action) => {
- expect(toastrService.success).toHaveBeenCalledWith('Remove user from group success');
- expect(action.type).toEqual(UserActionTypes.REMOVE_USER_FROM_GROUP_SUCCESS);
- });
- });
-
- it('action type is REMOVE_USER_FROM_GROUP_FAIL when service is executed succesfully', async () => {
- const userId = 'userId';
- const groupName = 'groupName';
- actions$ = of({
-<<<<<<< HEAD
-<<<<<<< HEAD
- type: UserActionTypes.REMOVE_GROUP_TO_USER,
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- type: UserActionTypes.REMOVE_USER_TO_GROUP,
->>>>>>> refactor: TT-188 refactor some names
-=======
- type: UserActionTypes.REMOVE_USER_FROM_GROUP,
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
userId,
groupName,
});
spyOn(toastrService, 'error');
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
- spyOn(service, 'removeUserFromGroup').and.returnValue(throwError({ error: { message: 'error' } }));
-
- effects.removeUserFromGroup$.subscribe((action) => {
- expect(toastrService.error).toHaveBeenCalled();
- expect(action.type).toEqual(UserActionTypes.REMOVE_USER_FROM_GROUP_FAIL);
-=======
- spyOn(service, 'removeGroupToUser').and.returnValue(throwError({ error: { message: 'error' } }));
-=======
- spyOn(service, 'removeUserToGroup').and.returnValue(throwError({ error: { message: 'error' } }));
->>>>>>> refactor: TT-188 refactor some names
-=======
spyOn(service, 'removeUserFromGroup').and.returnValue(throwError({ error: { message: 'error' } }));
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
effects.removeUserFromGroup$.subscribe((action) => {
expect(toastrService.error).toHaveBeenCalled();
-<<<<<<< HEAD
-<<<<<<< HEAD
- expect(action.type).toEqual(UserActionTypes.REMOVE_GROUP_TO_USER_FAIL);
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- expect(action.type).toEqual(UserActionTypes.REMOVE_USER_TO_GROUP_FAIL);
->>>>>>> refactor: TT-188 refactor some names
-=======
expect(action.type).toEqual(UserActionTypes.REMOVE_USER_FROM_GROUP_FAIL);
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
});
});
});
diff --git a/src/app/modules/users/store/user.effects.ts b/src/app/modules/users/store/user.effects.ts
index 5daeaf9d9..613b18456 100644
--- a/src/app/modules/users/store/user.effects.ts
+++ b/src/app/modules/users/store/user.effects.ts
@@ -65,8 +65,6 @@ export class UserEffects {
);
@Effect()
-<<<<<<< HEAD
-<<<<<<< HEAD
addUserToGroup$: Observable = this.actions$.pipe(
ofType(actions.UserActionTypes.ADD_USER_TO_GROUP),
map((action: actions.AddUserToGroup) => action),
@@ -79,64 +77,15 @@ export class UserEffects {
catchError((error) => {
this.toastrService.error(error.error.message);
return of(new actions.AddUserToGroupFail(error));
-=======
- addGroupToUser$: Observable = this.actions$.pipe(
- ofType(actions.UserActionTypes.ADD_GROUP_TO_USER),
- map((action: actions.AddGroupToUser) => action),
-=======
- addUserToGroup$: Observable = this.actions$.pipe(
- ofType(actions.UserActionTypes.ADD_USER_TO_GROUP),
- map((action: actions.AddUserToGroup) => action),
->>>>>>> refactor: TT-188 refactor some names
- mergeMap((action) =>
- this.userService.addUserToGroup(action.userId, action.groupName).pipe(
- map((response) => {
- this.toastrService.success('Add user to group success');
- return new actions.AddUserToGroupSuccess(response);
- }),
- catchError((error) => {
- this.toastrService.error(error.error.message);
-<<<<<<< HEAD
- return of(new actions.AddGroupToUserFail(error));
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- return of(new actions.AddUserToGroupFail(error));
->>>>>>> refactor: TT-188 refactor some names
})
)
)
);
@Effect()
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
- removeUserFromGroup$: Observable = this.actions$.pipe(
- ofType(actions.UserActionTypes.REMOVE_USER_FROM_GROUP),
- map((action: actions.RemoveUserFromGroup) => action),
- mergeMap((action) =>
- this.userService.removeUserFromGroup(action.userId, action.groupName).pipe(
- map((response) => {
- this.toastrService.success('Remove user from group success');
- return new actions.RemoveUserFromGroupSuccess(response);
- }),
- catchError((error) => {
- this.toastrService.error(error.error.message);
- return of(new actions.RemoveUserFromGroupFail(error));
-=======
- removeGroupToUser$: Observable = this.actions$.pipe(
- ofType(actions.UserActionTypes.REMOVE_GROUP_TO_USER),
- map((action: actions.RemoveGroupToUser) => action),
-=======
- removeUserToGroup$: Observable = this.actions$.pipe(
- ofType(actions.UserActionTypes.REMOVE_USER_TO_GROUP),
- map((action: actions.RemoveUserToGroup) => action),
->>>>>>> refactor: TT-188 refactor some names
-=======
removeUserFromGroup$: Observable = this.actions$.pipe(
ofType(actions.UserActionTypes.REMOVE_USER_FROM_GROUP),
map((action: actions.RemoveUserFromGroup) => action),
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
mergeMap((action) =>
this.userService.removeUserFromGroup(action.userId, action.groupName).pipe(
map((response) => {
@@ -145,16 +94,7 @@ export class UserEffects {
}),
catchError((error) => {
this.toastrService.error(error.error.message);
-<<<<<<< HEAD
-<<<<<<< HEAD
- return of(new actions.RemoveGroupToUserFail(error));
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- return of(new actions.RemoveUserToGroupFail(error));
->>>>>>> refactor: TT-188 refactor some names
-=======
return of(new actions.RemoveUserFromGroupFail(error));
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
})
)
)
diff --git a/src/app/modules/users/store/user.reducer.spec.ts b/src/app/modules/users/store/user.reducer.spec.ts
index bcb1488ab..6180cfff4 100644
--- a/src/app/modules/users/store/user.reducer.spec.ts
+++ b/src/app/modules/users/store/user.reducer.spec.ts
@@ -93,59 +93,27 @@ describe('userReducer', () => {
expect(state.isLoading).toEqual(false);
});
-<<<<<<< HEAD
-<<<<<<< HEAD
it('on AddUserToGroup, isLoading is true', () => {
const userId = 'userId';
const groupName = 'groupName';
const action = new actions.AddUserToGroup(userId, groupName);
-=======
- it('on AddGroupToUser, isLoading is true', () => {
- const userId = 'userId';
- const groupName = 'groupName';
- const action = new actions.AddGroupToUser(userId, groupName);
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- it('on AddUserToGroup, isLoading is true', () => {
- const userId = 'userId';
- const groupName = 'groupName';
- const action = new actions.AddUserToGroup(userId, groupName);
->>>>>>> refactor: TT-188 refactor some names
const state = userReducer(initialState, action);
expect(state.isLoading).toEqual(true);
});
-<<<<<<< HEAD
-<<<<<<< HEAD
- it('on AddUserToGroupSuccess, user groups should change', () => {
-=======
- it('on AddGroupToUserSuccess, user groups should change', () => {
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
it('on AddUserToGroupSuccess, user groups should change', () => {
->>>>>>> refactor: TT-188 refactor some names
const currentState: UserState = {
data: [{ id: 'id', name: 'name', email: 'email', groups: null }],
isLoading: false,
message: '',
};
const userWithGroupAdded: User = { id: 'id', name: 'name', email: 'email', groups: ['group'] };
-<<<<<<< HEAD
-<<<<<<< HEAD
const action = new actions.AddUserToGroupSuccess(userWithGroupAdded);
-=======
- const action = new actions.AddGroupToUserSuccess(userWithGroupAdded);
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- const action = new actions.AddUserToGroupSuccess(userWithGroupAdded);
->>>>>>> refactor: TT-188 refactor some names
const state = userReducer(currentState, action);
expect(state.data).toEqual([userWithGroupAdded]);
expect(state.isLoading).toEqual(false);
-<<<<<<< HEAD
-<<<<<<< HEAD
expect(state.message).toEqual('Add user to group success');
});
@@ -158,115 +126,34 @@ describe('userReducer', () => {
});
it('on RemoveUserFromGroup, isLoading is true', () => {
-<<<<<<< HEAD
- const userId = 'userId';
- const groupName = 'groupName';
- const action = new actions.RemoveUserFromGroup(userId, groupName);
-=======
- expect(state.message).toEqual('Add group to a user success');
-=======
- expect(state.message).toEqual('Add user to group success');
->>>>>>> refactor: TT-188 refactor some names
- });
-
- it('on AddUserToGroupFail, should show a message with an error message', () => {
- const action = new actions.AddUserToGroupFail('error');
- const state = userReducer(initialState, action);
-
- expect(state.message).toEqual('Something went wrong adding user to group');
- expect(state.isLoading).toEqual(false);
- });
-
- it('on RemoveUserToGroup, isLoading is true', () => {
- const userId = 'userId';
- const groupName = 'groupName';
-<<<<<<< HEAD
- const action = new actions.RemoveGroupToUser(userId, groupName);
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- const action = new actions.RemoveUserToGroup(userId, groupName);
->>>>>>> refactor: TT-188 refactor some names
-=======
const userId = 'userId';
const groupName = 'groupName';
const action = new actions.RemoveUserFromGroup(userId, groupName);
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
const state = userReducer(initialState, action);
expect(state.isLoading).toEqual(true);
});
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
it('on RemoveUserFromGroupSuccess, user groups should change', () => {
-=======
- it('on RemoveGroupToUserSuccess, user groups should change', () => {
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- it('on RemoveUserToGroupSuccess, user groups should change', () => {
->>>>>>> refactor: TT-188 refactor some names
-=======
- it('on RemoveUserFromGroupSuccess, user groups should change', () => {
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
const currentState: UserState = {
data: [{ id: 'id', name: 'name', email: 'email', groups: ['group'] }],
isLoading: false,
message: '',
};
const userWithGroupRemoved: User = { id: 'id', name: 'name', email: 'email', groups: null };
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
- const action = new actions.RemoveUserFromGroupSuccess(userWithGroupRemoved);
-=======
- const action = new actions.RemoveGroupToUserSuccess(userWithGroupRemoved);
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- const action = new actions.RemoveUserToGroupSuccess(userWithGroupRemoved);
->>>>>>> refactor: TT-188 refactor some names
-=======
const action = new actions.RemoveUserFromGroupSuccess(userWithGroupRemoved);
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
const state = userReducer(currentState, action);
expect(state.data).toEqual([userWithGroupRemoved]);
expect(state.isLoading).toEqual(false);
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
- expect(state.message).toEqual('Remove user from group success');
- });
-
- it('on RemoveUserFromGroupFail, should show a message with an error message', () => {
- const action = new actions.RemoveUserFromGroupFail('error');
- const state = userReducer(initialState, action);
-
- expect(state.message).toEqual('Something went wrong removing user from group');
-=======
- expect(state.message).toEqual('Remove group to a user success');
-=======
- expect(state.message).toEqual('Remove user to group success');
->>>>>>> refactor: TT-188 refactor some names
-=======
expect(state.message).toEqual('Remove user from group success');
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
});
it('on RemoveUserFromGroupFail, should show a message with an error message', () => {
const action = new actions.RemoveUserFromGroupFail('error');
const state = userReducer(initialState, action);
-<<<<<<< HEAD
-<<<<<<< HEAD
- expect(state.message).toEqual('Something went wrong removing group to a user');
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- expect(state.message).toEqual('Something went wrong removing user to group');
->>>>>>> refactor: TT-188 refactor some names
-=======
expect(state.message).toEqual('Something went wrong removing user from group');
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
expect(state.isLoading).toEqual(false);
});
diff --git a/src/app/modules/users/store/user.reducers.ts b/src/app/modules/users/store/user.reducers.ts
index 5fef4fb21..8a1c75443 100644
--- a/src/app/modules/users/store/user.reducers.ts
+++ b/src/app/modules/users/store/user.reducers.ts
@@ -88,36 +88,18 @@ export const userReducer = (state: UserState = initialState, action: UserActions
};
}
-<<<<<<< HEAD
-<<<<<<< HEAD
case UserActionTypes.ADD_USER_TO_GROUP: {
-=======
- case UserActionTypes.ADD_GROUP_TO_USER: {
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- case UserActionTypes.ADD_USER_TO_GROUP: {
->>>>>>> refactor: TT-188 refactor some names
return {
...state,
isLoading: true,
};
}
-<<<<<<< HEAD
-<<<<<<< HEAD
- case UserActionTypes.ADD_USER_TO_GROUP_SUCCESS: {
-=======
- case UserActionTypes.ADD_GROUP_TO_USER_SUCCESS: {
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
case UserActionTypes.ADD_USER_TO_GROUP_SUCCESS: {
->>>>>>> refactor: TT-188 refactor some names
const index = userData.findIndex((user) => user.id === action.payload.id);
userData[index] = action.payload;
return {
data: userData,
isLoading: false,
-<<<<<<< HEAD
-<<<<<<< HEAD
message: 'Add user to group success',
};
}
@@ -130,89 +112,25 @@ export const userReducer = (state: UserState = initialState, action: UserActions
}
case UserActionTypes.REMOVE_USER_FROM_GROUP: {
-=======
- message: 'Add group to a user success',
-=======
- message: 'Add user to group success',
->>>>>>> refactor: TT-188 refactor some names
- };
- }
- case UserActionTypes.ADD_USER_TO_GROUP_FAIL: {
- return {
- ...state,
- isLoading: false,
- message: 'Something went wrong adding user to group',
- };
- }
-
-<<<<<<< HEAD
-<<<<<<< HEAD
- case UserActionTypes.REMOVE_GROUP_TO_USER: {
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- case UserActionTypes.REMOVE_USER_TO_GROUP: {
->>>>>>> refactor: TT-188 refactor some names
-=======
- case UserActionTypes.REMOVE_USER_FROM_GROUP: {
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
return {
...state,
isLoading: true,
};
}
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
- case UserActionTypes.REMOVE_USER_FROM_GROUP_SUCCESS: {
-=======
- case UserActionTypes.REMOVE_GROUP_TO_USER_SUCCESS: {
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- case UserActionTypes.REMOVE_USER_TO_GROUP_SUCCESS: {
->>>>>>> refactor: TT-188 refactor some names
-=======
case UserActionTypes.REMOVE_USER_FROM_GROUP_SUCCESS: {
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
const index = userData.findIndex((user) => user.id === action.payload.id);
userData[index] = action.payload;
return {
data: userData,
isLoading: false,
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
- message: 'Remove user from group success',
- };
- }
- case UserActionTypes.REMOVE_USER_FROM_GROUP_FAIL: {
- return {
- ...state,
- isLoading: false,
- message: 'Something went wrong removing user from group',
-=======
- message: 'Remove group to a user success',
-=======
- message: 'Remove user to group success',
->>>>>>> refactor: TT-188 refactor some names
-=======
message: 'Remove user from group success',
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
};
}
case UserActionTypes.REMOVE_USER_FROM_GROUP_FAIL: {
return {
...state,
isLoading: false,
-<<<<<<< HEAD
-<<<<<<< HEAD
- message: 'Something went wrong removing group to a user',
->>>>>>> feat: TT-188 add ngrx flow & test
-=======
- message: 'Something went wrong removing user to group',
->>>>>>> refactor: TT-188 refactor some names
-=======
message: 'Something went wrong removing user from group',
->>>>>>> refactor: TT-188 refactor 'removeTo' to 'removeFrom' references
};
}
default: