Spaces:
Running

File size: 1,851 Bytes
f287aeb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { apiGet, apiPost, apiPatch, apiDelete } from "../api";

export const getFeedInventory = () => apiGet<any>("/inventory/feed");

export const createFeed = (data: any) =>
  apiPost<any>("/inventory/feed", data);

export const createMedicine = (data: any) =>
  apiPost<any>("/inventory/medicine", data);

export const createFishBatch = (data: any) =>
  apiPost<any>("/inventory/batches", data);

export const createHarvestedFish = (data: any) =>
  apiPost<any>("/inventory/harvested", data);

export const getFeedByFoodType = (foodId: string) =>
  apiGet<any>(`/inventory/feed/food-type/${foodId}`);

export const getBatches = () =>
  apiGet<any>("/inventory/batches");

export const getBatchById = (id: string) =>
  apiGet<any>(`/inventory/batches/${id}`);

export const quarantineBatch = (id: string) =>
  apiPatch<any>(`/inventory/batches/${id}/quarantine`, {});

export const healthCheckBatch = (id: string, data: any) =>
  apiPatch<any>(`/inventory/batches/${id}/health-check`, data);

export const allocateBatch = (id: string, data: any) =>
  apiPatch<any>(`/inventory/batches/${id}/allocate`, data);

export const deleteFeed = (id: string) =>
  apiDelete<any>(`/inventory/feed/${id}`);

export const getMedicineInventory = () =>
  apiGet<any>("/inventory/medicine");

export const getMedicineInventoryTotal = () =>
  apiGet<any>("/inventory/medicine/total");

export const updateMedicineBatchQuantity = (id: string, newQuantity: number) =>
  apiPatch<any>(`/inventory/medicine/${id}/quantity`, { newQuantity });

export const deleteMedicineBatch = (id: string) =>
  apiDelete<any>(`/inventory/medicine/${id}`);

export const addMedicineStock = (data: {
  medicineTypeId: string;
  quantity: number;
  mlPerUnit: number;
  company: string;
  receivedDate: string;
  expiryDate: string;
}) => apiPost<any>("/inventory/medicine/stock", data);