Parking Management

Full parking inventory management with lots, numbered spaces, assignments, split billing for roommates, and tenant portal integration.

Overview

The parking system manages inventory at the lot level, individual numbered spaces, and assignments to tenants/units with support for included-with-lease or extra-charge billing modes. Split billing across roommates is supported with custom percentage allocation.

Data Model

ParkingLot

Per-property inventory. Has type (surface/garage/underground/covered/street), total spaces, optional layout image.

ParkingSpace

Numbered spot within a lot. Has type (standard/compact/handicap/EV/reserved/visitor/motorcycle), level, location, monthly rate.

ParkingAssignment

Links space to unit/tenant with vehicle info, billing mode, charge amount, expiration.

Split Billing

When a unit has multiple roommates and a parking space has an extra charge, the PM can split the charge across roommates using custom percentages. The system creates individual pending FEE Payment records for each roommate per their share.

typescript
// POST /api/parking/assignments with split billing
{
  spaceId: "...",
  unitId: "...",
  tenantId: "...",        // Primary assignment owner
  vehicleMake: "Toyota",
  vehicleModel: "Camry",
  licensePlate: "ABC-1234",
  isIncluded: false,
  monthlyCharge: 150,
  splitBilling: true,
  splits: [
    { tenantId: "t1", percentage: 50, amount: 75 },
    { tenantId: "t2", percentage: 30, amount: 45 },
    { tenantId: "t3", percentage: 20, amount: 30 }
  ]
}

// Server validates total = 100% and creates 3 pending
// Payment records of type FEE due on the 1st of next month

Automatic Accounting

When a paid parking assignment is created, a journal entry automatically fires:

text
DR 1100 Accounts Receivable  (amount)
CR 4600 Parking Income        (amount)

source: PARKING_FEE
sourceId: assignment.id

Layout Images

Each parking lot can have an uploaded layout map (JPG/PNG/WebP/PDF, max 10MB) stored in Vercel Blob. Images render inline with a full-screen expand viewer; PDFs show an "Open PDF" link.

API Endpoints

Lots & Spaces

  • GET/POST /api/parking/lots — List (with occupancy + revenue) / create (auto-generates spaces)
  • GET/PUT/DELETE /api/parking/lots/[lotId] — Full detail with spaces and assignments
  • POST/DELETE /api/parking/lots/[lotId]/layout — Upload/remove layout image
  • GET/PUT /api/parking/spaces/[spaceId] — Update rate, type, level, notes

Assignments

  • GET/POST /api/parking/assignments — List filterable / create with split billing support
  • PUT/POST /api/parking/assignments/[id] — Update or revoke

Analytics & Tenant Portal

  • GET /api/parking/stats — Totals, occupancy, revenue, type breakdown, expiring soon
  • GET /api/tenant/parking — Tenant's active assignments with vehicle + charge info