Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions backend/src/routes/merchants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Router, Response, Request } from 'express';
import { merchantService } from '../services/merchant-service';
import logger from '../config/logger';
import { adminAuth } from '../middleware/admin';
//import { renewalRateLimiter } from '../middleware/rate-limiter'; // Added Import
// import { renewalRateLimiter } from '../middleware/rate-limiter'; // Added Import

const router = Router();

Expand Down Expand Up @@ -94,23 +94,23 @@ router.post('/', adminAuth, async (req: Request, res: Response) => {
* Update merchant (Admin only)
* NOTE: Rate limiter applied here to prevent mass renewal/update congestion per merchant.
*/
router.patch('/:id', adminAuth, /*renewalRateLimiter,*/ async (req: Request, res: Response) => {
try {
const merchant = await merchantService.updateMerchant(req.params.id as string, req.body);
// router.patch('/:id', adminAuth, renewalRateLimiter, async (req: Request, res: Response) => {
// try {
// const merchant = await merchantService.updateMerchant(req.params.id as string, req.body);

res.json({
success: true,
data: merchant,
});
} catch (error) {
logger.error('Update merchant error:', error);
const statusCode = error instanceof Error && error.message.includes('not found') ? 404 : 500;
res.status(statusCode).json({
success: false,
error: error instanceof Error ? error.message : 'Failed to update merchant',
});
}
});
// res.json({
// success: true,
// data: merchant,
// });
// } catch (error) {
// logger.error('Update merchant error:', error);
// const statusCode = error instanceof Error && error.message.includes('not found') ? 404 : 500;
// res.status(statusCode).json({
// success: false,
// error: error instanceof Error ? error.message : 'Failed to update merchant',
// });
// }
// });

/**
* DELETE /api/merchants/:id
Expand Down
Loading
Loading