This commit implements the complete medication management system, which is a critical MVP feature for Normogen. Features Implemented: - 7 fully functional API endpoints for medication CRUD operations - Dose logging system (taken/skipped/missed) - Real-time adherence calculation with configurable periods - Multi-person support for families managing medications together - Comprehensive security (JWT authentication, ownership verification) - Audit logging for all operations API Endpoints: - POST /api/medications - Create medication - GET /api/medications - List medications (by profile) - GET /api/medications/:id - Get medication details - PUT /api/medications/:id - Update medication - DELETE /api/medications/:id - Delete medication - POST /api/medications/:id/log - Log dose - GET /api/medications/:id/adherence - Calculate adherence Security: - JWT authentication required for all endpoints - User ownership verification on every request - Profile ownership validation - Audit logging for all CRUD operations Multi-Person Support: - Parents can manage children's medications - Caregivers can track family members' meds - Profile-based data isolation - Family-focused workflow Adherence Tracking: - Real-time calculation: (taken / total) × 100 - Configurable time periods (default: 30 days) - Tracks taken, missed, and skipped doses - Actionable health insights Files Modified: - backend/src/handlers/medications.rs - New handler with 7 endpoints - backend/src/handlers/mod.rs - Added medications module - backend/src/models/medication.rs - Enhanced with repository pattern - backend/src/main.rs - Added 7 new routes Phase: 2.7 - Task 1 (Medication Management) Status: Complete and production-ready Lines of Code: ~550 lines
66 lines
1.3 KiB
Bash
Executable file
66 lines
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
echo "========================================="
|
|
echo "Deploying Normogen to Solaria"
|
|
echo "========================================="
|
|
|
|
# Server details
|
|
SERVER="alvaro@solaria"
|
|
REMOTE_DIR="/home/alvaro/normogen"
|
|
REPO_URL="ssh://git@gitea.solivarez.com.ar/alvaro/normogen.git"
|
|
|
|
echo ""
|
|
echo "Step 1: Pushing latest changes to git..."
|
|
git push origin main
|
|
|
|
echo ""
|
|
echo "Step 2: Connecting to Solaria..."
|
|
ssh $SERVER << 'ENDSSH'
|
|
set -e
|
|
|
|
echo "Creating directory if not exists..."
|
|
mkdir -p ~/normogen
|
|
|
|
cd ~/normogen
|
|
|
|
if [ -d ".git" ]; then
|
|
echo "Pulling latest changes..."
|
|
git pull origin main
|
|
else
|
|
echo "Cloning repository..."
|
|
git clone $REPO_URL .
|
|
fi
|
|
|
|
cd backend
|
|
|
|
echo ""
|
|
echo "Step 3: Stopping existing containers..."
|
|
docker-compose down || true
|
|
|
|
echo ""
|
|
echo "Step 4: Building and starting new containers..."
|
|
docker-compose up -d --build
|
|
|
|
echo ""
|
|
echo "Step 5: Waiting for services to be healthy..."
|
|
sleep 5
|
|
|
|
echo ""
|
|
echo "Step 6: Checking container status..."
|
|
docker-compose ps
|
|
|
|
echo ""
|
|
echo "Step 7: Checking backend logs..."
|
|
docker-compose logs backend | tail -20
|
|
|
|
ENDSSH
|
|
|
|
echo ""
|
|
echo "========================================="
|
|
echo "Deployment complete!"
|
|
echo "========================================="
|
|
echo ""
|
|
echo "API is available at: http://solaria:8000"
|
|
echo "Health check: http://solaria:8000/health"
|
|
echo ""
|