update: removed unused code

This commit is contained in:
krizam
2026-10-20 02:55:26 +05:30
parent 4ac74b8481
commit 4d937b92da
3 changed files with 15 additions and 20 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
## setup steps ## setup steps
0. Node and other npm , yarn and basic dependacny should be installed on system as per the OS. 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 2. Create .env file with below content
``MONGO_URI='mongodb+srv://krishankanhaya0007_db_user:Eo4RwoCE0bv6M1jI@firstcluster.j7g9al2.mongodb.net/'`` ``MONGO_URI='mongodb+srv://krishankanhaya0007_db_user:Eo4RwoCE0bv6M1jI@firstcluster.j7g9al2.mongodb.net/'``
+13 -18
View File
@@ -5,12 +5,8 @@ import { Types } from 'mongoose';
const SessionsRoutes = express.Router(); const SessionsRoutes = express.Router();
// Get All Sessions
SessionsRoutes.get('/', async(req, res) => {
}) // Add New Session for teacher
// Add New User for teacher
SessionsRoutes.post('/', async(req, res) => { SessionsRoutes.post('/', async(req, res) => {
const {teacherId, startTime, endTime } = req.body; 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) => { SessionsRoutes.patch('/:id/complete', async(req: any, res) => {
const {id} = req.params; const {id} = req.params;
const {userId} = req.body;
const existingSession = await Sessions.findOne({_id: id, }); const existingSession = await Sessions.findOne({_id: id, });
@@ -142,20 +137,20 @@ SessionsRoutes.get('/:id/sessions', async(req,res) => {
}, },
{ {
$facet: { $facet: {
upcomingSessions: [ upcomingSessions: [
{ {
$match: { $match: {
status: 'BOOKED' status: 'BOOKED'
}
} }
} ],
], completedSessions: [
completedSessions: [ {
{ $match: {
$match: { status: 'COMPLETED'
status: 'COMPLETED' }
} }
} ]
]
} }
} }
]); ]);
+1 -1
View File
@@ -21,7 +21,7 @@ const MONGO_URI = process.env.MONGO_URI!;
app.use('/users', UsersRoutes); app.use('/users', UsersRoutes);
// Teachers // Teachers
app.use('/api/teachers', TeachersRoutes); app.use('/teachers', TeachersRoutes);
// Sessions // Sessions