34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { TransactionEntity } from '../../domain/entities/transaction.entity';
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
import { TransactionModel } from '../models/transaction.model';
|
|
import {
|
|
CONNECTION_NAME,
|
|
STATUS,
|
|
} from 'src/core/strings/constants/base.constants';
|
|
import { Repository } from 'typeorm';
|
|
import { BaseReadService } from 'src/core/modules/data/service/base-read.service';
|
|
import { TransactionPaymentType } from '../../constants';
|
|
|
|
@Injectable()
|
|
export class TransactionReadService extends BaseReadService<TransactionEntity> {
|
|
constructor(
|
|
@InjectRepository(TransactionModel, CONNECTION_NAME.DEFAULT)
|
|
private repo: Repository<TransactionModel>,
|
|
) {
|
|
super(repo);
|
|
}
|
|
|
|
async getPendingOrderId() {
|
|
const transactions = await this.repo.find({
|
|
where: {
|
|
status: STATUS.PENDING,
|
|
payment_type: TransactionPaymentType.MIDTRANS,
|
|
},
|
|
select: ['id', 'invoice_date'],
|
|
});
|
|
|
|
return transactions;
|
|
}
|
|
}
|