update: removed unused code
This commit is contained in:
@@ -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/'``
|
||||||
|
|
||||||
|
|||||||
@@ -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
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user