🎨 standardJS all files

This commit is contained in:
divlo
2020-08-03 14:14:45 +02:00
parent dc962c9120
commit 4be7a46a10
85 changed files with 3595 additions and 2383 deletions

View File

@ -1,9 +1,14 @@
const Sequelize = require('sequelize')
const { DATABASE } = require('../config/config')
const sequelize = new Sequelize(DATABASE.name, DATABASE.user, DATABASE.password, {
dialect: 'mysql',
host: DATABASE.host
})
const sequelize = new Sequelize(
DATABASE.name,
DATABASE.user,
DATABASE.password,
{
dialect: 'mysql',
host: DATABASE.host
}
)
module.exports = sequelize

View File

@ -12,7 +12,11 @@ const DEFAULT_OPTIONS = {
* @param {*} Model Model Sequelize
* @param {Object} options Options avec clause where etc.
*/
async function getPagesHelper ({ req, res, next }, Model, options = DEFAULT_OPTIONS) {
async function getPagesHelper (
{ req, res, next },
Model,
options = DEFAULT_OPTIONS
) {
const page = helperQueryNumber(req.query.page, 1)
const limit = helperQueryNumber(req.query.limit, 10)
const offset = (page - 1) * limit
@ -23,7 +27,7 @@ async function getPagesHelper ({ req, res, next }, Model, options = DEFAULT_OPTI
...options
})
const { count, rows } = result
const hasMore = (page * limit) < count
const hasMore = page * limit < count
return res.status(200).json({ totalItems: count, hasMore, rows })
} catch (error) {
console.log(error)