update sync data from site dashboard and testing closing cycles

This commit is contained in:
Alberto-Audrix committed 2026-09-15 16:52:41 +07:00
1 parent 36639d8c38
commit f49e72592c
42 files changed
+1966 -688

No files matched your search

+3 -7
View File
@@ -3,6 +3,7 @@ import type {
ChickenCounting,
ChickenWeight,
ActiveSite,
ActiveSiteSyncResponse,
ActiveSiteWrite,
CountingWrite,
Cycle,
@@ -10,7 +11,6 @@ import type {
CycleWrite,
Flock,
FlockWrite,
InitialBalanceResult,
Karung,
KarungRequestResult,
Kandang,
@@ -171,6 +171,8 @@ export const api = {
update: (id: number, body: Partial<ActiveSiteWrite>) =>
patch<ActiveSite>(`/active-sites/${id}/`, body),
remove: (id: number) => del(`/active-sites/${id}/`),
sync: (id: number) => post<ActiveSiteSyncResponse>(`/active-sites/${id}/sync/`, {}),
syncAll: () => post<ActiveSiteSyncResponse>('/active-sites/sync-all/', {}),
},
users: {
list: async () => unwrapList(await get<Paginated<User> | User[]>('/users/')),
@@ -214,12 +216,6 @@ export const api = {
create: (body: CycleWrite) => post<Cycle>('/cycles/', body),
update: (id: number, body: Partial<CycleWrite>) => patch<Cycle>(`/cycles/${id}/`, body),
remove: (id: number) => del(`/cycles/${id}/`),
initialBalance: (id: number, body: { date: string; feed_in_manual: number }) =>
post<InitialBalanceResult>(`/cycles/${id}/initial-balance/`, body),
initialBalanceCompare: (
id: number,
query: { date: string; manual?: number }
) => get<InitialBalanceResult>(`/cycles/${id}/initial-balance-compare/`, query),
approveClose: (id: number) =>
post<Cycle | { cycle: Cycle; site_error?: string }>(`/cycles/${id}/approve-close/`, {}),
rejectClose: (id: number) =>