diff --git a/Readme.md b/Readme.md index 2f54ec9..313029b 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ ## setup steps 0. Node and other npm , yarn and basic dependacny should be installed on system as per the OS. -1. Clone this repo. +1. Clone this repo. : git@git.krizam.com:krizam/Backend_Assignment1.git 2. Create .env file with below content ``MONGO_URI='mongodb+srv://krishankanhaya0007_db_user:Eo4RwoCE0bv6M1jI@firstcluster.j7g9al2.mongodb.net/'`` diff --git a/src/Sessions/sessions.routes.ts b/src/Sessions/sessions.routes.ts index 70144cb..a1aa364 100644 --- a/src/Sessions/sessions.routes.ts +++ b/src/Sessions/sessions.routes.ts @@ -5,12 +5,8 @@ import { Types } from 'mongoose'; const SessionsRoutes = express.Router(); -// Get All Sessions -SessionsRoutes.get('/', async(req, res) => { - -}) -// Add New User for teacher +// Add New Session for teacher SessionsRoutes.post('/', async(req, res) => { const {teacherId, startTime, endTime } = req.body; @@ -98,7 +94,6 @@ SessionsRoutes.post('/:id/book', async(req: any, res) => { SessionsRoutes.patch('/:id/complete', async(req: any, res) => { const {id} = req.params; - const {userId} = req.body; const existingSession = await Sessions.findOne({_id: id, }); @@ -142,20 +137,20 @@ SessionsRoutes.get('/:id/sessions', async(req,res) => { }, { $facet: { - upcomingSessions: [ - { - $match: { - status: 'BOOKED' + upcomingSessions: [ + { + $match: { + status: 'BOOKED' + } } - } - ], - completedSessions: [ - { - $match: { - status: 'COMPLETED' + ], + completedSessions: [ + { + $match: { + status: 'COMPLETED' + } } - } - ] + ] } } ]); diff --git a/src/index.ts b/src/index.ts index f7bbf80..8b4a9ef 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,7 +21,7 @@ const MONGO_URI = process.env.MONGO_URI!; app.use('/users', UsersRoutes); // Teachers -app.use('/api/teachers', TeachersRoutes); +app.use('/teachers', TeachersRoutes); // Sessions