Skip to content

Commit

Permalink
[#66] 코드 리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
yeseul106 committed Oct 1, 2023
1 parent 708329a commit 395e603
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions server/src/entity/apply/apply.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ export class ApplyRepository extends Repository<Apply> {
take?: number,
date?: MeetingV0ListDate,
) {
const orderByAppliedDate = (() => {
switch (date) {
case MeetingV0ListDate.DESC:
return 'DESC';
case MeetingV0ListDate.ASC:
default:
return 'ASC';
}
})();

const applyQuery = this.createQueryBuilder('apply')
.select([
'apply.id',
Expand All @@ -59,10 +69,7 @@ export class ApplyRepository extends Repository<Apply> {
.where('apply.meetingId = :id', { id: meetingId })
.andWhere('apply.type IN(:...type)', { type: typeArr })
.andWhere('apply.status IN(:...status)', { status: statusArr })
.orderBy(
'apply.appliedDate',
date ? (date.toUpperCase() as 'ASC' | 'DESC') : 'ASC',
);
.orderBy('apply.id', orderByAppliedDate);

applyQuery.skip(skip).take(take);

Expand Down

0 comments on commit 395e603

Please sign in to comment.