Skip to content

FavieCodes/rfc

Repository files navigation

FitCall Plans Service — RFC-004

Workout Plans & Assignment System for FitCall.me — a Django REST Framework microservice.

Requirements

  • Python 3.11+
  • PostgreSQL 14+ running locally

Quick Start

# 1. Create the database
psql -U postgres -c "CREATE DATABASE fitcall_plans;"

# 2. Run setup (creates venv, installs deps, runs migrations)
bash setup.sh

# 3. Start the server
venv/bin/python manage.py runserver

Then open http://127.0.0.1:8000 — the interactive API tester loads automatically.

Environment Variables (.env)

Variable Default Description
SECRET_KEY dev key Django secret key
DEBUG True Debug mode
DB_NAME fitcall_plans Postgres database name
DB_USER postgres Postgres user
DB_PASSWORD postgres Postgres password
DB_HOST localhost Postgres host
DB_PORT 5432 Postgres port
JWT_SECRET_KEY dev-jwt-secret Shared secret with Go auth service

API Endpoints

Method Endpoint Role Description
POST /api/v1/auth/dev-token/ Any Generate a dev JWT (DEBUG only)
GET /api/v1/me/ Any Current user info
GET /api/v1/plans/ Trainer List plans
POST /api/v1/plans/ Trainer Create plan
GET /api/v1/plans/{id}/ Trainer Get plan
PUT /api/v1/plans/{id}/ Trainer Update plan
DELETE /api/v1/plans/{id}/ Trainer Delete/archive plan
POST /api/v1/plans/{id}/assign/ Trainer Assign to client
GET /api/v1/assignments/ Both List assignments
GET /api/v1/assignments/{id}/ Both Get assignment

Run Tests

venv/bin/python -m pytest
# With coverage:
venv/bin/python -m coverage run -m pytest && venv/bin/python -m coverage report

Interactive Tester (index.html)

The root URL / serves an interactive UI. Workflow:

  1. Click Generate Token (choose Trainer or Client role)
  2. Select an endpoint from the sidebar
  3. Fill fields — Plan ID and Assignment ID auto-fill after creation
  4. Hit Send Request and inspect the response

Swagger UI

Full OpenAPI docs at http://127.0.0.1:8000/api/docs/

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors