refactor:替换自增id为cuid
This commit is contained in:
@@ -91,7 +91,7 @@ export class UserService {
|
||||
};
|
||||
}
|
||||
|
||||
async findOneById(id: number) {
|
||||
async findOneById(id: string) {
|
||||
return this.prisma.sysUser.findUnique({
|
||||
select: {
|
||||
id: true,
|
||||
@@ -112,7 +112,7 @@ export class UserService {
|
||||
});
|
||||
}
|
||||
|
||||
async getUserInfo(id: number, isAdmin: boolean) {
|
||||
async getUserInfo(id: string, isAdmin: boolean) {
|
||||
const user = await this.prisma.sysUser.findUnique({
|
||||
select: {
|
||||
name: true,
|
||||
@@ -154,7 +154,7 @@ export class UserService {
|
||||
};
|
||||
}
|
||||
|
||||
async update(id: number, data: UpdateUserDto) {
|
||||
async update(id: string, data: UpdateUserDto) {
|
||||
const user = await this.findOne({ id });
|
||||
if (!user)
|
||||
throw new HttpException('修改失败,用户不存在!', HttpStatus.NOT_FOUND);
|
||||
@@ -178,7 +178,7 @@ export class UserService {
|
||||
}
|
||||
|
||||
async updatePassword(
|
||||
id: number,
|
||||
id: string,
|
||||
{ password, newPassword }: UpdatePasswordDto,
|
||||
) {
|
||||
const user = await this.findOne({ id });
|
||||
@@ -203,7 +203,7 @@ export class UserService {
|
||||
});
|
||||
}
|
||||
|
||||
async remove(id: number) {
|
||||
async remove(id: string) {
|
||||
const user = await this.findOne({ id });
|
||||
|
||||
if (!user)
|
||||
|
||||
Reference in New Issue
Block a user