Skip to content

Commit

Permalink
bug sub태그 default태그로 머지 시도시 실종됨 (#492)
Browse files Browse the repository at this point in the history
* bug(tag): bookInfoId를 가져올 때 params에서 가져오게 함

bookInfoId를 가져올 때 request body가 아닌 params에서 가져오게 함

* feat(tag): bookInfoId 유효성 검사에서 null, undefined, 0인 경우 추가

bookInfoId 유효성 검사에서 null, undefined, 0인 경우, DB를 거치지 않고 바로 false를 반환하게 함

* chore(tag): merge 시 request param들 Number 형으로 명시적 형변환

merge 시 request param들 Number 형으로 명시적 형변환
  • Loading branch information
nyj001012 authored Jun 8, 2023
1 parent 4c6b3d6 commit c4e3296
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/src/tags/tags.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ export const mergeTags = async (
next: NextFunction,
) => {
const { id: tokenId } = req.user as any;
const bookInfoId: number = req?.body?.bookInfoId;
const superTagId: number = req?.body?.superTagId;
const bookInfoId: number = Number(req?.params?.bookInfoId);
const superTagId: number = Number(req?.body?.superTagId);
const subTagIds: number[] = req?.body?.subTagIds;
const tagsService = new TagsService();

Expand Down
3 changes: 3 additions & 0 deletions backend/src/tags/tags.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ export class TagsService {
}

async isValidBookInfoId(bookInfoId: number): Promise<boolean> {
if (bookInfoId === null || bookInfoId === undefined || bookInfoId === 0) {
return false;
}
const count: number = await this.superTagRepository.countBookInfoId(bookInfoId);
if (count === 0) {
return false;
Expand Down

0 comments on commit c4e3296

Please sign in to comment.