Reviewed-on: #3 Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com> Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
100 lines
1.7 KiB
TypeScript
100 lines
1.7 KiB
TypeScript
export interface Payor {
|
|
name: string;
|
|
}
|
|
|
|
export interface Payee {
|
|
name: string;
|
|
}
|
|
|
|
export interface Account {
|
|
name: string;
|
|
number: string;
|
|
}
|
|
|
|
export interface Tag {
|
|
name: string;
|
|
icon: string;
|
|
description: string;
|
|
}
|
|
|
|
export interface Transaction {
|
|
payor: Payor;
|
|
payee: Payee;
|
|
amount: number;
|
|
account: Account;
|
|
tags: Tag[];
|
|
occurred_at: Date;
|
|
}
|
|
|
|
// -----------------------------
|
|
// Metrics
|
|
// -----------------------------
|
|
|
|
export interface ReportMetric {
|
|
sum: number;
|
|
count: number;
|
|
average: number;
|
|
transactions?: Transaction[];
|
|
}
|
|
|
|
// -----------------------------
|
|
// Period
|
|
// -----------------------------
|
|
|
|
export interface ReportPeriod {
|
|
start: Date;
|
|
end: Date;
|
|
|
|
expenses: ReportMetric;
|
|
incomes: ReportMetric;
|
|
}
|
|
|
|
// -----------------------------
|
|
// Group (bucket)
|
|
// -----------------------------
|
|
|
|
export type GroupKey = {
|
|
payee?: string[];
|
|
tags?: string[];
|
|
flow?: string[];
|
|
};
|
|
|
|
export interface ReportBucket {
|
|
group_key: GroupKey;
|
|
|
|
periods: {
|
|
weekly?: ReportPeriod[];
|
|
monthly?: ReportPeriod[];
|
|
yearly?: ReportPeriod[];
|
|
fyly?: ReportPeriod[];
|
|
full?: ReportPeriod[];
|
|
};
|
|
}
|
|
|
|
// -----------------------------
|
|
// Final Report
|
|
// -----------------------------
|
|
|
|
export interface ReportData {
|
|
periods: ("weekly" | "monthly" | "yearly" | "fyly" | "full")[];
|
|
|
|
rolling: boolean;
|
|
report_date?: string;
|
|
|
|
group_by: ("payee" | "tags")[];
|
|
|
|
ignore_self: boolean;
|
|
include_transactions: boolean;
|
|
|
|
start_date?: string | null;
|
|
end_date?: string | null;
|
|
flow?: "expense" | "income" | null;
|
|
payee?: string[] | null;
|
|
account?: string[] | null;
|
|
tags?: string[] | null;
|
|
min_amount?: number | null;
|
|
max_amount?: number | null;
|
|
|
|
buckets: ReportBucket[];
|
|
}
|