Admin related fixes

This commit is contained in:
olivermrbl
2020-09-02 15:53:14 +02:00
parent 6c8dd1aebd
commit 238e9183a9
3 changed files with 10 additions and 11 deletions
@@ -3,7 +3,8 @@ export default async (req, res) => {
try {
const orderService = req.scope.resolve("orderService")
const order = await orderService.archive(id)
let order = await orderService.archive(id)
order = await orderService.decorate(order, [], ["region"])
res.json({ order })
} catch (error) {
throw error
+7 -9
View File
@@ -252,21 +252,19 @@ class OrderService extends BaseService {
// Run all other registered events
const completeOrderJob = await this.eventBus_.emit(
OrderService.Events.COMPLETED,
result
order
)
await completeOrderJob.finished().catch(error => {
throw error
})
return this.orderModel_
.updateOne(
{ _id: order._id },
{
$set: { status: "completed" },
}
)
.then(async result => {})
return this.orderModel_.updateOne(
{ _id: order._id },
{
$set: { status: "completed" },
}
)
}
/**
@@ -38,7 +38,7 @@ class QueryBuilderService extends BaseService {
if (_.isEmpty(search)) return
const searchQuery = searchProperties.map(s => ({
[s]: new RegExp(search.q),
[s]: new RegExp(search.q, "i"),
}))
return { $or: searchQuery }