aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/middlewares/sort.js
blob: f0b7274eba11ea244a600f6e0037bef71e0793e6 (plain) (tree)
1
2
3
4
5
6
7


                        

               

 





                                                      








                                                                              
'use strict'

const sortMiddleware = {
  setUsersSort,
  setVideosSort
}

function setUsersSort (req, res, next) {
  if (!req.query.sort) req.query.sort = '-createdDate'

  return next()
}

function setVideosSort (req, res, next) {
  if (!req.query.sort) req.query.sort = '-createdDate'

  return next()
}

// ---------------------------------------------------------------------------

module.exports = sortMiddleware