Add rental system: listings, bookings, payments, payouts, reviews
Full rental marketplace with 6 categories (apartment, house, car, motorcycle, bicycle, ebike). Booking workflow: create → confirm → pay → active → complete → payout. Landlord dashboard, admin moderation, availability calendar, Stripe Connect payouts. 14 QA bugs found and fixed including validator schemas, API response types, HTTP methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
24
server/src/middleware/checkBanned.ts
Normal file
24
server/src/middleware/checkBanned.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { Request, Response, NextFunction } from 'express';
|
||||
import { prisma } from '../config/database.js';
|
||||
|
||||
export async function checkBanned(req: Request, res: Response, next: NextFunction): Promise<void> {
|
||||
if (!req.userId) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: req.userId },
|
||||
select: { isBanned: true, banReason: true },
|
||||
});
|
||||
|
||||
if (user?.isBanned) {
|
||||
res.status(403).json({
|
||||
message: 'Account suspended',
|
||||
reason: user.banReason || 'Your account has been suspended. Contact support for more information.',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
Reference in New Issue
Block a user