Add adjustment functionality to stock API
This commit is contained in:
@@ -23,10 +23,26 @@ export interface StockMovementParams extends PageParams {
|
|||||||
to?: string
|
to?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AdjustmentBody {
|
||||||
|
itemId: string
|
||||||
|
locationId: string
|
||||||
|
locationType: LocationType
|
||||||
|
quantity: number
|
||||||
|
reasonCode: string
|
||||||
|
// TEMPORARY: required while auth doesn't resolve a logged-in user server-side — see testbug.md #28.
|
||||||
|
adjustedByUserId: string
|
||||||
|
}
|
||||||
|
|
||||||
export const stock = {
|
export const stock = {
|
||||||
balances: (params?: StockBalanceParams) =>
|
balances: (params?: StockBalanceParams) =>
|
||||||
api.get<PaginatedResponse<StockBalanceResponse>>('/stock/balances', { params }).then(r => r.data),
|
api.get<PaginatedResponse<StockBalanceResponse>>('/stock/balances', { params }).then(r => r.data),
|
||||||
|
|
||||||
movements: (params?: StockMovementParams) =>
|
movements: (params?: StockMovementParams) =>
|
||||||
api.get<PaginatedResponse<StockMovementResponse>>('/stock/movements', { params }).then(r => r.data),
|
api.get<PaginatedResponse<StockMovementResponse>>('/stock/movements', { params }).then(r => r.data),
|
||||||
|
|
||||||
|
adjust: (body: AdjustmentBody) =>
|
||||||
|
api.post('/stock/adjustment', body).then(r => r.data),
|
||||||
|
|
||||||
|
updateMovementReason: (id: string, reasonCode: string) =>
|
||||||
|
api.patch(`/stock/movements/${id}/reason`, { reasonCode }).then(r => r.data),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user