Implemented ESlint and passed down the rules

This commit is contained in:
Alexis
2021-01-20 19:07:56 +01:00
parent 615cced6ed
commit b318a88023
37 changed files with 2119 additions and 568 deletions

View File

@@ -1,5 +1,3 @@
'use strict'
// Router
const express = require('express');
let router = express.Router();
@@ -16,15 +14,15 @@ const MetaSchools = new MetaSchoolRepository();
const getMetaSchools = () => {
return MetaSchools.getAll()
.catch(err => {
console.log(err)
throw err
})
}
console.log(err);
throw err;
});
};
router.get('/', async (req, res) => {
getMetaSchools()
.then(v => {
res.setHeader('Content-Type', 'application/json;charset=utf-8')
res.end(JSON.stringify(v))
res.setHeader('Content-Type', 'application/json;charset=utf-8');
res.end(JSON.stringify(v));
})
.catch(err => {
res.status(err.code).send(JSON.stringify(
@@ -32,24 +30,24 @@ router.get('/', async (req, res) => {
"error": err.message,
"code": err.code
})
)
})
})
);
});
});
// GET ONE ------------------
const getMetaSchool = (id) => {
return MetaSchools.getOne(id)
.catch(err => {
console.log(err)
throw err
})
}
console.log(err);
throw err;
});
};
router.get('/:id/', async (req, res) => {
getMetaSchool(req.params.id)
.then(v => {
res.setHeader('Content-Type', 'application/json;charset=utf-8')
res.end(JSON.stringify(v))
res.setHeader('Content-Type', 'application/json;charset=utf-8');
res.end(JSON.stringify(v));
})
.catch(err => {
res.status(err.code).send(JSON.stringify(
@@ -57,11 +55,11 @@ router.get('/:id/', async (req, res) => {
"error": err.message,
"code": err.code
})
)
})
})
);
});
});
// Param validations
router.param('id', functions.paramIntCheck)
router.param('id', functions.paramIntCheck);
module.exports = router
module.exports = router;