调整user实体,去掉id

This commit is contained in:
2025-05-12 12:09:42 +08:00
parent 7a4855d131
commit f7f8a3b3e4
2 changed files with 2 additions and 5 deletions

View File

@@ -7,10 +7,7 @@ import { v4 as uuidv4 } from 'uuid';
@Index("IDX_user_email", ["email"], { unique: true, where: "email IS NOT NULL" })
@Index("IDX_user_phone", ["phone"], { unique: true, where: "phone IS NOT NULL" })
export class User {
@PrimaryGeneratedColumn()
id: number;
@Column('uuid', { default: () => 'gen_random_uuid()' })
@PrimaryGeneratedColumn('uuid')
userId: string;
@Column({ length: 32 })

View File

@@ -46,7 +46,7 @@ export class UserService {
if (!existingUser) {
throw new BadRequestException('User not found');
}
await this.userRepository.softDelete(existingUser.id);
await this.userRepository.softDelete(existingUser.userId);
}
hashPassword(password: string, salt: string): string {