# Fix Invalid Property Status Error

## Problem
"Validation error: Invalid status" when editing properties in Strapi admin panel.

## Solution Options

### Option 1: SQL Fix (Fastest - Run on Production Server)

```bash
# Connect to PostgreSQL
sudo -u postgres psql -d nre

# Then run these commands:
```

```sql
-- Check current invalid statuses
SELECT id, title, status 
FROM properties 
WHERE status IS NULL 
   OR status NOT IN ('upcoming', 'ongoing', 'completed');

-- Fix all invalid statuses (set to 'upcoming')
UPDATE properties 
SET status = 'upcoming' 
WHERE status IS NULL 
   OR status = '' 
   OR status NOT IN ('upcoming', 'ongoing', 'completed');

-- Verify fix
SELECT DISTINCT status FROM properties;
-- Should only show: upcoming, ongoing, completed

-- Exit
\q
```

### Option 2: One-Line SQL Fix

```bash
sudo -u postgres psql -d nre -c "UPDATE properties SET status = 'upcoming' WHERE status IS NULL OR status NOT IN ('upcoming', 'ongoing', 'completed');"
```

### Option 3: Use Node.js Script

```bash
cd /media/nurul/New Volume/Nurul/repos/nre/full/nrel-cms

# Stop Strapi first
pm2 stop nrel-cms

# Run fix script
NODE_ENV=production node fix-status-strapi.js

# Restart Strapi
pm2 start ecosystem.config.js
```

### Option 4: Manual Fix via Strapi Admin

1. Go to Strapi Admin: `https://cms.navana-realestate.com/admin`
2. Navigate to **Content Manager** → **Property**
3. For each property showing error:
   - Click on the property
   - Change **status** field to one of: `upcoming`, `ongoing`, or `completed`
   - Click **Save**

## Valid Status Values

The property schema only allows these status values:
- `upcoming`
- `ongoing`
- `completed`

Any other value (including NULL, empty string, or typos) will cause the validation error.

## After Fixing

1. Refresh your browser
2. The error should be gone
3. You can now edit properties normally

