
- 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
28 lines
1020 B
Python
28 lines
1020 B
Python
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Numeric, Enum
|
|
from sqlalchemy.sql import func
|
|
from sqlalchemy.orm import relationship
|
|
import enum
|
|
from app.db.base import Base
|
|
|
|
|
|
class PaymentStatus(str, enum.Enum):
|
|
PENDING = "pending"
|
|
SUCCESS = "success"
|
|
FAILED = "failed"
|
|
CANCELLED = "cancelled"
|
|
|
|
|
|
class Payment(Base):
|
|
__tablename__ = "payments"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
amount = Column(Numeric(15, 2), nullable=False)
|
|
transaction_ref = Column(String(100), unique=True, nullable=False, index=True)
|
|
status = Column(Enum(PaymentStatus), default=PaymentStatus.PENDING, nullable=False)
|
|
payment_method = Column(String(50))
|
|
description = Column(String(255))
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
user = relationship("User", back_populates="payments") |