{"size": 1461, "ext": "js", "max_stars_repo_path": "src/routes/polices.routes.js", "max_stars_repo_name": "yasmanets/comisarua", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/routes/polices.routes.js", "max_issues_repo_name": "yasmanets/comisarua", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/routes/polices.routes.js", "max_forks_repo_name": "yasmanets/comisarua", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 58.44, "max_line_length": 148, "alphanum_fraction": 0.772073922}
const policeController = require('../controllers/police.controller');
const crypto = require('../middlewares/cypher');
const { Router } = require('express');
const router = Router();
const multer = require('multer');
const path = require('path');
const auth = require('../middlewares/authorization');
const roles = require('../utils/roles');
const cipher = require('../middlewares/cypher');

const upload = multer({ dest: path.join(__dirname, '../../uploads/temp') }).single('file');

router.get('/new', policeController.newPoliceForm);
router.post('/new', crypto.encryptPassword, policeController.newPolice, crypto.generateKeyPair);
router.get('/profile', auth.authorize(roles.police), policeController.informationForm);
router.post('/info', auth.authorize(roles.police), upload, policeController.uploadDocument);
router.get('/personalDocument/:id', auth.authorize(roles.police), policeController.viewDocument);
router.get('/publish', auth.authorize(roles.police), policeController.getAllPolices);
router.post('/publish', auth.authorize(roles.police), upload, policeController.isShared, policeController.uploadPublicInfo, cipher.createSignature);
router.get('/documents', auth.authorize(roles.police), policeController.getPublicDocuments);
router.get('/publicDocument/:id', auth.authorize(roles.police), policeController.viewDocument);
router.get('/verifySignature/:id', auth.authorize(roles.police), policeController.verifySignature)

module.exports = router
