fix the errors in dashboard
This commit is contained in:
@@ -42,14 +42,14 @@ router.use(requireCompanyAuth, requireTenant, requireSubscription)
|
||||
|
||||
router.get('/company', async (req, res, next) => {
|
||||
try {
|
||||
ok(res, { data: await service.listByCompany(req.companyId) })
|
||||
ok(res, await service.listByCompany(req.companyId))
|
||||
} catch (err) { next(err) }
|
||||
})
|
||||
|
||||
router.get('/reservations/:id', async (req, res, next) => {
|
||||
try {
|
||||
const { id } = parseParams(reservationParamSchema, req)
|
||||
ok(res, { data: await service.listByReservation(id, req.companyId) })
|
||||
ok(res, await service.listByReservation(id, req.companyId))
|
||||
} catch (err) { next(err) }
|
||||
})
|
||||
|
||||
@@ -57,7 +57,7 @@ router.post('/reservations/:id/charge', requireRole('MANAGER'), async (req, res,
|
||||
try {
|
||||
const { id } = parseParams(reservationParamSchema, req)
|
||||
const body = parseBody(chargeSchema, req)
|
||||
ok(res, { data: await service.initCharge(id, req.companyId, body) })
|
||||
ok(res, await service.initCharge(id, req.companyId, body))
|
||||
} catch (err) { next(err) }
|
||||
})
|
||||
|
||||
@@ -65,7 +65,7 @@ router.post('/reservations/:id/capture-paypal', requireRole('MANAGER'), async (r
|
||||
try {
|
||||
const { id } = parseParams(reservationParamSchema, req)
|
||||
const { paypalOrderId } = parseBody(capturePaypalSchema, req)
|
||||
ok(res, { data: await service.capturePaypal(id, req.companyId, paypalOrderId) })
|
||||
ok(res, await service.capturePaypal(id, req.companyId, paypalOrderId))
|
||||
} catch (err) { next(err) }
|
||||
})
|
||||
|
||||
@@ -73,7 +73,7 @@ router.post('/reservations/:id/manual', requireRole('MANAGER'), async (req, res,
|
||||
try {
|
||||
const { id } = parseParams(reservationParamSchema, req)
|
||||
const body = parseBody(manualPaymentSchema, req)
|
||||
ok(res, { data: await service.recordManualPayment(id, req.companyId, body) })
|
||||
ok(res, await service.recordManualPayment(id, req.companyId, body))
|
||||
} catch (err) { next(err) }
|
||||
})
|
||||
|
||||
@@ -81,7 +81,7 @@ router.post('/reservations/:reservationId/payments/:paymentId/refund', requireRo
|
||||
try {
|
||||
const { reservationId, paymentId } = parseParams(paymentParamSchema, req)
|
||||
const { amount, reason } = parseBody(refundSchema, req)
|
||||
ok(res, { data: await service.refundPayment(reservationId, paymentId, req.companyId, amount, reason) })
|
||||
ok(res, await service.refundPayment(reservationId, paymentId, req.companyId, amount, reason))
|
||||
} catch (err) { next(err) }
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user