Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 新增获取所有用户,修复deleteAt失效问题 #143

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ export class UserController {
return this.userService.deleteUser(email);
}
@Patch('/update')
@Permission('user:update')
@Permission('user::update')
async UpdateUser(@Body() body: UpdateUserDto) {
return this.userService.updateUserPwd(body);
}
@Get()
@Permission('user::query')
async getAllUser() {
return this.userService.getAllUser();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class UserService {
password,
name: username,
role: await roles,
deleteAt: 0,
});
return this.userRep.save(user);
} catch (err) {
Expand All @@ -46,9 +47,17 @@ export class UserService {
}
}

//获取所有用户信息
async getAllUser() {
return this.userRep.find({
where: { deleteAt: 0 },
select: ['id', 'name', 'email', 'createTime', 'updateTime'],
});
}

async getUserInfo(email: string, relations: string[] = []) {
return this.userRep.findOne({
where: { email, deleteAt: null },
where: { email, deleteAt: 0 },
select: [
'id',
'name',
Expand Down