Skip to content

Commit

Permalink
fix(activity/study): findAll 시 upload date 기준으로 sort
Browse files Browse the repository at this point in the history
  • Loading branch information
son-daehyeon committed Sep 13, 2024
1 parent 53ae09a commit c7a9265
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/domain/activity/study/repository/study.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ export class StudyRepository {

// Read
async findAll(): Promise<Study[]> {
return this.studyModel.find().exec();
return this.studyModel.find().sort({ uploadedAt: -1 }).exec();
}

async findAllPage(page: number): Promise<Study[]> {
return this.studyModel
.find()
.sort({ uploadedAt: -1 })
.skip((page - 1) * 10)
.limit(10)
.exec();
Expand Down

0 comments on commit c7a9265

Please sign in to comment.