import { Provide } from '@midwayjs/decorator';
import { BaseService } from '@cool-midway/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { Repository } from 'typeorm';
import * as _ from 'lodash';
import { PayTypeEntity } from '../entity/payType';

@Provide()
export class PayTypeService extends BaseService {
  @InjectEntityModel(PayTypeEntity)
  payTypeEntity: Repository<PayTypeEntity>;

  async getPayTypeList(type) {
    let where;;
    if (type) {
      where = {
        type
      }
    } else {
      where = {};
    }
    return await this.payTypeEntity.find({
      where,
      select: ['payType', 'type', 'currencies']
    })
  }
}
