fix(medusa): Deleted discount missing on order (#6837)
* Fix deleted discount missing on order * Added integration test * Added changeset
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
|
||||
const ITEMS_REL_NAME = "items"
|
||||
const REGION_REL_NAME = "region"
|
||||
const DISCOUNTS_REL_NAME = "discounts"
|
||||
|
||||
export const OrderRepository = dataSource.getRepository(Order).extend({
|
||||
async findWithRelations(
|
||||
@@ -28,8 +29,11 @@ export const OrderRepository = dataSource.getRepository(Order).extend({
|
||||
where: { id: In(entitiesIds) },
|
||||
select: ["id"],
|
||||
relations: rels,
|
||||
withDeleted:
|
||||
topLevel === ITEMS_REL_NAME || topLevel === REGION_REL_NAME,
|
||||
withDeleted: [
|
||||
ITEMS_REL_NAME,
|
||||
REGION_REL_NAME,
|
||||
DISCOUNTS_REL_NAME,
|
||||
].includes(topLevel),
|
||||
relationLoadStrategy: "join",
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user