-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from advanced-computer-lab-2023/task_42_43
Task 42 43
- Loading branch information
Showing
10 changed files
with
199 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
import express, { Request, Response } from 'express'; | ||
|
||
import controller from '../controllers'; | ||
import { getMyPatients } from '../services'; | ||
import { addHealthRecord, getHealthRecords, getMyPatients } from '../services'; | ||
import { isAuthenticated, isAuthorized } from '../middlewares'; | ||
|
||
const router = express.Router(); | ||
|
||
router.use(isAuthenticated); | ||
router.use(isAuthorized('Doctor')); | ||
|
||
router.get('/:id/medicalhistory', (req: Request, res: Response) => { | ||
// controller(res)()(); | ||
}); | ||
|
||
router.get('/:id', (req: Request, res: Response) => { | ||
controller(res)(getMyPatients)({ doctorID: req.decoded.id, patientID: req.params.id }); | ||
}); | ||
router.get('/', (req: Request, res: Response) => { | ||
controller(res)(getMyPatients)({ doctorID: req.decoded.id }); | ||
}); | ||
|
||
router.post('/:id/medicalhistory', (req: Request, res: Response) => { | ||
// Handle medical history update logic here | ||
// notice that doctors can update patients medical history | ||
// controller(res)()(); | ||
router.get('/:id/medicalhistory', isAuthorized('Doctor'), (req: Request, res: Response) => { | ||
controller(res)(getHealthRecords)(req.params.id); | ||
}); | ||
|
||
router.post('/:id/medicalhistory', isAuthorized('Doctor'), (req: Request, res: Response) => { | ||
controller(res)(addHealthRecord)(req.params.id, req.body); | ||
}); | ||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters