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