Automated Action 771ee5214f Implement LinkedIn-based church management system with FastAPI
- Complete FastAPI application with authentication and JWT tokens
- SQLite database with SQLAlchemy ORM and Alembic migrations
- User management with profile features and search functionality
- LinkedIn-style networking with connection requests and acceptance
- Social features: posts, likes, comments, announcements, prayer requests
- Event management with registration system and capacity limits
- RESTful API endpoints for all features with proper authorization
- Comprehensive documentation and setup instructions

Key Features:
- JWT-based authentication with bcrypt password hashing
- User profiles with bio, position, contact information
- Connection system for church member networking
- Community feed with post interactions
- Event creation, registration, and attendance tracking
- Admin role-based permissions
- Health check endpoint and API documentation

Environment Variables Required:
- SECRET_KEY: JWT secret key for token generation
2025-07-01 12:28:10 +00:00

57 lines
2.2 KiB
Python

from sqlalchemy import Boolean, Column, Integer, String, DateTime, Text, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from app.db.base import Base
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True, nullable=False)
first_name = Column(String, nullable=False)
last_name = Column(String, nullable=False)
hashed_password = Column(String, nullable=False)
is_active = Column(Boolean, default=True)
is_admin = Column(Boolean, default=False)
profile_picture = Column(String, nullable=True)
bio = Column(Text, nullable=True)
position = Column(String, nullable=True) # Church position/role
phone = Column(String, nullable=True)
address = Column(Text, nullable=True)
date_joined = Column(DateTime, nullable=False, default=func.now())
last_login = Column(DateTime, nullable=True)
# Relationships
sent_connections = relationship(
"Connection", foreign_keys="Connection.sender_id", back_populates="sender"
)
received_connections = relationship(
"Connection", foreign_keys="Connection.receiver_id", back_populates="receiver"
)
posts = relationship("Post", back_populates="author")
comments = relationship("Comment", back_populates="author")
likes = relationship("Like", back_populates="user")
event_registrations = relationship("EventRegistration", back_populates="user")
class Connection(Base):
__tablename__ = "connections"
id = Column(Integer, primary_key=True, index=True)
sender_id = Column(Integer, ForeignKey("users.id"), nullable=False)
receiver_id = Column(Integer, ForeignKey("users.id"), nullable=False)
status = Column(String, default="pending") # pending, accepted, rejected
created_at = Column(DateTime, nullable=False, default=func.now())
updated_at = Column(
DateTime, nullable=False, default=func.now(), onupdate=func.now()
)
# Relationships
sender = relationship(
"User", foreign_keys=[sender_id], back_populates="sent_connections"
)
receiver = relationship(
"User", foreign_keys=[receiver_id], back_populates="received_connections"
)