Files
ctms/frontend/src/api/impTransactions.ts
T
2025-12-17 12:46:58 +08:00

31 lines
859 B
TypeScript

import { apiGet, apiPost } from "./axios";
import type { AxiosResponse } from "axios";
import type { ApiListResponse } from "../types/api";
export interface ImpTransaction {
id: string;
study_id: string;
site_id: string;
batch_id: string;
subject_id?: string | null;
tx_type: string;
quantity: number;
tx_date: string;
reference?: string | null;
notes?: string | null;
created_by: string;
created_at: string;
}
export const fetchImpTransactions = (
studyId: string,
params?: Record<string, any>
): Promise<AxiosResponse<ApiListResponse<ImpTransaction>>> =>
apiGet(`/api/v1/studies/${studyId}/imp/transactions/`, { params });
export const createImpTransaction = (
studyId: string,
payload: Record<string, any>
): Promise<AxiosResponse<ImpTransaction>> =>
apiPost(`/api/v1/studies/${studyId}/imp/transactions/`, payload);