full
This commit is contained in:
50
routes/application/bookings/index.js
Normal file
50
routes/application/bookings/index.js
Normal file
@@ -0,0 +1,50 @@
|
||||
const express = require('express')
|
||||
const {
|
||||
createDraftBookingConfig,
|
||||
getMyBookingConfigs,
|
||||
getBookingConfigById,
|
||||
updateBookingConfigServices,
|
||||
updateBookingConfigSchedule,
|
||||
updateBookingConfigStatus,
|
||||
submitBookingConfig
|
||||
} = require('../../../controllers/application/bookings/bookingConfigController')
|
||||
const {
|
||||
getPublicBookingConfig,
|
||||
getAvailability,
|
||||
createBooking,
|
||||
getMyBookings,
|
||||
updateBookingStatus,
|
||||
getBookingAnalytics
|
||||
} = require('../../../controllers/application/bookings/bookingController')
|
||||
const {
|
||||
initiateBookingPayment,
|
||||
handleBookingPaymentCallback
|
||||
} = require('../../../controllers/application/bookings/bookingPaymentController')
|
||||
const blockCheck = require('../../../middlewares/blockCheck')
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
// --- Booking-config wizard (provider setup) ---
|
||||
router.post('/draft', [blockCheck], createDraftBookingConfig)
|
||||
router.get('/mine', [blockCheck], getMyBookingConfigs)
|
||||
|
||||
// --- Reservations (buyer booking + provider's received bookings) ---
|
||||
// Registered before the generic '/:id' route below so these single-segment
|
||||
// paths aren't swallowed as a booking-config id.
|
||||
router.get('/public/:userId', getPublicBookingConfig)
|
||||
router.get('/availability', getAvailability)
|
||||
router.post('/book', [blockCheck], createBooking)
|
||||
router.get('/reservations', [blockCheck], getMyBookings)
|
||||
router.post('/reservations/:id/status', [blockCheck], updateBookingStatus)
|
||||
router.get('/analytics', [blockCheck], getBookingAnalytics)
|
||||
router.post('/payment/initiate', [blockCheck], initiateBookingPayment)
|
||||
router.get('/payment-callback/web', handleBookingPaymentCallback)
|
||||
|
||||
// --- Booking-config wizard (continued) ---
|
||||
router.get('/:id', [blockCheck], getBookingConfigById)
|
||||
router.patch('/:id/services', [blockCheck], updateBookingConfigServices)
|
||||
router.patch('/:id/schedule', [blockCheck], updateBookingConfigSchedule)
|
||||
router.patch('/:id/status', [blockCheck], updateBookingConfigStatus)
|
||||
router.post('/:id/submit', [blockCheck], submitBookingConfig)
|
||||
|
||||
module.exports = router
|
||||
Reference in New Issue
Block a user