mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-18 11:59:08 +00:00
FEAT: User Management WIP
This commit is contained in:
@@ -6,13 +6,10 @@ import { ProtoServices } from 'protospack-v2/dist/lib/Duc';
|
||||
import { UsersProtoService } from 'protospack-v2/dist/lib/Duc/interfaces/write-service';
|
||||
import {
|
||||
AssignRoleToUserRequest,
|
||||
AssignRoleToUserResponse,
|
||||
IdRequest,
|
||||
UnassignRoleFromUserRequest,
|
||||
UnassignRoleFromUserResponse,
|
||||
UserFindAllByCustomerIdResponse,
|
||||
} from 'protospack-v2/dist/lib/Duc/interfaces/messages';
|
||||
|
||||
import grpcHandler from '../../utils/grpcHandler';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class UsersService implements OnModuleInit {
|
||||
@@ -34,20 +31,20 @@ export class UsersService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async findAllUsersByCustomerId(customerId, searchQuery) {
|
||||
return grpcHandler<UserFindAllByCustomerIdResponse>(
|
||||
return lastValueFrom(
|
||||
this.usersService.UserFindAllByCustomerId({ customerId }),
|
||||
);
|
||||
}
|
||||
|
||||
async assignRoleToUser(body: AssignRoleToUserRequest) {
|
||||
return grpcHandler<AssignRoleToUserResponse>(
|
||||
this.usersService.AssignRoleToUser(body),
|
||||
);
|
||||
return lastValueFrom(this.usersService.AssignRoleToUser(body));
|
||||
}
|
||||
|
||||
async unassignRoleToUser(body: UnassignRoleFromUserRequest) {
|
||||
return grpcHandler<UnassignRoleFromUserResponse>(
|
||||
this.usersService.UnassignRoleFromUser(body),
|
||||
);
|
||||
return lastValueFrom(this.usersService.UnassignRoleFromUser(body));
|
||||
}
|
||||
|
||||
async deleteUser(id: IdRequest) {
|
||||
return lastValueFrom(this.usersService.UserRemove(id));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user