Skip to content

Commit

Permalink
Merge pull request #217 from Quickchive/hotfix-#216-modify-name
Browse files Browse the repository at this point in the history
Hotfix/#216 닉네임만 body에 실어보내는 경우 처리
  • Loading branch information
hou27 authored Nov 9, 2023
2 parents 9384e98 + 95b7f19 commit 9e08583
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/common/interceptors/transaction.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ export class TransactionInterceptor implements NestInterceptor {

return next.handle().pipe(
catchError(async (e) => {
console.log('check err ', e.message);
await queryRunner.rollbackTransaction();
await queryRunner.release();

const errorMessage = e.response.message[0]
? e.response.message[0]
: e.message;

if (e instanceof HttpException) {
throw new HttpException(e.message, e.getStatus());
throw new HttpException(errorMessage, e.getStatus());
} else {
throw new InternalServerErrorException(e.message);
throw new InternalServerErrorException(errorMessage);
}
}),
tap(async () => {
Expand Down
3 changes: 2 additions & 1 deletion src/users/dtos/edit-profile.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiProperty, PartialType, PickType } from '@nestjs/swagger';
import { IsString } from 'class-validator';
import { IsOptional, IsString } from 'class-validator';
import { CoreOutput } from '../../common/dtos/output.dto';
import { User } from '../entities/user.entity';

Expand All @@ -10,5 +10,6 @@ export class EditProfileInput extends PartialType(
) {
@ApiProperty({ description: '기존 비밀번호', required: false })
@IsString()
@IsOptional()
oldPassword?: string;
}
2 changes: 1 addition & 1 deletion src/users/entities/user.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class User extends CoreEntity {

@ApiProperty({ example: 'passw0rd', description: 'User Password' })
@Column({ select: false })
@IsString()
@IsString({ message: 'Password is required' })
@Matches(/^(?=.*\d)[A-Za-z\d@$!%*?&]{8,}$/, {
message: 'Password must be at least 8 characters long, contain 1 number',
})
Expand Down

0 comments on commit 9e08583

Please sign in to comment.