This commit is contained in:
payacom
2026-08-31 20:45:41 +03:30
parent fa9f23c61d
commit 3f416a7a60
367 changed files with 621895 additions and 6443 deletions

View 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