Skip to content

Commit 5785bc5

Browse files
thegreatyamoriLEON12699
authored andcommitted
feat: TT-188 add & remove groups to user service
1 parent 14945aa commit 5785bc5

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

src/app/modules/users/models/users.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ export interface User {
77
tenant_id?: string;
88
deleted?: string;
99
}
10+
11+
export interface UserState extends User {
12+
isLoading: boolean;
13+
error: string;
14+
}

src/app/modules/users/services/users.service.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,38 @@ describe('UsersService', () => {
5252
expect(grantRoleRequest.request.method).toBe('POST');
5353
});
5454

55+
<<<<<<< HEAD
5556
it('add user to group', () => {
57+
=======
58+
it('add group to a User', () => {
59+
>>>>>>> feat: TT-188 add & remove groups to user service
5660
const userId = 'userId';
5761
const group = 'admin';
5862
const addGroupURL = `${service.baseUrl}/${userId}/groups/add`;
5963

64+
<<<<<<< HEAD
6065
service.addUserToGroup(userId, group).subscribe();
66+
=======
67+
service.addGroupToUser(userId, group).subscribe();
68+
>>>>>>> feat: TT-188 add & remove groups to user service
6169

6270
expect(httpMock.expectOne(addGroupURL).request.method).toBe('POST');
6371
});
6472

73+
<<<<<<< HEAD
6574
it('remove user from group', () => {
75+
=======
76+
it('remove group to a User', () => {
77+
>>>>>>> feat: TT-188 add & remove groups to user service
6678
const userId = 'userId';
6779
const group = 'admin';
6880
const removeGroupURL = `${service.baseUrl}/${userId}/groups/remove`;
6981

82+
<<<<<<< HEAD
7083
service.removeUserFromGroup(userId, group).subscribe();
84+
=======
85+
service.removeGroupToUser(userId, group).subscribe();
86+
>>>>>>> feat: TT-188 add & remove groups to user service
7187

7288
expect(httpMock.expectOne(removeGroupURL).request.method).toBe('POST');
7389
});

src/app/modules/users/services/users.service.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,21 @@ export class UsersService {
2525
return this.http.post(url, null);
2626
}
2727

28+
<<<<<<< HEAD
2829
addUserToGroup(userId: string, group: string): Observable<User> {
30+
=======
31+
addGroupToUser(userId: string, group: string): Observable<User> {
32+
>>>>>>> feat: TT-188 add & remove groups to user service
2933
return this.http.post<User>(`${this.baseUrl}/${userId}/groups/add`, {
3034
group_name: group,
3135
});
3236
}
3337

38+
<<<<<<< HEAD
3439
removeUserFromGroup(userId: string, group: string): Observable<User> {
40+
=======
41+
removeGroupToUser(userId: string, group: string): Observable<User> {
42+
>>>>>>> feat: TT-188 add & remove groups to user service
3543
return this.http.post<User>(`${this.baseUrl}/${userId}/groups/remove`, {
3644
group_name: group,
3745
});

0 commit comments

Comments
 (0)