add: member by superrior
This commit is contained in:
@@ -41,11 +41,11 @@ export class UsersService {
|
||||
const userData = new User();
|
||||
|
||||
userData.id = uuid.v4();
|
||||
(userData.username = createUserDto.username),
|
||||
(userData.password = await hashPassword(createUserDto.password, salt)),
|
||||
(userData.salt = salt),
|
||||
(userData.superior = superior),
|
||||
(userData.roles = roles);
|
||||
userData.username = createUserDto.username;
|
||||
userData.password = await hashPassword(createUserDto.password, salt);
|
||||
userData.salt = salt;
|
||||
userData.superior = superior;
|
||||
userData.roles = roles;
|
||||
|
||||
await this.connection.transaction(async (manager) => {
|
||||
const result = await manager.insert(User, userData);
|
||||
@@ -107,6 +107,20 @@ export class UsersService {
|
||||
});
|
||||
}
|
||||
|
||||
findBySuperrior(superriorId: string, page: number) {
|
||||
return this.usersRepository.findAndCount({
|
||||
skip: page * 10,
|
||||
take: 10,
|
||||
where: {
|
||||
superior: superriorId,
|
||||
},
|
||||
relations: ['roles'],
|
||||
order: {
|
||||
updatedAt: 'DESC',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async findExist(id: string) {
|
||||
try {
|
||||
return await this.usersRepository.findOneOrFail(id);
|
||||
|
||||
Reference in New Issue
Block a user