feat: subscription tiers, period filter, dashboards, docs
- Add subscription tiers (Basic/Pro/Business) with listing limits and dynamic commission - Add daily/monthly period filter on rentals page - Add landlord dashboard with earnings chart, stat cards, property performance - Add landlord subscription management page - Add tenant dashboard with upcoming stays - Add business model documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { createBookingSchema, rejectBookingSchema, cancelBookingSchema } from '.
|
||||
import { AppError } from '../middleware/errorHandler.js';
|
||||
import { checkAvailability, calculateCancellationRefund, autoTransitionBooking } from '../utils/rental.js';
|
||||
import { getPlatformConfig } from '../utils/moderation.js';
|
||||
import { getLandlordTier, TIER_CONFIG } from '../utils/subscription.js';
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -111,8 +112,9 @@ router.post('/', authenticate, validate(createBookingSchema), async (req, res, n
|
||||
}
|
||||
|
||||
const config = await getPlatformConfig();
|
||||
const landlordTier = await getLandlordTier(rental.landlordId);
|
||||
const subtotal = pricePerPeriod * totalPeriods;
|
||||
const commissionRate = config.rentalCommissionPercent;
|
||||
const commissionRate = TIER_CONFIG[landlordTier].commissionPercent;
|
||||
const commissionAmount = subtotal * (commissionRate / 100);
|
||||
const depositAmount = rental.depositAmount || 0;
|
||||
const totalAmount = subtotal + depositAmount;
|
||||
|
||||
Reference in New Issue
Block a user