Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-07 13:32:35 +03:00
co-authored by Copilot
parent 4faafe6667
commit c7eb23dd3f
17 changed files with 668 additions and 120 deletions
+49 -2
View File
@@ -5,6 +5,46 @@ export const HOME_ROUTES = {
DASHBOARD: "/api/home",
} as const satisfies Record<string, ApiPath>
export const DashboardPeriods = [
"today",
"yesterday",
"this_week",
"this_month",
"last_month",
"last_3_months",
"last_6_months",
"last_year",
"year_to_date",
"all_time",
"custom",
] as const
export type DashboardPeriod = (typeof DashboardPeriods)[number]
export type HomeDashboardQuery = {
period?: DashboardPeriod
start_date?: string
end_date?: string
financial_period?: DashboardPeriod
financial_start_date?: string
financial_end_date?: string
work_order_period?: DashboardPeriod
work_order_start_date?: string
work_order_end_date?: string
appointment_period?: DashboardPeriod
appointment_start_date?: string
appointment_end_date?: string
sales_period?: DashboardPeriod
sales_start_date?: string
sales_end_date?: string
purchase_period?: DashboardPeriod
purchase_start_date?: string
purchase_end_date?: string
upcoming_filter?: "today" | "tomorrow" | "this_week" | "next_week"
upcoming_per_page?: number
upcoming_page?: number
}
export type HomeDashboardResponse = ApiResponse<typeof HOME_ROUTES.DASHBOARD, "get">
export class HomeClient extends ApiClient {
@@ -12,7 +52,14 @@ export class HomeClient extends ApiClient {
super(baseUrl, defaultOptions)
}
async dashboard() {
return this.get(HOME_ROUTES.DASHBOARD)
async dashboard(query?: HomeDashboardQuery) {
return this.get(
HOME_ROUTES.DASHBOARD,
query
? ({
query,
} as never)
: undefined,
)
}
}
+8 -1
View File
@@ -35,7 +35,14 @@ export { ShopCalendarsClient, SHOP_CALENDAR_ROUTES } from "./shop-calendars"
export { HolidayYearsClient, HOLIDAY_YEAR_ROUTES } from "./holiday-years"
export { TaxesClient, TAX_ROUTES } from "./taxes"
export { InvoicesClient, INVOICE_ROUTES, type InvoiceShowData } from "./invoices"
export { HomeClient, HOME_ROUTES, type HomeDashboardResponse } from "./home"
export {
HomeClient,
HOME_ROUTES,
DashboardPeriods,
type DashboardPeriod,
type HomeDashboardQuery,
type HomeDashboardResponse,
} from "./home"
export { BillsClient, BILL_ROUTES } from "./bills"
export { ReasonsClient, REASON_ROUTES } from "./reasons"
export { DocumentPrintClient, DOCUMENT_PRINT_ROUTES, type DocumentPrintType, type DocumentPrintMode } from "./document-print"