
- Set up FastAPI project structure with modular architecture - Create comprehensive database models for users, properties, messages, notifications, and payments - Implement JWT-based authentication with role-based access control (Seeker, Agent, Landlord, Admin) - Build property listings CRUD with advanced search and filtering capabilities - Add dedicated affordable housing endpoints for Nigerian market focus - Create real-time messaging system between users - Implement admin dashboard with property approval workflow and analytics - Add notification system for user alerts - Integrate Paystack payment gateway for transactions - Set up SQLite database with Alembic migrations - Include comprehensive health check and API documentation - Add proper error handling and validation throughout - Follow FastAPI best practices with Pydantic schemas and dependency injection
51 lines
1.9 KiB
Python
51 lines
1.9 KiB
Python
from sqlalchemy import Column, Integer, String, Boolean, Text, DateTime, ForeignKey, Numeric, JSON, Enum
|
|
from sqlalchemy.sql import func
|
|
from sqlalchemy.orm import relationship
|
|
import enum
|
|
from app.db.base import Base
|
|
|
|
|
|
class PropertyType(str, enum.Enum):
|
|
APARTMENT = "apartment"
|
|
HOUSE = "house"
|
|
DUPLEX = "duplex"
|
|
BUNGALOW = "bungalow"
|
|
FLAT = "flat"
|
|
ROOM = "room"
|
|
SELF_CONTAIN = "self_contain"
|
|
SHOP = "shop"
|
|
OFFICE = "office"
|
|
WAREHOUSE = "warehouse"
|
|
|
|
|
|
class PropertyStatus(str, enum.Enum):
|
|
FOR_RENT = "for_rent"
|
|
FOR_SALE = "for_sale"
|
|
SHORTLET = "shortlet"
|
|
|
|
|
|
class PropertyListing(Base):
|
|
__tablename__ = "property_listings"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
owner_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
title = Column(String(200), nullable=False, index=True)
|
|
description = Column(Text, nullable=False)
|
|
price = Column(Numeric(15, 2), nullable=False, index=True)
|
|
location = Column(String(255), nullable=False, index=True)
|
|
state = Column(String(50), nullable=False, index=True)
|
|
lga = Column(String(100), nullable=False, index=True)
|
|
property_type = Column(Enum(PropertyType), nullable=False, index=True)
|
|
status = Column(Enum(PropertyStatus), default=PropertyStatus.FOR_RENT, nullable=False, index=True)
|
|
bedrooms = Column(Integer, default=0)
|
|
bathrooms = Column(Integer, default=0)
|
|
toilets = Column(Integer, default=0)
|
|
amenities = Column(JSON)
|
|
images = Column(JSON)
|
|
is_affordable = Column(Boolean, default=False, index=True)
|
|
is_approved = Column(Boolean, default=False, index=True)
|
|
is_active = Column(Boolean, default=True, index=True)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
owner = relationship("User", back_populates="property_listings") |