delete vs trash product in e2e api
This commit is contained in:
parent
9352dd1b81
commit
f266f20101
|
@ -27,6 +27,14 @@ export const baseProductURL = () => '/wc/v3/products/';
|
|||
*/
|
||||
export const buildProductURL = ( id: ModelID ) => baseProductURL() + id;
|
||||
|
||||
/**
|
||||
* A common delete product URL builder.
|
||||
*
|
||||
* @param {ModelID} id the id of the product.
|
||||
* @return {string} RESTful Url.
|
||||
*/
|
||||
export const deleteProductURL = ( id: ModelID ) => buildProductURL( id ) + '?force=true';
|
||||
|
||||
/**
|
||||
* The base for all product types.
|
||||
*/
|
||||
|
|
|
@ -3,6 +3,7 @@ import { ModelRepository } from '../../../framework';
|
|||
import {
|
||||
baseProductURL,
|
||||
buildProductURL,
|
||||
deleteProductURL,
|
||||
ExternalProduct,
|
||||
CreatesExternalProducts,
|
||||
DeletesExternalProducts,
|
||||
|
@ -61,6 +62,6 @@ export function externalProductRESTRepository( httpClient: HTTPClient ): ListsEx
|
|||
restCreate< ExternalProductRepositoryParams >( baseProductURL, ExternalProduct, httpClient, transformer ),
|
||||
restRead< ExternalProductRepositoryParams >( buildProductURL, ExternalProduct, httpClient, transformer ),
|
||||
restUpdate< ExternalProductRepositoryParams >( buildProductURL, ExternalProduct, httpClient, transformer ),
|
||||
restDelete< ExternalProductRepositoryParams >( buildProductURL, httpClient ),
|
||||
restDelete< ExternalProductRepositoryParams >( deleteProductURL, httpClient ),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import {
|
|||
UpdatesGroupedProducts,
|
||||
baseProductURL,
|
||||
buildProductURL,
|
||||
deleteProductURL,
|
||||
} from '../../../models';
|
||||
import {
|
||||
createProductTransformer,
|
||||
|
@ -55,6 +56,6 @@ export function groupedProductRESTRepository( httpClient: HTTPClient ): ListsGro
|
|||
restCreate< GroupedProductRepositoryParams >( baseProductURL, GroupedProduct, httpClient, transformer ),
|
||||
restRead< GroupedProductRepositoryParams >( buildProductURL, GroupedProduct, httpClient, transformer ),
|
||||
restUpdate< GroupedProductRepositoryParams >( buildProductURL, GroupedProduct, httpClient, transformer ),
|
||||
restDelete< GroupedProductRepositoryParams >( buildProductURL, httpClient ),
|
||||
restDelete< GroupedProductRepositoryParams >( deleteProductURL, httpClient ),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
SimpleProduct,
|
||||
baseProductURL,
|
||||
buildProductURL,
|
||||
deleteProductURL,
|
||||
CreatesSimpleProducts,
|
||||
DeletesSimpleProducts,
|
||||
ListsSimpleProducts,
|
||||
|
@ -70,6 +71,6 @@ export function simpleProductRESTRepository( httpClient: HTTPClient ): ListsSimp
|
|||
restCreate< SimpleProductRepositoryParams >( baseProductURL, SimpleProduct, httpClient, transformer ),
|
||||
restRead< SimpleProductRepositoryParams >( buildProductURL, SimpleProduct, httpClient, transformer ),
|
||||
restUpdate< SimpleProductRepositoryParams >( buildProductURL, SimpleProduct, httpClient, transformer ),
|
||||
restDelete< SimpleProductRepositoryParams >( buildProductURL, httpClient ),
|
||||
restDelete< SimpleProductRepositoryParams >( deleteProductURL, httpClient ),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import {
|
|||
UpdatesVariableProducts,
|
||||
baseProductURL,
|
||||
buildProductURL,
|
||||
deleteProductURL,
|
||||
} from '../../../models';
|
||||
import {
|
||||
createProductTransformer,
|
||||
|
@ -67,6 +68,6 @@ export function variableProductRESTRepository( httpClient: HTTPClient ): ListsVa
|
|||
restCreate< VariableProductRepositoryParams >( baseProductURL, VariableProduct, httpClient, transformer ),
|
||||
restRead< VariableProductRepositoryParams >( buildProductURL, VariableProduct, httpClient, transformer ),
|
||||
restUpdate< VariableProductRepositoryParams >( buildProductURL, VariableProduct, httpClient, transformer ),
|
||||
restDelete< VariableProductRepositoryParams >( buildProductURL, httpClient ),
|
||||
restDelete< VariableProductRepositoryParams >( deleteProductURL, httpClient ),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue