Update transactionController.js
This commit is contained in:
@@ -140,7 +140,7 @@ module.exports.get_all_transactions_for_agent = [
|
||||
async (req, res) => {
|
||||
try {
|
||||
const { agent_id } = req
|
||||
const transactions = await Transaction.find({ agent_id })
|
||||
const transactions = await Transaction.find({ agent_id }).sort({created_at:-1})
|
||||
return res.json(transactions)
|
||||
} catch (e) {
|
||||
return res500(res, e)
|
||||
@@ -291,7 +291,7 @@ module.exports.change_transaction_status_by_agent = [
|
||||
module.exports.get_all_agents_inbox_for_admin = [
|
||||
async (req, res) => {
|
||||
try {
|
||||
const transactions = await Transaction.find()
|
||||
const transactions = await Transaction.find().sort({created_at:-1})
|
||||
.populate('agent_id', 'agent_code full_name')
|
||||
.populate('user_id', 'province_id province_name city_id city_name')
|
||||
return res.json(transactions)
|
||||
|
||||
Reference in New Issue
Block a user