import { Inject, Post, Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from '@cool-midway/core';
import { OrderEntity } from '../../entity/order';
import { AgentOrderService } from '../../service/agentOrder';

@Provide()
@CoolController({
  api: ['page'],
  entity: OrderEntity,
  service: AgentOrderService,
})
export class AgentOrderController extends BaseController {

  @Inject()
  agentOrderService: AgentOrderService;

  @Post('/summary', { summary: '统计' })
  async summary() {
    const { body } = this.baseCtx.request;
    return this.ok(await this.agentOrderService.summary(body));
  }
}
