lrf402788946 4 năm trước cách đây
mục cha
commit
155bf945a5

+ 1 - 0
app/controller/dock/.transaction.js

@@ -62,6 +62,7 @@ module.exports = {
       query: ["skip", "limit"],
       sort: ["meta.createdAt"],
       desc: true,
+      count: true,
     },
   },
   step: {

+ 5 - 0
app/controller/dock/transaction.js

@@ -9,5 +9,10 @@ class TransactionController extends Controller {
     super(ctx);
     this.service = this.ctx.service.dock.transaction;
   }
+
+  async index() {
+    const { data, total } = await this.service.query(this.ctx.query);
+    this.ctx.ok({ data, total });
+  }
 }
 module.exports = CrudController(TransactionController, meta);

+ 1 - 1
app/service/dock/transaction.js

@@ -12,7 +12,7 @@ class TransactionService extends CrudService {
     this.model = this.ctx.model.Transaction;
   }
 
-  async query(query, { skip = 0, limit = 0 } = {}) {
+  async query({ skip = 0, limit = 0, ...query }) {
     query = this.ctx.service.util.util.dealQuery(query);
     const { user_id, supplier, demander, status, ...info } = query;
     if (status)query.status = status.split(',');