mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-10-01 09:23:12 +00:00
Keychain token storage, Axios client with async token injection, Cognito PKCE auth via react-native-app-auth, Redux auth slice, TanStack Query config, offline draft queue with NetInfo auto-submit, and SHOC theme.
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import apiClient from './client';
|
|
import type { PricingMode, LineItemSource } from '@proposal-system/api-contracts';
|
|
|
|
export interface LineItem {
|
|
id: string;
|
|
proposalId: string;
|
|
description: string;
|
|
quantity: number;
|
|
unit: string;
|
|
unitPrice: number | null;
|
|
totalPrice: number;
|
|
pricingMode: PricingMode;
|
|
sortOrder: number;
|
|
source: LineItemSource;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface UpdateLineItemEntry {
|
|
id: string | null;
|
|
description: string;
|
|
quantity: number;
|
|
unit: string;
|
|
unitPrice: number | null;
|
|
totalPrice: number;
|
|
pricingMode: PricingMode;
|
|
sortOrder: number;
|
|
source: LineItemSource;
|
|
}
|
|
|
|
export const lineItemsApi = {
|
|
getAll: async (proposalId: string): Promise<LineItem[]> => {
|
|
const res = await apiClient.get(`/proposals/${proposalId}/line-items`);
|
|
return res.data;
|
|
},
|
|
|
|
bulkUpdate: async (
|
|
proposalId: string,
|
|
lineItems: UpdateLineItemEntry[],
|
|
): Promise<LineItem[]> => {
|
|
const res = await apiClient.put(`/proposals/${proposalId}/line-items`, {
|
|
lineItems,
|
|
});
|
|
return res.data;
|
|
},
|
|
|
|
delete: async (proposalId: string, itemId: string): Promise<void> => {
|
|
await apiClient.delete(`/proposals/${proposalId}/line-items/${itemId}`);
|
|
},
|
|
};
|