fix: order order
This commit is contained in:
@@ -29,12 +29,12 @@ export class OrderRepository extends Repository<Order> {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
).then(flatten)
|
).then(flatten)
|
||||||
|
|
||||||
const entitiesAndRelations = entitiesIdsWithRelations.concat(entities)
|
const entitiesAndRelations = entitiesIdsWithRelations.concat(entities)
|
||||||
|
|
||||||
const entitiesAndRelationsById = groupBy(entitiesAndRelations, "id")
|
const entitiesAndRelationsById = groupBy(entitiesAndRelations, "id")
|
||||||
return map(entitiesAndRelationsById, entityAndRelations =>
|
|
||||||
merge({}, ...entityAndRelations)
|
return map(entities, e => merge({}, ...entitiesAndRelationsById[e.id]))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async findOneWithRelations(
|
public async findOneWithRelations(
|
||||||
|
|||||||
@@ -244,11 +244,10 @@ class OrderService extends BaseService {
|
|||||||
query.select = select
|
query.select = select
|
||||||
}
|
}
|
||||||
|
|
||||||
if (relations && relations.length) {
|
let rels = relations
|
||||||
query.relations = relations
|
delete query.relations
|
||||||
}
|
|
||||||
|
|
||||||
const raw = await orderRepo.findWithRelations(query.relations, query)
|
const raw = await orderRepo.findWithRelations(rels, query)
|
||||||
const count = await orderRepo.count(query)
|
const count = await orderRepo.count(query)
|
||||||
const orders = raw.map(r => this.decorateTotals_(r, totalsToSelect))
|
const orders = raw.map(r => this.decorateTotals_(r, totalsToSelect))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user