68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
import {
|
|
CreateCashFlowParams,
|
|
DeleteByClientAccountMovementParams,
|
|
DeleteMovementByPaymentParams,
|
|
DeleteMovementParams,
|
|
} from "../CashFlow/CashFlow.Interface";
|
|
import { ICashFlowBalanceDocument } from "./CashFlowBalance.Adapter.Mongoose";
|
|
|
|
export type FindCashFlowBalanceParams = {
|
|
companyId: string;
|
|
year: number;
|
|
month: number;
|
|
sessionUser: string;
|
|
};
|
|
|
|
export type CreateCashFlowBalanceParams = {
|
|
companyId: string;
|
|
amount: number;
|
|
year: number;
|
|
month: number;
|
|
updatedAt: Date;
|
|
};
|
|
|
|
export type CalculateCashFlowBalanceParams = {
|
|
companyId: string;
|
|
year: number;
|
|
month: number;
|
|
sessionUser: string;
|
|
};
|
|
|
|
export interface ICashFlowBalance {
|
|
id?: string;
|
|
companyId: string;
|
|
amount: number;
|
|
year: number;
|
|
month: number;
|
|
updatedAt: Date;
|
|
}
|
|
|
|
export interface CashFlowHistoryItem {
|
|
amount: number;
|
|
month: number;
|
|
year: number;
|
|
}
|
|
|
|
export interface CashFlowHistoryView {
|
|
companyId: string;
|
|
data: CashFlowHistoryItem[];
|
|
total: number;
|
|
}
|
|
|
|
export interface ICashFlowBalanceAdapter {
|
|
create(data: CreateCashFlowBalanceParams): Promise<ICashFlowBalance>;
|
|
delete(id: string): Promise<void>;
|
|
find(filters: FindCashFlowBalanceParams): Promise<ICashFlowBalance[]>;
|
|
findOne(filters: FindCashFlowBalanceParams): Promise<ICashFlowBalanceDocument | null>;
|
|
}
|
|
|
|
export interface ICashFlowBalanceManager {
|
|
balance: ICashFlowBalanceAdapter;
|
|
createCashFlowMovement(data: CreateCashFlowParams): Promise<void>;
|
|
calculateBalance(data: CalculateCashFlowBalanceParams): Promise<ICashFlowBalance>;
|
|
delete(data: DeleteMovementParams): Promise<void>;
|
|
deleteByPayment(data: DeleteMovementByPaymentParams): Promise<void>;
|
|
deleteByClientAccountMovement(data: DeleteByClientAccountMovementParams): Promise<void>;
|
|
history(data: FindCashFlowBalanceParams): Promise<CashFlowHistoryView>;
|
|
}
|