From 2d0b8ee54e0df632af3a414ee6390c1d557ae94e Mon Sep 17 00:00:00 2001 From: kygchng Date: Wed, 6 Dec 2023 13:14:59 -0500 Subject: [PATCH] add route for getting student and lesson number from teacher email, populate phonetics table --- client/src/Admin/StudentCard.tsx | 2 + client/src/App.tsx | 2 +- client/src/{ => Teacher}/TeacherDashboard.tsx | 17 +- client/src/Teacher/TeacherPhoneticsTable.tsx | 199 ++++++++++++ client/src/components/LessonLevels.tsx | 5 - .../src/components/buttons/PhoneticsTable.tsx | 296 ------------------ client/src/util/types/student.ts | 2 +- server/src/controllers/school.controller.ts | 9 +- server/src/controllers/student.controller.ts | 73 +++++ server/src/controllers/user.controller.ts | 12 +- server/src/routes/student.route.ts | 11 + server/src/routes/user.route.ts | 9 +- server/src/services/coach.service.ts | 2 +- server/src/services/user.service.ts | 4 +- 14 files changed, 323 insertions(+), 320 deletions(-) rename client/src/{ => Teacher}/TeacherDashboard.tsx (90%) create mode 100644 client/src/Teacher/TeacherPhoneticsTable.tsx delete mode 100644 client/src/components/buttons/PhoneticsTable.tsx diff --git a/client/src/Admin/StudentCard.tsx b/client/src/Admin/StudentCard.tsx index 7b4275d4..239e97fb 100644 --- a/client/src/Admin/StudentCard.tsx +++ b/client/src/Admin/StudentCard.tsx @@ -11,8 +11,10 @@ type StudentCardProps = { function StudentCardFromID({ studentID, lesson }: StudentCardProps) { const navigate = useNavigate(); + console.log('inside student card studentID', studentID); const user = useData(`user/${studentID}`); + console.log('inside student card user', user); let label = 'Name'; if (user) { const info = user.data; diff --git a/client/src/App.tsx b/client/src/App.tsx index 8c4538da..77dd77f8 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -29,7 +29,7 @@ import EmailResetPasswordPage from './Authentication/EmailResetPasswordPage'; import ResetPasswordPage from './Authentication/ResetPasswordPage'; import AlertPopup from './components/AlertPopup'; import InviteRegisterPage from './Authentication/InviteRegisterPage'; -import TeacherDashboard from './TeacherDashboard'; +import TeacherDashboard from './Teacher/TeacherDashboard'; import OnboardingPage from './Authentication/OnboardingPage'; import StudentResourceDashboard from './Admin/StudentResourceDashboard'; import LessonResourceDashboard from './Admin/LessonResourceDashboard'; diff --git a/client/src/TeacherDashboard.tsx b/client/src/Teacher/TeacherDashboard.tsx similarity index 90% rename from client/src/TeacherDashboard.tsx rename to client/src/Teacher/TeacherDashboard.tsx index 8670d8d3..79e0a697 100644 --- a/client/src/TeacherDashboard.tsx +++ b/client/src/Teacher/TeacherDashboard.tsx @@ -9,13 +9,13 @@ import { styled } from '@mui/system'; import { useNavigate, useParams } from 'react-router-dom'; // eslint-disable-next-line import { Grid } from '@mui/material'; -import { useData } from './util/api'; -import { useAppSelector } from './util/redux/hooks'; -import { selectUser } from './util/redux/userSlice'; -import { StudentCardFromID } from './Admin/StudentCard'; -import PageHeader from './components/PageHeader'; -import PhoneticsTable from './components/buttons/PhoneticsTable'; -import LessonLevels from './components/LessonLevels'; +import { useData } from '../util/api'; +import { useAppSelector } from '../util/redux/hooks'; +import { selectUser } from '../util/redux/userSlice'; +import { StudentCardFromID } from '../Admin/StudentCard'; +import PageHeader from '../components/PageHeader'; +import LessonLevels from '../components/LessonLevels'; +import TeacherPhoneticsTable from './TeacherPhoneticsTable'; const ScrollableBox = styled(Box)({ overflowY: 'auto', @@ -79,6 +79,7 @@ function SplitGrid() { const self = useAppSelector(selectUser); const students = useData(`student/students-by-teacher/${self.email}`); const studentData = students?.data ?? []; + console.log('splitgrid', studentData); const academicFlags = studentData.filter( (student: any) => student.progressFlag, @@ -144,7 +145,7 @@ function SplitGrid() { - + diff --git a/client/src/Teacher/TeacherPhoneticsTable.tsx b/client/src/Teacher/TeacherPhoneticsTable.tsx new file mode 100644 index 00000000..450b9e01 --- /dev/null +++ b/client/src/Teacher/TeacherPhoneticsTable.tsx @@ -0,0 +1,199 @@ +import React, { useEffect, useState } from 'react'; +import CircularProgress from '@mui/material/CircularProgress'; +import { PaginationTable, TColumn } from '../components/PaginationTable'; +import { useData } from '../util/api'; +import { useAppSelector } from '../util/redux/hooks'; +import { selectUser } from '../util/redux/userSlice'; +import IUser from '../util/types/user'; + +interface PhoneticsTableRow { + key: string; + phonetic_pattern: string; + students: string; +} + +// phonetics +const phonicPatterns = [ + 'D', + 'G', + 'L', + 'H', + 'R', + 'N', + 'B', + 'C', + 'F', + 'M', + 'T', + 'P', + 'V', + 'K', + 'J', + 'W', + 'X', + 'Q', + 'Y', + 'Z', + 'at & ad', + 'ag & ap', + 'at & it', + 'ap & ip', + 'at; an; ad; ap', + 'am; ag; ab; ax', + 'ig; ip; it; in', + 'ill; id; im; is/iss', + 'ug; ut; un; um', + 'ud; up; us', + 'eg; ed; et; en', + 'ot; ob; og; op', + 'ck', + 'gl; bl; sl; pl; fl; cl', + 'pr; gr; tr; br', + 'fr; dr; cr', + 'sn; sw; sm; sc', + 'sp; st; sk', + 'nk; nd; nt; ng', + 'lt; mp; ft', + 'sh; th; wh', + 'ch; tch', + 'dge', + 'a_e vs. aa', + 'i_e vs. i', + 'o_e vs. o; u_e vs. u', + 'Soft sounds of c and g', + 'ar; or', + 'ir; ur; er', + 'w+or; w+ar', + 'ai; ay', + '', + 'oa; ow; oe', + 'ee; ea', + 'ey; ie', + 'igh; ie', + 'vowel sounds of y', + 'ou; ow', + 'aw; au', + 'oy; oi', + 'oo', + 'sounds of long u', + 'kn; wr; gn; mb', +]; +const exampleWords = [ + 'Sound of D', + 'Sound of G', + 'Sound of L', + 'Sound of H', + 'Sound of R', + 'Sound of N', + 'Sound of B', + 'Sound of C', + 'Sound of F', + 'Sound of M', + 'Sound of T', + 'Sound of P', + 'Sound of V', + 'Sound of K', + 'Sound of J', + 'Sound of W', + 'Sound of X', + 'Sound of Q', + 'Sound of Y', + 'Sound of Z', + 'hat; had', + 'sag; sap', + 'pat; pit', + 'lap; lip', + 'cat; fan; mad; sap', + 'ham; sag; lab; fax', + 'big; dip; pit; win', + 'Jill; lid; him; miss', + 'bug; nut; fun; yum', + 'mud; pup; Gus', + 'leg; bed; pet; hen', + 'not; job; dog; hop', + 'duck; rock; pick’ back', + 'glad; block; sled; plus; flip; clot', + 'pram; grass; tree; brick', + 'frog; drum; crab', + 'snap; swim; smile; scale', + 'spin; stop; desk; skate', + 'pink; sand; tent; king', + 'belt; jump; raft', + 'shell; thin; whip', + 'chin; hatch', + 'edge; bridge', + 'tape vs. tap; cape vs. cap', + 'kite vs. kit; pine vs. pin', + 'code vs. cod; cube vs. cub; here vs. her', + 'city; ice; cage; gem', + 'scarf; fork', + 'bird; purse; fern', + 'word; warm', + 'rain; gray', + '', + 'coat; snow; toe', + 'teeth; seal', + 'donkey; field', + 'night; pie', + 'fly; baby; myth', + 'cloud; plow', + 'draw; sauce', + 'boy; coin', + 'book; moon', + 'cube; tube', + 'knee; sign; write; bomb', +]; + +function TeacherPhoneticsTable() { + const columns: TColumn[] = [ + { id: 'phonetic_pattern', label: 'Phonetic Pattern', minWidth: 100 }, + { id: 'example_word', label: 'Example Word', minWidth: 100 }, + { id: 'students', label: 'Students', minWidth: 200 }, + ]; + + const [phoneticsTableRows, setPhoneticsTableRows] = useState< + PhoneticsTableRow[] + >([]); + + const self = useAppSelector(selectUser); + const studentsData = useData( + `student/students-lessons-by-teacher/${self.email}`, + ); + + console.log('phonetics table', studentsData); + + useEffect(() => { + if (studentsData?.data) { + const phoneticsRows: PhoneticsTableRow[] = phonicPatterns.map( + (pattern, index) => { + // Get students whose lesson number aligns with the index of the phonic pattern (adjust for indexing) + const studentsForPattern = studentsData.data + .filter((student: any) => student.lessonNumber - 1 === index) + .map((student: any) => `${student.firstName} ${student.lastName}`) + .join(', '); + + return { + key: `row-${index}`, + phonetic_pattern: pattern, + example_word: exampleWords[index], + students: studentsForPattern, + }; + }, + ); + + setPhoneticsTableRows(phoneticsRows); + } + }, [studentsData]); + + if (!phoneticsTableRows.length) { + return ( +
+ +
+ ); + } + + return ; +} + +export default TeacherPhoneticsTable; diff --git a/client/src/components/LessonLevels.tsx b/client/src/components/LessonLevels.tsx index ae26cb00..431e8e69 100644 --- a/client/src/components/LessonLevels.tsx +++ b/client/src/components/LessonLevels.tsx @@ -29,9 +29,6 @@ function LessonLevels() { const self = useAppSelector(selectUser); const tempId = useData(`user/email/${self.email}`); const id = tempId?.data ?? null; - - console.log("self.email", self.email); - console.log("id", id); const [labels, setLabels] = useState([]); const [data, setData] = useState([]); @@ -42,8 +39,6 @@ function LessonLevels() { `http://localhost:4000/api/teacher/lesson-levels/${id}`, ); - console.log(res.data) - let max = 0; Object.keys(res.data).forEach((level: string) => { if (Number(level) > max) { diff --git a/client/src/components/buttons/PhoneticsTable.tsx b/client/src/components/buttons/PhoneticsTable.tsx deleted file mode 100644 index 117c8410..00000000 --- a/client/src/components/buttons/PhoneticsTable.tsx +++ /dev/null @@ -1,296 +0,0 @@ -/** - * A file that contains all the components and logic for the table of users - * in the AdminDashboardPage. - */ -import React, { useEffect, useState } from 'react'; -import CircularProgress from '@mui/material/CircularProgress'; -import Box from '@mui/material/Box'; -import { PaginationTable, TColumn } from '../PaginationTable'; -import { useData } from '../../util/api'; -import { useAppSelector } from '../../util/redux/hooks'; -import { selectUser } from '../../util/redux/userSlice'; -import IStudent from '../../util/types/student'; -import IUser from '../../util/types/user'; -import ILesson from '../../util/types/lesson'; -// import { Button } from '@mui/material'; - -interface PhoneticsTableRow { - key: string; - phonetic_pattern: string; - students: string; -} - -/** - * The standalone table component for holding information about the users in - * the database and allowing admins to remove users and promote users to admins. - */ -function PhoneticsTable() { - // phonetics - const phonicPatterns = [ - 'D', - 'G', - 'L', - 'H', - 'R', - 'N', - 'B', - 'C', - 'F', - 'M', - 'T', - 'P', - 'V', - 'K', - 'J', - 'W', - 'X', - 'Q', - 'Y', - 'Z', - 'at & ad', - 'ag & ap', - 'at & it', - 'ap & ip', - 'at; an; ad; ap', - 'am; ag; ab; ax', - 'ig; ip; it; in', - 'ill; id; im; is/iss', - 'ug; ut; un; um', - 'ud; up; us', - 'eg; ed; et; en', - 'ot; ob; og; op', - 'ck', - 'gl; bl; sl; pl; fl; cl', - 'pr; gr; tr; br', - 'fr; dr; cr', - 'sn; sw; sm; sc', - 'sp; st; sk', - 'nk; nd; nt; ng', - 'lt; mp; ft', - 'sh; th; wh', - 'ch; tch', - 'dge', - 'a_e vs. aa', - 'i_e vs. i', - 'o_e vs. o; u_e vs. u', - 'Soft sounds of c and g', - 'ar; or', - 'ir; ur; er', - 'w+or; w+ar', - 'ai; ay', - '', - 'oa; ow; oe', - 'ee; ea', - 'ey; ie', - 'igh; ie', - 'vowel sounds of y', - 'ou; ow', - 'aw; au', - 'oy; oi', - 'oo', - 'sounds of long u', - 'kn; wr; gn; mb', - ]; - const exampleWords = [ - 'Sound of D', - 'Sound of G', - 'Sound of L', - 'Sound of H', - 'Sound of R', - 'Sound of N', - 'Sound of B', - 'Sound of C', - 'Sound of F', - 'Sound of M', - 'Sound of T', - 'Sound of P', - 'Sound of V', - 'Sound of K', - 'Sound of J', - 'Sound of W', - 'Sound of X', - 'Sound of Q', - 'Sound of Y', - 'Sound of Z', - 'hat; had', - 'sag; sap', - 'pat; pit', - 'lap; lip', - 'cat; fan; mad; sap', - 'ham; sag; lab; fax', - 'big; dip; pit; win', - 'Jill; lid; him; miss', - 'bug; nut; fun; yum', - 'mud; pup; Gus', - 'leg; bed; pet; hen', - 'not; job; dog; hop', - 'duck; rock; pick’ back', - 'glad; block; sled; plus; flip; clot', - 'pram; grass; tree; brick', - 'frog; drum; crab', - 'snap; swim; smile; scale', - 'spin; stop; desk; skate', - 'pink; sand; tent; king', - 'belt; jump; raft', - 'shell; thin; whip', - 'chin; hatch', - 'edge; bridge', - 'tape vs. tap; cape vs. cap', - 'kite vs. kit; pine vs. pin', - 'code vs. cod; cube vs. cub; here vs. her', - 'city; ice; cage; gem', - 'scarf; fork', - 'bird; purse; fern', - 'word; warm', - 'rain; gray', - '', - 'coat; snow; toe', - 'teeth; seal', - 'donkey; field', - 'night; pie', - 'fly; baby; myth', - 'cloud; plow', - 'draw; sauce', - 'boy; coin', - 'book; moon', - 'cube; tube', - 'knee; sign; write; bomb', - ]; - - const levels = []; - - for (let i = 0; i < phonicPatterns.length; i += 1) { - levels.push([phonicPatterns[i], exampleWords[i]]); - } - - // define columns for the table - const columns: TColumn[] = [ - { id: 'phonetic_pattern', label: 'Phonetic Pattern' }, - { id: 'students', label: 'Students' }, - ]; - - const [userList, setUserList] = useState([]); - const users = useData('admin/all'); - const self = useAppSelector(selectUser); - - const [studentList, setStudentList] = useState([]); - - const [rows, setRows] = useState([]); - - const [lessonList, setLessonList] = useState([]); - const lessons = useData('lesson/all'); - - // list of all students with the teacher_id - const students = useData(`student/students-by-teacher/${self.email}`); - - useEffect(() => { - if (users) { - const userData = users.data ?? []; - setUserList(userData); - } - if (students) { - const studentData = students.data ?? []; - setStudentList(studentData); - } - if (lessons) { - const lessonData = lessons.data ?? []; - setLessonList(lessonData); - } - }, [users, students, lessons]); - - function createRows() { - // create a map: lesson level (convert the lesson level (string) to an int) to a list of student names - const idNameMapping = new Map(); - userList.map((user: IUser) => - // eslint-disable-next-line - idNameMapping.set(user._id, `${user.firstName} ${user.lastName}`), - ); - const idNumberMapping = new Map(); - lessonList.map((lesson: ILesson) => - // eslint-disable-next-line - idNumberMapping.set(lesson._id, lesson.number), - ); - - const levelToStudents = new Map(); - // eslint-disable-next-line - studentList.map((student: IStudent) => { - const lessonID = student.lesson_level; - let lessonNum = idNumberMapping.get(lessonID); - if (!lessonNum) { - lessonNum = 1; - } - // const levelNameParsed = student.lesson_level.split(' '); - // const lessonLevelInt = Number(levelNameParsed[1]); - let tempArray = levelToStudents.get(lessonNum); - if (!tempArray) { - tempArray = []; - } - let name = idNameMapping.get(student.user_id); - if (!name) { - name = ''; - } - tempArray.push(name); - // eslint-disable-next-line - levelToStudents.set(lessonNum, tempArray); - }); - // eslint-disable-next-line - const rows: PhoneticsTableRow[] = []; - - let level = 1; - // eslint-disable-next-line - phonicPatterns.map((pattern: string) => { - // eslint-disable-next-line - let studentsByLevel = levelToStudents.get(level); - if (!studentsByLevel) { - studentsByLevel = []; - } - let studentString = ''; - studentsByLevel.map( - // eslint-disable-next-line - (studentStr: string) => (studentString += `${studentStr}, `), - ); - studentString = studentString.substring(0, studentString.length - 2); - const row: PhoneticsTableRow = { - key: level.toString(), - phonetic_pattern: pattern, - students: studentString, - }; - level += 1; - rows.push(row); - }); - - // levelToStudents.forEach((value: string[], key: number) => { - // //key is the lesson level - // //get the phonetic for each key - // let row: PhoneticsTableRow = { - // key: key.toString(), - // phonetic_pattern: phonicPatterns[key - 1], - // students: value, - // }; - // rows.push(row); - // }); - setRows(rows); - } - - useEffect(() => { - createRows(); - console.log('created'); - }); - - // if the userlist is not yet populated, display a loading spinner - if (!userList) { - return ( -
- -
- ); - } - - return ( - - - - ); -} - -export default PhoneticsTable; diff --git a/client/src/util/types/student.ts b/client/src/util/types/student.ts index 955d2261..04c67c1b 100644 --- a/client/src/util/types/student.ts +++ b/client/src/util/types/student.ts @@ -20,7 +20,7 @@ interface IStudent { media_waiver: boolean; work_habits: string; grade: string; - progressFlag: boolean; + attendanceFlag: boolean; academicFlag: boolean; admin_updates: string; family: string; diff --git a/server/src/controllers/school.controller.ts b/server/src/controllers/school.controller.ts index 48c42157..01f882af 100644 --- a/server/src/controllers/school.controller.ts +++ b/server/src/controllers/school.controller.ts @@ -201,4 +201,11 @@ const updateSchool = async ( res.status(StatusCode.OK).send(school); }; -export { getAllResources, getSchool, getAllSchools, createSchool, deleteSchool, updateSchool }; \ No newline at end of file +export { + getAllResources, + getSchool, + getAllSchools, + createSchool, + deleteSchool, + updateSchool, +}; diff --git a/server/src/controllers/student.controller.ts b/server/src/controllers/student.controller.ts index 8ed2e8bd..a1f46d08 100644 --- a/server/src/controllers/student.controller.ts +++ b/server/src/controllers/student.controller.ts @@ -343,6 +343,7 @@ const getStudentsByTeacherID = async ( return studentIdSet.has(studentUser._id.toString()); }, ); + console.log('list', newStudentUserList); res.status(StatusCode.OK).send(newStudentUserList); }) .catch((e) => { @@ -361,6 +362,77 @@ const getStudentsByTeacherID = async ( }); }; +const getStudentsAndLessonsByTeacherEmail = async ( + req: express.Request, + res: express.Response, + next: express.NextFunction, +) => { + const { email } = req.params; + if (!email) { + next(ApiError.internal('Request must include a valid teacher email param')); + } + return getUserByEmail(email) + .then((user) => { + getAllStudentsFromDB() + .then((studentList) => { + if (!user) { + next(ApiError.internal('Unable to retrieve specified teacher')); + return; + } + const teacherStudentList = studentList.filter((student) => { + if (!student.teacher_id) { + return false; + } + return student.teacher_id.includes(user._id); + }); + + const lessonPromises = teacherStudentList.map((student) => + getLessonById(student.lesson_level), + ); + const userPromises: any = teacherStudentList.map((student) => + getUserById(student.user_id), + ); + Promise.all(lessonPromises) + .then((lessons) => { + Promise.all(userPromises) + .then((users) => { + const response = teacherStudentList.map((student, index) => { + const user = users[index]; + const lesson = lessons[index]; + console.log('student', student); + return { + studentId: student._id, + firstName: user?.firstName, + lastName: user?.lastName, + academicFlag: student.progressFlag, // todo: change to academicFlag (IStudent) but current Mongo documents show progressFlag + // attendanceFlag: student.attendanceFlag, + lessonNumber: lesson?.number, + }; + }); + console.log(response); + res.status(StatusCode.OK).send(response); + }) + .catch((err) => { + console.log(err); + next(ApiError.internal('Unable to retrieve users')); + }); + }) + .catch((err) => { + console.log(err); + next(ApiError.internal('Unable to retrieve lessons')); + }); + }) + .catch((e) => { + console.log(e); + next(ApiError.internal('Unable to retrieve students')); + }); + }) + .catch((e) => { + console.log(e); + next(ApiError.internal('Unable to retrieve specified teacher')); + }); +}; + /** * Get all students from the database. Upon success, send the a list of all students in the res body with 200 OK status code. */ @@ -848,6 +920,7 @@ export { getAdditionalStudentResources, deleteResource, addResource, + getStudentsAndLessonsByTeacherEmail, getAllStudents, updateStudentAttendance, createStudentAttendanceByDate, diff --git a/server/src/controllers/user.controller.ts b/server/src/controllers/user.controller.ts index 189f8aa4..479200dc 100644 --- a/server/src/controllers/user.controller.ts +++ b/server/src/controllers/user.controller.ts @@ -5,7 +5,13 @@ import express from 'express'; import ApiError from '../util/apiError'; import StatusCode from '../util/statusCode'; -import { getUserById, getAllTeachersFromDB, updateUser, getUserByEmail, getUserIdByEmail } from '../services/user.service'; +import { + getUserById, + getAllTeachersFromDB, + updateUser, + getUserByEmail, + getUserIdByEmail, +} from '../services/user.service'; // get a specific user by id const getUser = async ( @@ -82,11 +88,11 @@ const getUserEmail = async ( return ( getUserIdByEmail(email) - .then((id : any) => { + .then((id: any) => { res.status(StatusCode.OK).send(id); }) // eslint-disable-next-line @typescript-eslint/no-unused-vars - .catch((e : any) => { + .catch((e: any) => { next(ApiError.internal('Unable to retrieve specified user')); }) ); diff --git a/server/src/routes/student.route.ts b/server/src/routes/student.route.ts index 2a9f0c51..2fd4b7ab 100644 --- a/server/src/routes/student.route.ts +++ b/server/src/routes/student.route.ts @@ -13,6 +13,7 @@ import { getStudentsByTeacherID, deleteResource, addResource, + getStudentsAndLessonsByTeacherEmail, getAllStudents, getStudentsFromTeacherId, getStudent, @@ -113,6 +114,16 @@ router.get('/teacher/:id', isAuthenticated, getStudentsFromTeacherId); router.get('/student/:id', isAuthenticated, getStudent); +/** + * A GET route to get all students by a teacher's email and all of their additional information (user and lesson) + * Checks first if the requestor is authenticated or an admin + */ +router.get( + '/students-lessons-by-teacher/:email', + isAuthenticated, + getStudentsAndLessonsByTeacherEmail, +); + /** * A GET route to get all students and all of their additional information (user and lesson) * Checks first if the requestor is authenticated or an admin diff --git a/server/src/routes/user.route.ts b/server/src/routes/user.route.ts index 185045bf..0a244b3d 100644 --- a/server/src/routes/user.route.ts +++ b/server/src/routes/user.route.ts @@ -4,7 +4,12 @@ */ import express from 'express'; import { isAdmin } from '../controllers/admin.middleware'; -import { getUser, getAllTeachers, putUser, getUserEmail } from '../controllers/user.controller'; +import { + getUser, + getAllTeachers, + putUser, + getUserEmail, +} from '../controllers/user.controller'; import { isAuthenticated } from '../controllers/auth.middleware'; import 'dotenv/config'; @@ -26,7 +31,7 @@ userRouter.get('/:id', getUser); userRouter.get('/email/:email', getUserEmail); /** -* A PUT route to put a user by their ID + * A PUT route to put a user by their ID */ userRouter.put('/:id', putUser); diff --git a/server/src/services/coach.service.ts b/server/src/services/coach.service.ts index b4ab62b8..ee3e8e9a 100644 --- a/server/src/services/coach.service.ts +++ b/server/src/services/coach.service.ts @@ -1,9 +1,9 @@ /* eslint-disable camelcase */ +import mongoose from 'mongoose'; import { Coach, ICoach } from '../models/coach.model'; import { IStudent, Student } from '../models/student.model'; import { getAllBlocksfromDB } from './block.service'; import { IBlock } from '../models/block.model'; -import mongoose from 'mongoose'; import { User } from '../models/user.model'; /** diff --git a/server/src/services/user.service.ts b/server/src/services/user.service.ts index 5684ab55..6d8d4f27 100644 --- a/server/src/services/user.service.ts +++ b/server/src/services/user.service.ts @@ -65,8 +65,8 @@ const getUserByEmail = async (email: string) => { /** * Get a user's ID from the database by their email - * @param email - * @returns + * @param email + * @returns */ const getUserIdByEmail = async (email: string) => { const user = await User.findOne({ email })