feat(FE-357): Add marketing sales report API and types

This commit is contained in:
rstubryan
2025-12-17 09:50:36 +07:00
parent 224f7ddeea
commit 0f7f4e891c
3 changed files with 102 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
import { BaseApiService } from '@/services/api/base';
import { BaseApiResponse } from '@/types/api/api-general';
import { HppPerkandang } from '@/types/api/report/hpp-per-kandang';
export class MarketingSaleReportService extends BaseApiService<
HppPerkandang,
unknown,
unknown
> {
constructor(basePath: string) {
super(basePath);
}
async getHppPerKandangReport(
area_id?: number,
location_id?: number,
kandang_id?: number,
weight_min?: number,
weight_max?: number,
period?: string,
sort_by?: string,
show_unrecorded?: boolean,
page?: number,
limit?: number
): Promise<BaseApiResponse<HppPerkandang> | undefined> {
return await this.customRequest<BaseApiResponse<HppPerkandang>>(
`hpp-per-kandang`,
{
method: 'GET',
params: {
area_id: area_id,
location_id: location_id,
kandang_id: kandang_id,
weight_min: weight_min,
weight_max: weight_max,
period: period,
sort_by: sort_by,
show_unrecorded: show_unrecorded,
page: page,
limit: limit,
},
}
);
}
}
// TODO: REPLACE WITH PRODUCTION URL
export const SaleReportApi = new MarketingSaleReportService(
'http://localhost:4010/api/reports/marketings/hpp-per-kandang'
);