0.1.3•Updated 6 months ago
import type { LedgerEntry } from "@infinity-ledger/ledger.types/ledger.entry.ts";
import type { ConsumptionResponseMapped } from "@infinity-ledger/ledger.db.queries/consume.ledger.query.ts";
export interface LedgerConsumption {
id?: number
consumption_entry_id: number
source_entry_id: number
amount_deducted: number
timestamp: Date
}
interface LedgerConsumptionSuccess {
key: string
success: true
params: UnenteredLedgerConsumption
consumption_data: ConsumptionResponseMapped
}
interface LedgerConsumptionFailure {
key: string
success: false
reason: string
params: UnenteredLedgerConsumption
}
export type LedgerConsumptionResponse = LedgerConsumptionSuccess | LedgerConsumptionFailure
export type UnenteredLedgerConsumption = Pick<LedgerEntry, 'key' | 'amount' | 'source' | 'reference' | 'description' | 'request_id'>