import { Injectable } from '@nestjs/common'; import { BaseDetailManager } from 'src/core/modules/domain/usecase/managers/base-detail.manager'; import { RefundEntity } from '../../entities/refund.entity'; import { RelationParam } from 'src/core/modules/domain/entities/base-filter.entity'; import { mappingTransaction } from 'src/modules/transaction/transaction/domain/usecases/managers/helpers/mapping-transaction.helper'; @Injectable() export class DetailRefundManager extends BaseDetailManager { async prepareData(): Promise { return; } async beforeProcess(): Promise { return; } async afterProcess(): Promise { mappingTransaction(this.result['transaction']); return; } get relations(): RelationParam { return { // relation only join (for query purpose) joinRelations: [], // relation join and select (relasi yang ingin ditampilkan), selectRelations: ['transaction', 'transaction.items', 'items.refund'], // relation yang hanya ingin dihitung (akan return number) countRelations: [], }; } get selects(): string[] { return [ `${this.tableName}.id`, `${this.tableName}.code`, `${this.tableName}.status`, `${this.tableName}.type`, `${this.tableName}.request_date`, `${this.tableName}.refund_date`, `${this.tableName}.created_at`, `${this.tableName}.updated_at`, `${this.tableName}.creator_name`, `${this.tableName}.editor_name`, `${this.tableName}.refund_total`, `${this.tableName}.bank_name`, `${this.tableName}.bank_account_name`, `${this.tableName}.bank_account_number`, 'transaction', 'items', 'refund', ]; } get setFindProperties(): any { return { id: this.dataId, }; } }