File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -312,7 +312,9 @@ export class MentorshipsController {
312
312
) ;
313
313
}
314
314
315
- const requests = await this . mentorshipsService . getAllMentorships ( ) ;
315
+ const requests = await this . mentorshipsService . getAllMentorships ( {
316
+ from : request . query . from ,
317
+ } ) ;
316
318
const mentorshipRequests = mentorshipsToDtos ( requests , currentUser ) ;
317
319
return {
318
320
success : true ,
Original file line number Diff line number Diff line change @@ -40,8 +40,15 @@ export class MentorshipsService {
40
40
/**
41
41
* Retruns all the mentorship reqeusts
42
42
*/
43
- async getAllMentorships ( ) {
44
- return this . mentorshipModel . find ( { } ) . populate ( 'mentee' ) . populate ( 'mentor' ) ;
43
+ async getAllMentorships ( { from } : { from ?: Date } ) {
44
+ return this . mentorshipModel
45
+ . find ( {
46
+ createdAt : {
47
+ $gte : from || - 1 ,
48
+ } ,
49
+ } )
50
+ . populate ( 'mentee' )
51
+ . populate ( 'mentor' ) ;
45
52
}
46
53
47
54
/**
You can’t perform that action at this time.
0 commit comments