Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
fix: 탐색 - 시그니처 썸네일 가져오기 버그 해결 (#234)
Browse files Browse the repository at this point in the history
## 요약
fix: 탐색 - 시그니처 썸네일 가져오기 버그 해결
<br><br>

## 작업 내용
시그니처 이미지 에러에 대한 예외처리 구성
<br><br>

## 참고 사항

<br><br>

## 관련 이슈

- Close #이슈번호

<br><br>
  • Loading branch information
JangYouJung authored Feb 16, 2024
2 parents a2dd155 + 31748ff commit a8c6a3d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
9 changes: 7 additions & 2 deletions src/search/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class SearchService{
for (let i = 0; i < signatureEntities.length && i < 20; i++) {
const signature = signatureEntities[i];
const signatureCover = await this.getSignatureCover(signature);
if(signatureCover) signatureCovers.push(signatureCover);

signatureCovers.push(signatureCover);
}
Expand All @@ -103,7 +104,7 @@ export class SearchService{
const resultCovers = [];
for(const signature of resultSignatures){
const signatureCover = await this.getSignatureCover(signature);
resultCovers.push(signatureCover);
if(signatureCover) resultCovers.push(signatureCover);
}
return resultCovers;

Expand All @@ -125,8 +126,12 @@ export class SearchService{

// 시그니처 썸네일 이미지 가져오기
signatureCover.date = await SignatureEntity.formatDateString(signature.created);

const signatureImageKey = await SignaturePageEntity.findThumbnail(signature.id);
signatureCover.image = await this.s3Service.getImageUrl(signatureImageKey);
if(signatureImageKey != null ){
signatureCover.image = await this.s3Service.getImageUrl(signatureImageKey);
}
else return null;

// 시그니처 작성자 프로필 이미지 가져오기
const userProfileImageEntity = await this.userService.getProfileImage(signature.user.id);
Expand Down
9 changes: 7 additions & 2 deletions src/signature/domain/signature.page.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ export class SignaturePageEntity extends BaseEntity {
},
});

console.log("썸네일 이미지: ",firstPage.image);
return firstPage.image;
console.log("첫번째 페이지: ",firstPage);

if(firstPage == null) return null;
else {
console.log("썸네일 이미지: ",firstPage.image);
return firstPage.image;
}

} catch (error) {
console.log('Error on findThumbnail: ', error);
Expand Down
4 changes: 2 additions & 2 deletions src/signature/signature.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ export class SignatureService {
async homeSignature(userId: number): Promise<HomeSignatureDto[]> {
try {
console.log('userId; ', userId);
const homeSignatureList: HomeSignatureDto[] = await this.findMySignature(
return this.findMySignature(
userId,
);
return homeSignatureList;

} catch (error) {
// 예외 처리
console.error('Error on HomeSignature: ', error);
Expand Down

0 comments on commit a8c6a3d

Please sign in to comment.