const express = require( 'express' );
const glob = require( 'glob' );
const path = require( 'path' );
// Classes
const Odmdb = require( '../models/Odmdb.js' );
// Middlewares
const checkHeaders = require( '../middlewares/checkHeaders' );
const isAuthenticated = require( '../middlewares/isAuthenticated' );
const hasAccessrighton = require( '../middlewares/hasAccessrighton' );
const router = express.Router();

router.get('/searchauth/:objectname/:question',checkHeaders,isAuthenticated,( req, res ) => {
    logger.info( 'route referentials get all language' + req.params.objectname + '-' + req.params.question );
    const getref = Referentials.getref( true, req.params.source, req.params.idref, req.session.header.xworkon, req.session.header.xlang );
    // Return any status the data if any erreur return empty object
    res.jsonp( getref.payload.data );
} );

module.exports = router;
