getAllMarketjobs
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ const ebroker = require('../service/ebroker');
|
||||
|
||||
var controllers = {
|
||||
getMarketJobs: function(req, res) {
|
||||
jobs.getmarketjobs(req, res, function(err, result) {
|
||||
jobs.getAllMarketjobs(req, res, function(err, result) {
|
||||
res.status(200).json({'status': 'OK', 'internal_return': 0, 'result_list': result.result,'total_record': result.total_record })
|
||||
});
|
||||
},
|
||||
|
||||
@@ -5,6 +5,47 @@ const db = require('../app/db')
|
||||
const logger = require('../app/logger');
|
||||
|
||||
var jobs = {
|
||||
getAllMarketjobs: function (req, res, next) {
|
||||
|
||||
//console.log("REQ---->",req.body.uid);
|
||||
logger.info("------lll---->");
|
||||
logger.info(req.query);
|
||||
var data = {
|
||||
"limit": (req.query.limit != null && req.query.limit !== "") ? req.query.limit : 60,
|
||||
"page": req.query.page
|
||||
};
|
||||
let Qstring =""; // "SELECT uid,id,username FROM members LIMIT 10";
|
||||
let QextraString ="";
|
||||
|
||||
Qstring = " SELECT j.title,j.description,m.id AS job_id,m.expire,m.job_description,j.price, m.depend_uid AS offer_depend_uid, " +
|
||||
" m.offer_code,j.timeline_days, to_char(m.expire, 'Dy Mon dd, yyyy HH:MI AM') AS expire2," +
|
||||
" m.uid AS offer_uid,j.uid AS job_uid,m.added::date AS offer_added,j.country AS job_country, " +
|
||||
" c.code AS currency_code, c.description AS currency_description,j.country, j.category,mb.uid AS market_uid, 0 AS interest_count " +
|
||||
" FROM members_jobs_offer m " +
|
||||
" LEFT JOIN members_jobs j ON j.id=m.job_id " +
|
||||
" LEFT JOIN members mb ON mb.id = m.member_id " +
|
||||
" LEFT JOIN currency c ON c.country=j.country " +
|
||||
" WHERE m.status = 1 AND m.client_id=0 " +
|
||||
" AND m.expire IS NOT NULL " +
|
||||
" AND m.public_view = 1 AND m.expire> now() AND j.status = 1 " + QextraString +
|
||||
" ORDER BY m.expire DESC LIMIT "+ data.limit;
|
||||
|
||||
// logger.info(Qstring);
|
||||
db.query(Qstring, function (err, result) {
|
||||
try {
|
||||
if (err) throw err;
|
||||
let resultItem ={
|
||||
"result": result.rows,
|
||||
"total_record": result.rowCount
|
||||
}
|
||||
// logger.info(result);
|
||||
next(null, resultItem); // pass control to the next handler
|
||||
// next(null, result.rows); // pass control to the next handler
|
||||
} catch (e) {
|
||||
next(e.message, null); // pass control to the next handler
|
||||
}
|
||||
});
|
||||
},
|
||||
getmarketjobs: function (req, res, next) {
|
||||
|
||||
//console.log("REQ---->",req.body.uid);
|
||||
|
||||
Reference in New Issue
Block a user