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

Commit

Permalink
fix : 멤버, 규칙 id 기준 정렬 (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
yewonahn authored Feb 12, 2024
2 parents 5f1c6e5 + dc4f323 commit f958183
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/rule/rule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ export class RuleService {
const dto = new DetailRuleDto();
const main: RuleMainEntity = await RuleMainEntity.findRuleById(ruleId);
const subs: RuleSubEntity[] = await RuleSubEntity.findSubById(ruleId);
subs.sort((a, b) => a.id - b.id);
const invitations: RuleInvitationEntity[] = await RuleInvitationEntity.find({
where: {rule: {id: ruleId}},
relations: {member: {profileImage : true}}
})
});
invitations.sort((a, b) => a.member.id - b.member.id);

try {
// 요청을 보낸 현재 로그인 사용자가 해당 규칙의 멤버인지 검증 (권한)
Expand Down Expand Up @@ -106,7 +108,7 @@ export class RuleService {
rulePair.ruleDetail = sub.ruleDetail;

return rulePair;
})).then(rulePairs => rulePairs.sort((a, b) => a.id - b.id));
}));

// -3) 멤버 정보
dto.detailMembers = await Promise.all(invitations.map(async(invitation):Promise<DetailMemberDto> => {
Expand All @@ -123,7 +125,7 @@ export class RuleService {
detailMember.image = await this.s3Service.getImageUrl(userImageKey);
}
return detailMember;
}))
}));
return dto;
} catch (e) {
console.log('게시글 조회에 실패하였습니다');
Expand Down

0 comments on commit f958183

Please sign in to comment.