-
+
{
>
{title}
- {/*
- {description}
- */}
-
+
|
@@ -196,13 +189,6 @@ const ListCourseForInstructors: React.FC = () => {
>
{category}
- {/*
- {category}
- */}
|
diff --git a/client/src/components/pages/home/RecommendedCard.tsx b/client/src/components/pages/home/RecommendedCard.tsx
index 63b7080..9589051 100644
--- a/client/src/components/pages/home/RecommendedCard.tsx
+++ b/client/src/components/pages/home/RecommendedCard.tsx
@@ -12,8 +12,9 @@ interface Props {
}
const RecommendedCard: React.FC = ({ courseInfo }) => {
- const { course, instructor } = courseInfo;
- const imageUrl = course?.thumbnail;
+ const { course, instructor, media } = courseInfo;
+ const imageUrl = media.thumbnailUrl;
+ const profileUrl = media.profileUrl;
return (
= ({ courseInfo }) => {
variant='circular'
alt='tania andrew'
className='border-2 border-white'
- src='https://images.unsplash.com/photo-1633332755192-727a05c4013d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1480&q=80'
+ src={profileUrl}
/>
diff --git a/client/src/components/pages/home/TrendingCard.tsx b/client/src/components/pages/home/TrendingCard.tsx
index af85100..cd2edd4 100644
--- a/client/src/components/pages/home/TrendingCard.tsx
+++ b/client/src/components/pages/home/TrendingCard.tsx
@@ -12,7 +12,8 @@ interface Props {
}
const TrendingCard: React.FC = ({ courseInfo }) => {
- const imageUrl = courseInfo?.thumbnail;
+ const imageUrl = courseInfo?.thumbnailUrl;
+ const profileUrl = courseInfo.profileUrl
return (
= ({ courseInfo }) => {
variant='circular'
alt='tania andrew'
className='border-2 border-white'
- src='https://images.unsplash.com/photo-1633332755192-727a05c4013d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1480&q=80'
+ src={profileUrl}
/>
diff --git a/client/src/components/pages/instructors/InstructorCard.tsx b/client/src/components/pages/instructors/InstructorCard.tsx
index c6d89b8..98efc29 100644
--- a/client/src/components/pages/instructors/InstructorCard.tsx
+++ b/client/src/components/pages/instructors/InstructorCard.tsx
@@ -14,7 +14,7 @@ const InstructorCard: React.FC = ({
subjects,
qualification,
skills,
- profilePic,
+ profileUrl,
about,
}) => {
return (
@@ -33,14 +33,12 @@ const InstructorCard: React.FC = ({
variant='circular'
alt='tania andrew'
className='border-2 border-white'
- src={profilePic??"https://images.unsplash.com/photo-1633332755192-727a05c4013d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1480&q=80"}
+ src={profileUrl??"https://images.unsplash.com/photo-1633332755192-727a05c4013d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1480&q=80"}
/>
{firstName + " " + lastName}
-
- {about}
-
+ {about}
= ({
- {skills+", "+subjects+", "+qualification},
-
+ {skills+", "+subjects},
+
);
diff --git a/client/src/components/pages/instructors/MyStudents.tsx b/client/src/components/pages/instructors/MyStudents.tsx
index 21b4339..7b732a3 100644
--- a/client/src/components/pages/instructors/MyStudents.tsx
+++ b/client/src/components/pages/instructors/MyStudents.tsx
@@ -27,12 +27,19 @@ export interface Students {
email: string;
mobile: string;
dateJoined: string;
+ isGoogleUser:boolean;
+ profilePic:{
+ name:string;
+ url:string;
+ id:string
+ }
+ profileUrl:string;
isBlocked: boolean;
}
const TABLE_HEAD = ["Student", "Course", "Status", "Joined"];
const MyStudents: React.FC = () => {
- const [students, setStudents] = useState([]);
+ const [students, setStudents] = useState([]);
const ITEMS_PER_PAGE = 5;
const {
currentPage,
@@ -112,7 +119,10 @@ const MyStudents: React.FC = () => {
course,
mobile,
isBlocked,
+ isGoogleUser,
dateJoined,
+ profileUrl,
+ profilePic
},
index
) => {
@@ -126,9 +136,7 @@ const MyStudents: React.FC = () => {
diff --git a/client/src/components/pages/instructors/ViewInstructor.tsx b/client/src/components/pages/instructors/ViewInstructor.tsx
index 1673714..e1ebe2b 100644
--- a/client/src/components/pages/instructors/ViewInstructor.tsx
+++ b/client/src/components/pages/instructors/ViewInstructor.tsx
@@ -47,7 +47,7 @@ const ViewInstructor: React.FC = (props: Props) => {
fetchInstructor();
}, []);
if (isLoading) {
- return
+ return ;
}
return (
@@ -73,7 +73,7 @@ const ViewInstructor: React.FC = (props: Props) => {
{
-
- {instructor?.about}
- {instructor?.skills}
- {instructor?.qualification}
- {instructor?.experience}
+
+ About Me
+ {instructor?.about}
+
+
+ Skills
+ {instructor?.skills}
+
+
+
+ Qualification
+ {instructor?.qualification}
+
+
+
+ Experience
+ {instructor?.experience}
+
diff --git a/server/src/adapters/controllers/courseController.ts b/server/src/adapters/controllers/courseController.ts
index 8daf171..550f7bf 100644
--- a/server/src/adapters/controllers/courseController.ts
+++ b/server/src/adapters/controllers/courseController.ts
@@ -153,6 +153,7 @@ const courseController = (
const instructorId = req.user?.Id;
const courses = await getCourseByInstructorU(
instructorId,
+ cloudService,
dbRepositoryCourse
);
res.status(200).json({
diff --git a/server/src/adapters/controllers/instructorController.ts b/server/src/adapters/controllers/instructorController.ts
index 0e2631a..3ae1ece 100644
--- a/server/src/adapters/controllers/instructorController.ts
+++ b/server/src/adapters/controllers/instructorController.ts
@@ -17,7 +17,11 @@ import { InstructorRepositoryMongoDb } from '../../frameworks/database/mongodb/r
import { CustomRequest } from '../../types/customRequest';
import { CloudServiceInterface } from '../../app/services/cloudServiceInterface';
import { CloudServiceImpl } from '../../frameworks/services/s3CloudService';
-import { changePasswordU, getStudentsForInstructorsU, updateProfileU } from '../../app/usecases/instructor';
+import {
+ changePasswordU,
+ getStudentsForInstructorsU,
+ updateProfileU
+} from '../../app/usecases/instructor';
import { AuthServiceInterface } from '../../app/services/authServicesInterface';
import { AuthService } from '../../frameworks/services/authService';
import { CourseRepositoryMongoDbInterface } from '@src/frameworks/database/mongodb/repositories/courseReposMongoDb';
@@ -27,8 +31,8 @@ const instructorController = (
authServiceImpl: AuthService,
instructorDbRepository: InstructorDbInterface,
instructorDbRepositoryImpl: InstructorRepositoryMongoDb,
- courseDbRepository:CourseDbRepositoryInterface,
- courseDbRepositoryImpl:CourseRepositoryMongoDbInterface,
+ courseDbRepository: CourseDbRepositoryInterface,
+ courseDbRepositoryImpl: CourseRepositoryMongoDbInterface,
emailServiceInterface: SendEmailServiceInterface,
emailServiceImpl: SendEmailService,
cloudServiceInterface: CloudServiceInterface,
@@ -38,7 +42,7 @@ const instructorController = (
const dbRepositoryInstructor = instructorDbRepository(
instructorDbRepositoryImpl()
);
- const dbRepositoryCourse = courseDbRepository(courseDbRepositoryImpl())
+ const dbRepositoryCourse = courseDbRepository(courseDbRepositoryImpl());
const emailService = emailServiceInterface(emailServiceImpl());
const cloudService = cloudServiceInterface(cloudServiceImpl());
@@ -85,7 +89,10 @@ const instructorController = (
});
const getAllInstructor = asyncHandler(async (req: Request, res: Response) => {
- const instructors = await getAllInstructors(dbRepositoryInstructor);
+ const instructors = await getAllInstructors(
+ cloudService,
+ dbRepositoryInstructor
+ );
res.json({
status: 'success',
message: 'Successfully fetched all instructor information',
@@ -192,15 +199,21 @@ const instructorController = (
}
);
- const getStudentsForInstructors = asyncHandler(async (req:CustomRequest,res:Response)=>{
- const instructorId:string|undefined = req.user?.Id
- const students = await getStudentsForInstructorsU(instructorId,dbRepositoryCourse)
- res.status(200).json({
- status: 'success',
- message: 'Successfully retrieved all students',
- data: students
- })
- })
+ const getStudentsForInstructors = asyncHandler(
+ async (req: CustomRequest, res: Response) => {
+ const instructorId: string | undefined = req.user?.Id;
+ const students = await getStudentsForInstructorsU(
+ instructorId,
+ cloudService,
+ dbRepositoryCourse
+ );
+ res.status(200).json({
+ status: 'success',
+ message: 'Successfully retrieved all students',
+ data: students
+ });
+ }
+ );
return {
getInstructorRequests,
diff --git a/server/src/app/usecases/course/listCourse.ts b/server/src/app/usecases/course/listCourse.ts
index 20bf399..befc494 100644
--- a/server/src/app/usecases/course/listCourse.ts
+++ b/server/src/app/usecases/course/listCourse.ts
@@ -65,6 +65,5 @@ export const getCourseByStudentU = async (
}
})
);
- console.log(courses)
return courses;
};
diff --git a/server/src/app/usecases/course/recommendation.ts b/server/src/app/usecases/course/recommendation.ts
index cf9b492..a417dd5 100644
--- a/server/src/app/usecases/course/recommendation.ts
+++ b/server/src/app/usecases/course/recommendation.ts
@@ -19,12 +19,15 @@ export const getRecommendedCourseByStudentU = async (
await courseDbRepository.getRecommendedCourseByStudentInterest(studentId);
await Promise.all(
courses.map(async (course) => {
- if (course.thumbnail) {
- course.thumbnailUrl = await cloudService.getFile(course.thumbnail.key);
+ course.media={thumbnailUrl:"",profileUrl:""}
+ if (course.course) {
+ course.media.thumbnailUrl = await cloudService.getFile(course.course.thumbnailKey);
+ }
+ if (course.instructor) {
+ course.media.profileUrl = await cloudService.getFile(course.instructor.profileKey);
}
})
);
- console.log(courses)
return courses;
};
@@ -39,8 +42,10 @@ export const getTrendingCourseU = async (
if (course.thumbnail) {
course.thumbnailUrl = await cloudService.getFile(course.thumbnail.key);
}
+ if (course.instructorProfile) {
+ course.profileUrl = await cloudService.getFile(course.instructorProfile.key);
+ }
})
);
- console.log(courses)
return courses;
};
diff --git a/server/src/app/usecases/course/viewCourse.ts b/server/src/app/usecases/course/viewCourse.ts
index e7c024d..f577e9f 100644
--- a/server/src/app/usecases/course/viewCourse.ts
+++ b/server/src/app/usecases/course/viewCourse.ts
@@ -1,9 +1,11 @@
import { CourseDbRepositoryInterface } from '../../repositories/courseDbRepository';
import HttpStatusCodes from '../../../constants/HttpStatusCodes';
import AppError from '../../../utils/appError';
+import { CloudServiceInterface } from '@src/app/services/cloudServiceInterface';
export const getCourseByInstructorU = async (
instructorId: string | undefined,
+ cloudService: ReturnType,
courseDbRepository: ReturnType
) => {
if (!instructorId && instructorId !== '') {
@@ -15,5 +17,14 @@ export const getCourseByInstructorU = async (
const courses = await courseDbRepository.getCourseByInstructorId(
instructorId
);
+ await Promise.all(
+ courses.map(async (course) => {
+ if (course.thumbnail) {
+ course.thumbnailUrl = await cloudService.getFile(course.thumbnail.key);
+ }
+ })
+ );
+
+ console.log(courses);
return courses;
};
diff --git a/server/src/app/usecases/instructor.ts b/server/src/app/usecases/instructor.ts
index 1d2c15f..cf7ce54 100644
--- a/server/src/app/usecases/instructor.ts
+++ b/server/src/app/usecases/instructor.ts
@@ -71,6 +71,7 @@ export const updateProfileU = async (
export const getStudentsForInstructorsU = async (
instructorId: string|undefined,
+ cloudService: ReturnType,
courseDbRepository: ReturnType
) => {
if (!instructorId) {
@@ -82,5 +83,15 @@ export const getStudentsForInstructorsU = async (
const students = await courseDbRepository.getStudentsByCourseForInstructor(
instructorId
);
+ console.log(students)
+ await Promise.all(
+ students.map(async (student) => {
+ if (student.profilePic.key) {
+ student.profileUrl = ""
+ student.profileUrl = await cloudService.getFile(student.profilePic.key);
+ }
+ })
+ );
+ console.log(students)
return students;
};
diff --git a/server/src/app/usecases/management/instructorManagement.ts b/server/src/app/usecases/management/instructorManagement.ts
index c836b62..5acd551 100644
--- a/server/src/app/usecases/management/instructorManagement.ts
+++ b/server/src/app/usecases/management/instructorManagement.ts
@@ -68,9 +68,19 @@ export const rejectInstructorRequest = async (
};
export const getAllInstructors = async (
+ cloudService: ReturnType,
instructorRepository: ReturnType
) => {
const instructors = await instructorRepository.getAllInstructors();
+ await Promise.all(
+ instructors.map(async (instructor) => {
+ if (instructor.profilePic) {
+ instructor.profileUrl = await cloudService.getFile(
+ instructor.profilePic.key ?? ''
+ );
+ }
+ })
+ );
return instructors;
};
@@ -126,5 +136,6 @@ export const getInstructorByIdUseCase = async (
if (instructor) {
instructor.password = 'no password';
}
+ console.log(instructor)
return instructor;
};
diff --git a/server/src/frameworks/database/mongodb/repositories/courseReposMongoDb.ts b/server/src/frameworks/database/mongodb/repositories/courseReposMongoDb.ts
index 0c4e019..676cb59 100644
--- a/server/src/frameworks/database/mongodb/repositories/courseReposMongoDb.ts
+++ b/server/src/frameworks/database/mongodb/repositories/courseReposMongoDb.ts
@@ -23,12 +23,12 @@ export const courseRepositoryMongodb = () => {
};
const getAllCourse = async () => {
- const courses:CourseInterface[]|null = await Course.find({});
+ const courses: CourseInterface[] | null = await Course.find({});
return courses;
};
const getCourseById = async (courseId: string) => {
- const course:CourseInterface|null = await Course.findOne({
+ const course: CourseInterface | null = await Course.findOne({
_id: new mongoose.Types.ObjectId(courseId)
});
return course;
@@ -58,6 +58,7 @@ export const courseRepositoryMongodb = () => {
};
const getRecommendedCourseByStudentInterest = async (studentId: string) => {
+ console.log(studentId);
const pipeline = [
{ $match: { _id: new mongoose.Types.ObjectId(studentId) } },
{ $unwind: '$interests' },
@@ -73,8 +74,8 @@ export const courseRepositoryMongodb = () => {
{
$lookup: {
from: 'course',
- localField: 'category._id',
- foreignField: 'categoryId',
+ localField: 'category.name',
+ foreignField: 'category',
as: 'courses'
}
},
@@ -97,13 +98,14 @@ export const courseRepositoryMongodb = () => {
course: {
_id: '$courses._id',
name: '$courses.title',
- thumbnail: '$courses.thumbnail'
+ thumbnailKey: '$courses.thumbnail.key'
},
instructor: {
_id: '$instructor._id',
firstName: '$instructor.firstName',
lastName: '$instructor.lastName',
- email: '$instructor.email'
+ email: '$instructor.email',
+ profileKey: '$instructor.profilePic.key'
}
}
}
@@ -134,7 +136,9 @@ export const courseRepositoryMongodb = () => {
coursesEnrolled: '$coursesEnrolled',
thumbnail: '$thumbnail',
instructorFirstName: { $arrayElemAt: ['$instructor.firstName', 0] },
- instructorLastName: { $arrayElemAt: ['$instructor.lastName', 0] }
+ instructorLastName: { $arrayElemAt: ['$instructor.lastName', 0] },
+ instructorProfile: { $arrayElemAt: ['$instructor.profilePic', 0] },
+ profileUrl: ''
}
}
]);
@@ -142,7 +146,7 @@ export const courseRepositoryMongodb = () => {
};
const getCourseByStudent = async (id: string) => {
- const courses:CourseInterface[]|null = await Course.find({
+ const courses: CourseInterface[] | null = await Course.find({
coursesEnrolled: {
$in: [new mongoose.Types.ObjectId(id)]
}
@@ -202,15 +206,17 @@ export const courseRepositoryMongodb = () => {
}
},
{
- $project: {
- course: '$courseName',
- firstName: '$student.firstName',
- lastName: '$student.lastName',
- email: '$student.email',
- mobile: '$student.mobile',
- dateJoined: '$student.dateJoined',
- isBlocked: '$student.isBlocked',
- profilePic: '$student.profilePic'
+ $group: {
+ _id: '$student._id',
+ course: { $first: '$courseName' },
+ firstName: { $first: '$student.firstName' },
+ lastName: { $first: '$student.lastName' },
+ email: { $first: '$student.email' },
+ mobile: { $first: '$student.mobile' },
+ dateJoined: { $first: '$student.dateJoined' },
+ isBlocked: { $first: '$student.isBlocked' },
+ profilePic: { $first: '$student.profilePic' },
+ isGoogleUser: { $first: '$student.isGoogleUser' }
}
}
]);
diff --git a/server/src/frameworks/webserver/routes/instructor.ts b/server/src/frameworks/webserver/routes/instructor.ts
index 844d174..f203f4c 100644
--- a/server/src/frameworks/webserver/routes/instructor.ts
+++ b/server/src/frameworks/webserver/routes/instructor.ts
@@ -54,7 +54,7 @@ const instructorRouter = () => {
router.get(
'/view-instructor/:instructorId',
- jwtAuthMiddleware,
+ // jwtAuthMiddleware,
controller.getInstructorById
);
From 0bd426e8fe4dd6462923fa9420750ecb9e1efc54 Mon Sep 17 00:00:00 2001
From: Abin
Date: Mon, 24 Jul 2023 17:07:21 +0530
Subject: [PATCH 3/4] seperated api to get instructor details
---
client/src/api/endpoints/instructor.ts | 5 ++++
client/src/api/services/instructor.ts | 7 ++++++
.../pages/instructors/ProfileForm.tsx | 7 +++---
client/src/constants/endpoints.ts | 3 ++-
.../controllers/instructorController.ts | 25 +++++++++++++++----
.../frameworks/webserver/routes/instructor.ts | 9 ++++---
6 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/client/src/api/endpoints/instructor.ts b/client/src/api/endpoints/instructor.ts
index 824a4af..f6d87e3 100644
--- a/client/src/api/endpoints/instructor.ts
+++ b/client/src/api/endpoints/instructor.ts
@@ -2,6 +2,7 @@ import {
updateProfileService,
changePasswordService,
getMyStudentsService,
+ getInstructorDetailsService,
} from "../services/instructor";
import { PasswordInfo } from "../types/student/student";
import END_POINTS from "../../constants/endpoints";
@@ -23,3 +24,7 @@ export const updateProfile = (profileInfo: FormData) => {
export const getMyStudents = () => {
return getMyStudentsService(END_POINTS.GET_MY_STUDENTS);
};
+
+export const getInstructorDetails = ()=>{
+ return getInstructorDetailsService(END_POINTS.GET_INSTRUCTOR_DETAILS)
+}
diff --git a/client/src/api/services/instructor.ts b/client/src/api/services/instructor.ts
index a7b3b71..d4b0856 100644
--- a/client/src/api/services/instructor.ts
+++ b/client/src/api/services/instructor.ts
@@ -30,3 +30,10 @@ export const getMyStudentsService = async (endpoint: string) => {
);
return response.data;
};
+
+export const getInstructorDetailsService = async(endpoint:string)=>{
+ const response = await api.get(
+ `${CONSTANTS_COMMON.API_BASE_URL}/${endpoint}`
+ );
+ return response.data;
+}
\ No newline at end of file
diff --git a/client/src/components/pages/instructors/ProfileForm.tsx b/client/src/components/pages/instructors/ProfileForm.tsx
index 73a6980..851d963 100644
--- a/client/src/components/pages/instructors/ProfileForm.tsx
+++ b/client/src/components/pages/instructors/ProfileForm.tsx
@@ -1,10 +1,9 @@
import { useState, useEffect } from "react";
import { useFormik } from "formik";
import { toast } from "react-toastify";
-import { updateProfile } from "../../../api/endpoints/instructor";
+import { getInstructorDetails, updateProfile } from "../../../api/endpoints/instructor";
import { UpdateProfileInfo } from "../../../api/types/instructor/instructor";
import { Avatar } from "@material-tailwind/react";
-import { getIndividualInstructors } from "../../../api/endpoints/instructorManagement";
import { InstructorApiResponse } from "../../../api/types/apiResponses/apiResponseInstructors";
interface Props {
@@ -37,8 +36,8 @@ const ProfileForm: React.FC = ({ editMode, setEditMode }) => {
const fetchInstructor = async () => {
try {
setProfileLoading(true);
- const response = await getIndividualInstructors("fromProfile");
- setInstructor(response?.data?.data);
+ const response = await getInstructorDetails();
+ setInstructor(response?.data);
setProfileLoading(false);
} catch (error) {
setProfileLoading(false);
diff --git a/client/src/constants/endpoints.ts b/client/src/constants/endpoints.ts
index 8517a2d..5304120 100644
--- a/client/src/constants/endpoints.ts
+++ b/client/src/constants/endpoints.ts
@@ -51,6 +51,7 @@ const END_POINTS = {
GET_GRAPH_DATA_ADMIN:"api/admin/graph-data",
INSTRUCTOR_CHANGE_PASSWORD:"api/instructors/change-password",
INSTRUCTOR_UPDATE_PROFILE:"api/instructors/update-profile",
- GET_MY_STUDENTS:"api/instructors/get-students-by-instructor"
+ GET_MY_STUDENTS:"api/instructors/get-students-by-instructor",
+ GET_INSTRUCTOR_DETAILS:"api/instructors/get-instructor-details"
}
export default END_POINTS
\ No newline at end of file
diff --git a/server/src/adapters/controllers/instructorController.ts b/server/src/adapters/controllers/instructorController.ts
index 3ae1ece..76220a8 100644
--- a/server/src/adapters/controllers/instructorController.ts
+++ b/server/src/adapters/controllers/instructorController.ts
@@ -143,10 +143,7 @@ const instructorController = (
const getInstructorById = asyncHandler(
async (req: CustomRequest, res: Response) => {
- let instructorId =
- req.params.instructorId === 'fromProfile'
- ? req.user?.Id ?? ''
- : req.params.instructorId;
+ let instructorId = req.params.instructorId;
const response = await getInstructorByIdUseCase(
instructorId,
cloudService,
@@ -215,6 +212,23 @@ const instructorController = (
}
);
+ const getInstructorDetails = asyncHandler(
+ async (req: CustomRequest, res: Response) => {
+ const instructorId = req.user?.Id;
+ const instructor = await getInstructorByIdUseCase(
+ instructorId ?? '',
+ cloudService,
+ dbRepositoryInstructor
+ );
+ console.log(instructor);
+ res.status(200).json({
+ status: 'success',
+ message: 'Successfully retrieved all students',
+ data: instructor
+ });
+ }
+ );
+
return {
getInstructorRequests,
verifyInstructor,
@@ -226,7 +240,8 @@ const instructorController = (
getInstructorById,
updateProfile,
changePassword,
- getStudentsForInstructors
+ getStudentsForInstructors,
+ getInstructorDetails
};
};
diff --git a/server/src/frameworks/webserver/routes/instructor.ts b/server/src/frameworks/webserver/routes/instructor.ts
index f203f4c..8bac32e 100644
--- a/server/src/frameworks/webserver/routes/instructor.ts
+++ b/server/src/frameworks/webserver/routes/instructor.ts
@@ -52,10 +52,13 @@ const instructorRouter = () => {
router.get('/get-blocked-instructors', controller.getBlockedInstructor);
+ router.get('/view-instructor/:instructorId', controller.getInstructorById);
+
router.get(
- '/view-instructor/:instructorId',
- // jwtAuthMiddleware,
- controller.getInstructorById
+ '/get-instructor-details',
+ jwtAuthMiddleware,
+ instructorRoleCheckMiddleware,
+ controller.getInstructorDetails
);
router.put(
From d9493a05bf05fca902057f0a268c732f6e49e5d4 Mon Sep 17 00:00:00 2001
From: Abin
Date: Mon, 24 Jul 2023 18:28:35 +0530
Subject: [PATCH 4/4] image issues fixed
---
client/src/api/types/student/student.ts | 18 ++++++++
.../ViewBlockedInstructors.tsx | 4 +-
.../ViewInstructorRequests.tsx | 2 -
.../InstructorManagement/ViewInstructors.tsx | 4 +-
.../pages/instructors/MyStudents.tsx | 18 +-------
.../studentManagement/BlockedStudents.tsx | 30 +++++++++----
.../pages/studentManagement/ViewStudents.tsx | 44 +++++++++++++------
client/src/constants/common.ts | 1 +
.../controllers/instructorController.ts | 5 ++-
.../adapters/controllers/studentController.ts | 4 +-
.../management/instructorManagement.ts | 10 +++++
.../usecases/management/studentManagement.ts | 25 ++++++++++-
.../repositories/studentsRepoMongoDb.ts | 4 +-
server/src/types/studentInterface.ts | 1 +
14 files changed, 117 insertions(+), 53 deletions(-)
diff --git a/client/src/api/types/student/student.ts b/client/src/api/types/student/student.ts
index c4e4405..1ee151c 100644
--- a/client/src/api/types/student/student.ts
+++ b/client/src/api/types/student/student.ts
@@ -9,3 +9,21 @@ export interface UpdateProfileInfo {
mobile?: string;
profilePic?: File | null;
}
+
+export interface Students {
+ _id: string;
+ course:string;
+ firstName: string;
+ lastName: string;
+ email: string;
+ mobile: string;
+ dateJoined: string;
+ isGoogleUser:boolean;
+ profilePic:{
+ name:string;
+ url:string;
+ id:string
+ }
+ profileUrl:string;
+ isBlocked: boolean;
+}
\ No newline at end of file
diff --git a/client/src/components/pages/InstructorManagement/ViewBlockedInstructors.tsx b/client/src/components/pages/InstructorManagement/ViewBlockedInstructors.tsx
index ff8ce78..1bb5334 100644
--- a/client/src/components/pages/InstructorManagement/ViewBlockedInstructors.tsx
+++ b/client/src/components/pages/InstructorManagement/ViewBlockedInstructors.tsx
@@ -112,7 +112,7 @@ const ViewBlockedInstructors: React.FC = () => {
(
{
_id,
- img,
+ profileUrl,
firstName,
lastName,
email,
@@ -132,7 +132,7 @@ const ViewBlockedInstructors: React.FC = () => {
{
(
{
_id,
- img,
firstName,
lastName,
email,
dateJoined,
isBlocked,
isVerified,
+ profileUrl,
},
index
) => {
@@ -144,7 +144,7 @@ const ViewInstructors: React.FC = () => {
{
diff --git a/client/src/components/pages/studentManagement/BlockedStudents.tsx b/client/src/components/pages/studentManagement/BlockedStudents.tsx
index e4fabd8..1a68248 100644
--- a/client/src/components/pages/studentManagement/BlockedStudents.tsx
+++ b/client/src/components/pages/studentManagement/BlockedStudents.tsx
@@ -23,16 +23,18 @@ import {
unblockStudent,
} from "../../../api/endpoints/studentManagement";
+import { Students } from "../../../api/types/student/student";
+import { USER_AVATAR } from "../../../constants/common";
const TABLE_HEAD = ["Name", "Email", "Date Joined", "Status", "Actions", ""];
interface Props {
- updated:boolean;
- setUpdated:(val:boolean)=>void
+ updated: boolean;
+ setUpdated: (val: boolean) => void;
}
-const BlockedStudents: React.FC = ({updated,setUpdated}) => {
- const [students, setStudents] = useState([]);
+const BlockedStudents: React.FC = ({ updated, setUpdated }) => {
+ const [students, setStudents] = useState([]);
// const [updated, setUpdated] = useState(false);
- const ITEMS_PER_PAGE = 4;
+ const ITEMS_PER_PAGE = 4;
const {
currentPage,
totalPages,
@@ -110,10 +112,14 @@ const BlockedStudents: React.FC = ({updated,setUpdated}) => {
))}
| | | |
-