feat(core-flows, medusa): add update stock location endpoint to api-v2 (#6800)

* initial create

* add changeset

* redo changes for stock locatino module'

* initial update

* add changeset

* move integration tests

* update update method

* fix integration tests

* Update packages/stock-location-next/src/services/stock-location.ts

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>

* update service

* initial fixes

* pr feedback

* update types

* expand revert clause for update

* update versioning

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Philip Korsholm
2024-03-27 10:31:17 +01:00
committed by GitHub
co-authored by Oli Juhl Riqwan Thamir
parent 0b23e7efb8
commit 4cf71af07d
13 changed files with 378 additions and 27 deletions
+13 -8
View File
@@ -1,3 +1,5 @@
import { BaseFilterable, OperatorMap } from "../dal"
import { StringComparisonOperator } from "../common/common"
/**
@@ -241,7 +243,8 @@ export type StockLocationExpandedDTO = StockLocationDTO & {
*
* The filters to apply on the retrieved stock locations.
*/
export type FilterableStockLocationProps = {
export interface FilterableStockLocationProps
extends BaseFilterable<FilterableStockLocationProps> {
/**
* Search parameter for stock location names
*/
@@ -255,7 +258,7 @@ export type FilterableStockLocationProps = {
/**
* The names to filter stock locations by.
*/
name?: string | string[] | StringComparisonOperator
name?: string | string[] | OperatorMap<string>
}
/**
@@ -309,7 +312,7 @@ export type StockLocationAddressInput = {
/**
* The second line of the stock location address.
*/
address_2?: string
address_2?: string | null
/**
* The country code of the stock location address.
@@ -319,27 +322,27 @@ export type StockLocationAddressInput = {
/**
* The city of the stock location address.
*/
city?: string
city?: string | null
/**
* The phone of the stock location address.
*/
phone?: string
phone?: string | null
/**
* The province of the stock location address.
*/
province?: string
province?: string | null
/**
* The postal code of the stock location address.
*/
postal_code?: string
postal_code?: string | null
/**
* Holds custom data in key-value pairs.
*/
metadata?: Record<string, unknown>
metadata?: Record<string, unknown> | null
}
/**
@@ -435,3 +438,5 @@ export type UpdateStockLocationInput = {
export type UpdateStockLocationNextInput = UpdateStockLocationInput & {
id: string
}
export type UpsertStockLocationInput = Partial<UpdateStockLocationNextInput>
@@ -4,6 +4,7 @@ import {
StockLocationDTO,
UpdateStockLocationInput,
UpdateStockLocationNextInput,
UpsertStockLocationInput,
} from "./common"
import { RestoreReturn, SoftDeleteReturn } from "../dal"
@@ -251,6 +252,15 @@ export interface IStockLocationServiceNext extends IModuleService {
context?: Context
): Promise<StockLocationDTO[]>
upsert(
data: UpsertStockLocationInput[],
sharedContext?: Context
): Promise<StockLocationDTO[]>
upsert(
data: UpsertStockLocationInput,
sharedContext?: Context
): Promise<StockLocationDTO>
/**
* This method is used to update a stock location.
*
@@ -275,13 +285,15 @@ export interface IStockLocationServiceNext extends IModuleService {
* }
*/
update(
input: UpdateStockLocationNextInput[],
context?: Context
): Promise<StockLocationDTO[]>
update(
input: UpdateStockLocationNextInput,
id: string,
input: UpdateStockLocationInput,
context?: Context
): Promise<StockLocationDTO>
update(
selector: FilterableStockLocationProps,
input: UpdateStockLocationInput,
context?: Context
): Promise<StockLocationDTO[]>
/**
* This method is used to delete a stock location.