feat(medusa): Add /admin/products/:id/variants end point (#1471)

* feat(medusa): Add /admin/products/:id/variants end point

* test(medusa): Fix get-variants test casees

* feat(medusa): Include the config to the ProdutService#retrieveVariants as a method parameter

* feat(medusa): Improve get-variants endpoint

* feat(medusa): Improve get-variants endpoint

* test(medusa): Fix unit tests

* test(medusa): Fix unit tests

* feat(medusa): Improve typings

* feat(medusa): Update according to feedback

* feat(medusa): Update according to feedback

* test(medusa): Fix list-variants tests

* feat(medusa): Getting the variants from the product end point should use the productVariantService

* fix(medusa): list-variants expand possibly undefined

* Fix(medusa): List-variants endpoint

* fix(medusa): Tests suite for list-variant

* test(integration-tests): Fix yarn lock

* test(integration-tests): Fix yarn lock
This commit is contained in:
Adrien de Peretti
2022-05-16 12:19:34 +02:00
committed by GitHub
parent 79345d27ec
commit edeac8ac72
13 changed files with 2095 additions and 1915 deletions
@@ -30,14 +30,14 @@ export function getRetrieveConfig<TModel extends BaseEntity>(
): FindConfig<TModel> {
let includeFields: (keyof TModel)[] = []
if (typeof fields !== "undefined") {
const fieldSet = new Set(fields)
fieldSet.add("id")
includeFields = Array.from(fieldSet) as (keyof TModel)[]
includeFields = Array
.from(new Set([...fields, "id"]))
.map(field => (typeof field === "string") ? field.trim() : field) as (keyof TModel)[]
}
let expandFields: string[] = []
if (typeof expand !== "undefined") {
expandFields = expand
expandFields = expand.map(expandRelation => expandRelation.trim())
}
return {