Skip to content

anujScript/file-sharing-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Scheduling API

A robust RESTful API for event scheduling with collaborative editing features, built with FastAPI.

Features

  • Secure authentication with JWT tokens
  • Role-based access control (Owner, Editor, Viewer)
  • CRUD operations for events
  • Recurring events with customizable patterns
  • Conflict detection for overlapping events
  • Batch operations for creating multiple events
  • Sharing system with granular permissions
  • Real-time notifications
  • Edit history tracking
  • Version control with rollback capability
  • Changelog with diff visualization
  • Event conflict resolution
  • Transaction system for atomic operations
  • Rate limiting for API endpoints
  • OpenTelemetry integration for distributed tracing
  • Health check endpoint
  • CORS support
  • Comprehensive error handling

Tech Stack

  • FastAPI 0.104.1
  • SQLAlchemy 2.0.23
  • PostgreSQL
  • Redis for caching and rate limiting
  • OpenTelemetry for distributed tracing
  • Alembic for database migrations
  • Pydantic for data validation
  • JWT for authentication

Setup Instructions for Event Scheduling API Project

Below is a step-by-step plan to set up the PostgreSQL database, Redis, and the Python environment for the Event Scheduling API.

  1. PostgreSQL Setup

    -- Connect to PostgreSQL as superuser brew services start postgresql or install postgres psql -U postgres

    -- Create database user CREATE USER event_scheduler_user WITH PASSWORD 'event_password';

    -- Create database CREATE DATABASE event_scheduler;

    -- Grant privileges GRANT ALL PRIVILEGES ON DATABASE event_scheduler TO event_scheduler_user;

  2. Redis Setup

    Install Redis (if not installed)

    For MacOS:

    brew install redis

    Start Redis service

    For MacOS:

    brew services start redis

  3. Python Environment Setup

    Create and activate virtual environment

    python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate

    Install dependencies

    pip install -r requirements.txt

  4. Environment Configuration

    Copy example environment file

    cp .env.example .env

    Configure the following environment variables in .env:

    DATABASE_URL=postgresql://event_scheduler_user:event_password@localhost:5432/event_scheduler SECRET_KEY=49938093a51aff6862f945644edf5987662c79b44dadaea1a3ec9e4b6244f603 ALGORITHM=HS256 ACCESS_TOKEN_EXPIRE_MINUTES=30 REFRESH_TOKEN_EXPIRE_DAYS=7 REDIS_URL=redis://localhost:6379 RATE_LIMIT_PER_MINUTE=60 ALLOWED_ORIGINS=http://localhost:3000

  5. Database Migration

    Run database migrations

    alembic upgrade head

  6. Start the Application

    Start the FastAPI server

    uvicorn app.main:app --reload

Once the server starts, you can access:

Project Structure

app/
├── alembic/              # Database migrations
│   └── v1/              # API version 1
├── api/                  # API endpoints
├── core/                 # Core functionality and configuration
├── db/                   # Database models and session
├── middleware/          # Custom middleware (auth, rate limiting, tracing)
├── schemas/             # Pydantic models
├── services/            # Business logic
└── utils/               # Utility functions

API Endpoints

  • GET /: Welcome message and documentation links

  • GET /health: Health check endpoint

    Auth

    • /api/v1/auth/register
    • /api/v1/auth/login
    • /api/v1/auth/refresh
    • /api/v1/auth/logout

    Event Management

    • POST /api/v1/events: Create event
    • GET /api/v1/events: List events
    • GET /api/v1/events/{event_id}: Get event details
    • PUT /api/v1/events/{event_id}: Update event
    • DELETE /api/v1/events/{event_id}: Delete event
    • POST /api/v1/events/{event_id}/share: Share event
    • POST /api/v1/events/batch : Create multiple events at once

    Event Permissions

    • PUT /api/v1/events/{event_id}/permissions/{user_id} : Update a user's permission for an event
    • DELETE /api/v1/events/{event_id}/permissions/{user_id} : Remove a user's access to an event
    • GET /api/v1/events/{event_id}/permissions : Get all permissions for an event

    Event History and Versioning

    • GET /api/v1/events/{event_id}/history : Get full version history of an event
    • GET /api/v1/events/{event_id}/history/{version_id} : Get a specific version of an event
    • GET /api/v1/events/{event_id}/versions : List all versions (paginated)
    • GET /api/v1/events/{event_id}/versions/{version_number} : Get a specific version
    • POST /api/v1/events/{event_id}/rollback/{version_id} : Roll back to a previous version
    • GET /api/v1/events/{event_id}/versions : List all versions (paginated)
    • GET /api/v1/events/{event_id}/versions/{version_number} : Get a specific version
    • POST /api/v1/events/{event_id}/rollback/{version_id} : Roll back to a previous version
    • GET /api/v1/events/{event_id}/changelog : Get change log of event

Security

  • JWT-based authentication
  • Role-based access control
  • Rate limiting
  • CORS protection
  • Input validation
  • Secure password hashing

Monitoring and Observability

  • OpenTelemetry integration for distributed tracing
  • Health check endpoint
  • Comprehensive error handling
  • Request/Response logging

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors