refactor:替换自增id为cuid

This commit is contained in:
2024-11-27 15:25:57 +08:00
parent b02e2d2160
commit 5b382a124a
27 changed files with 161 additions and 114 deletions

View File

@@ -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)