feat(medusa): Implement premises of order edit retrieval (#2183)

**What**
- Implements the admin/store retrieval end point 
- Service implementation of the retrieve method
- Service implementation of the computeLineItems method which aggregates the right line item based on the changes that are made
- client
  - medusa-js api
  - medusa-react queries hooks

**Tests**
- Unit tests of the retrieval end points
- Unit tests of the service retrieve method and computeLineItems
- Integration tests for admin/store
- client
  - medusa-js tests
  - medusa-react hooks tests

FIXES CORE-492
This commit is contained in:
Adrien de Peretti
2022-09-15 11:12:20 +02:00
committed by GitHub
parent 3efeb6b84f
commit f863d28b9a
36 changed files with 1317 additions and 2 deletions
@@ -145,6 +145,17 @@ export function prepareRetrieveQuery<
expandFields = fields.split(",") as (keyof TEntity)[]
}
if (queryConfig?.allowedFields?.length) {
expandFields?.forEach((field) => {
if (!queryConfig?.allowedFields?.includes(field as string)) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
`Field ${field.toString()} is not valid`
)
}
})
}
return getRetrieveConfig<TEntity>(
queryConfig?.defaultFields as (keyof TEntity)[],
(queryConfig?.defaultRelations ?? []) as string[],