For: Full Stack · Agency Dashboard · Backend API

Properties

Listings: fields, photos, statuses, featuring and who may change what.

Fields

Field Notes
Purpose SALE or RENT. Rents are per month.
Type VILLA, APARTMENT, TOWNHOUSE, LAND, OFFICE. Land and offices have no bedrooms; land has no furnishing or year.
Price Typed in OMR, stored in baisa (integer).
Bedrooms, bathrooms, built-up area, plot size, furnishing, year built Key facts on the listing page.
Features 16 amenities (sea view, private pool, majlis, maid's room...). They drive the search filter and "picture life here".
Area and address The area decides the "around this area" section.
Title and description Arabic and English. "Write with AI" drafts both from the facts (see AI assistant). Paragraphs are separated by an empty line.
Photos Several at once, JPEG/PNG/WebP up to UPLOAD_MAX_MB. The first is the cover; reorder with "Make cover" and "Move earlier".
Agent Admins choose; agents always own what they create.
Featured Admins: shown first on the home page and in the default sort.

Each listing gets a reference (DAR-1025) and an address (/properties/{english-title}-{number}) when it is created.

Status flow

DRAFT ──> PUBLISHED ──> UNDER_OFFER ──> SOLD    (sale)
            ^   │            │      └──> RENTED  (rent)
            │   └────────────┴──> SOLD / RENTED
            └── back from UNDER_OFFER, SOLD or RENTED (deal fell through, lease ended)
  • A new listing starts as DRAFT or PUBLISHED.
  • SOLD is only possible for sale listings and RENTED only for rentals.
  • PUBLISHED and UNDER_OFFER are visible on the website; the others answer 404 there.
  • The first time a listing is published, its "listed" date is set.

The flow is nextPropertyStatuses() in src/lib/rules.ts; the editor only offers allowed steps and the API refuses the rest with 409 bad_transition.

Who can do what

Action Agent Admin Owner
Create a listing yes (owns it) yes yes
Edit own listings all all
Choose the agent, feature no yes yes
Delete own drafts any any

Deleting a listing removes its photos records and its viewings; inquiries about it stay in the inbox without the link.

Photos on disk

Uploads go to UPLOAD_DIR with random names and are served at /uploads/<file>. Removing a photo from a listing does not delete the file (it may be used elsewhere); clean the folder occasionally if storage matters.