
Features: - User registration and authentication with JWT tokens - Multi-level admin access (Admin and Super Admin) - Gym management with membership plans - Subscription management with payment integration - Stripe and Paystack payment gateway support - Role-based access control - SQLite database with Alembic migrations - Comprehensive API endpoints with FastAPI - Database models for users, gyms, memberships, subscriptions, and transactions - Admin endpoints for user management and financial reporting - Health check and documentation endpoints Core Components: - FastAPI application with CORS support - SQLAlchemy ORM with relationship mapping - JWT-based authentication with bcrypt password hashing - Payment service abstraction for multiple gateways - Pydantic schemas for request/response validation - Alembic database migration system - Admin dashboard functionality - Environment variable configuration
25 lines
929 B
Python
25 lines
929 B
Python
from sqlalchemy import Column, Integer, String, DateTime, Text, Boolean
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime
|
|
|
|
from app.db.base import Base
|
|
|
|
|
|
class Gym(Base):
|
|
__tablename__ = "gyms"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String, nullable=False, index=True)
|
|
description = Column(Text, nullable=True)
|
|
address = Column(String, nullable=False)
|
|
city = Column(String, nullable=False)
|
|
state = Column(String, nullable=False)
|
|
phone = Column(String, nullable=True)
|
|
email = Column(String, nullable=True)
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
membership_plans = relationship("MembershipPlan", back_populates="gym")
|
|
gym_memberships = relationship("GymMembership", back_populates="gym")
|