21 lines
802 B
TypeScript
21 lines
802 B
TypeScript
import { Refund, RefundStatus } from '../entities/refund.entity';
|
|
|
|
export const REFUND_REPOSITORY = Symbol('IRefundRepository');
|
|
|
|
export interface IRefundRepository {
|
|
findById(id: string): Promise<Refund | null>;
|
|
findAndCount(options: {
|
|
status?: RefundStatus;
|
|
page: number;
|
|
limit: number;
|
|
}): Promise<[Refund[], number]>;
|
|
create(data: Partial<Refund>): Promise<Refund>;
|
|
update(id: string, data: Partial<Refund>): Promise<void>;
|
|
/** Aggregate: total refund count and amount */
|
|
getRefundStats(): Promise<{ count: number; total: string }>;
|
|
/** Aggregate: completed refund total */
|
|
getCompletedRefundTotal(): Promise<string>;
|
|
/** QueryBuilder-based: monthly refund counts (last 12 months) */
|
|
getMonthlyRefundCounts(): Promise<Array<{ month: string; refunds: number }>>;
|
|
}
|