Skip to content

Commit

Permalink
feat(admin): increase requests history time (#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
moshfeu committed Oct 9, 2023
1 parent 8009568 commit 784bda7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Me/Routes/Admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ const Admin = () => {
}, [mentorshipRequests, name, sentOnly, showDaysAgo]);

useEffect(() => {
getAllMentorshipRequests(api).then((response: any) => {
getAllMentorshipRequests(api, 3).then((response: any) => {
if (response?.success) {
setMentorshipRequests(
response.data.filter(({ mentor, mentee }: { mentor: any, mentee: any }) => !!mentor && !!mentee)
);
}
});
}, []);
}, [showDaysAgo, api]);

useEffect(() => {
setName(user?.name || '');
Expand Down
10 changes: 5 additions & 5 deletions src/api/admin.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { paths } from '.';
import ApiService, { paths } from '.';
import { MentorshipRequest, UserRecord } from '../types/models';

export function getAllMentorshipRequests(apiService: any) {
export function getAllMentorshipRequests(apiService: ApiService, numMonthAgo: number = 1) {
const monthAgo = new Date();
monthAgo.setDate(monthAgo.getDate() - 30);
monthAgo.setMonth(monthAgo.getMonth() - numMonthAgo);
return apiService.makeApiCall<MentorshipRequest[]>(`${paths.MENTORSHIP}/requests`, {
from: monthAgo,
});
Expand All @@ -17,7 +17,7 @@ export async function sendStaledRequestEmail(apiService: any, mentorshipId: stri
);
}

export async function sendMentorNotActive(apiService: any, mentorId: string) {
export async function sendMentorNotActive(apiService: ApiService, mentorId: string) {
const response = await apiService.makeApiCall<UserRecord>(
`${paths.ADMIN}/mentor/${mentorId}/notActive`,
null,
Expand All @@ -32,6 +32,6 @@ export async function freezeMentor(apiService: any, mentorId: string) {
await apiService.makeApiCall(`${paths.ADMIN}/mentor/${mentorId}/freeze`, null, 'PUT');
}

export function getUserRecords(apiService: any, userId: string) {
export function getUserRecords(apiService: ApiService, userId: string) {
return apiService.makeApiCall<UserRecord[]>(`${paths.USERS}/${userId}/records`);
}

1 comment on commit 784bda7

@vercel
Copy link

@vercel vercel bot commented on 784bda7 Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.