33 lines
823 B
TypeScript
33 lines
823 B
TypeScript
import { api } from '@/lib/api'
|
|
import type {
|
|
PaginatedResponse,
|
|
StockBalanceResponse,
|
|
StockMovementResponse,
|
|
LocationType,
|
|
MovementType,
|
|
} from '@/types/api'
|
|
|
|
import type { PageParams } from './master'
|
|
|
|
export interface StockBalanceParams extends PageParams {
|
|
locationId?: string
|
|
locationType?: LocationType
|
|
itemId?: string
|
|
}
|
|
|
|
export interface StockMovementParams extends PageParams {
|
|
itemId?: string
|
|
locationId?: string
|
|
type?: MovementType
|
|
from?: string
|
|
to?: string
|
|
}
|
|
|
|
export const stock = {
|
|
balances: (params?: StockBalanceParams) =>
|
|
api.get<PaginatedResponse<StockBalanceResponse>>('/stock/balances', { params }).then(r => r.data),
|
|
|
|
movements: (params?: StockMovementParams) =>
|
|
api.get<PaginatedResponse<StockMovementResponse>>('/stock/movements', { params }).then(r => r.data),
|
|
}
|