Spaces:
Sleeping
Sleeping
Commit History
-
role id fix
3d6ee40
-
feat: task geofence validation against destination merchant, shared haversine utility
9c3b067 -
fix: get_today_tasks filters by assigned_to and date only, not merchant_id
dbd2244 -
fix: geo_location is top-level field on employee document, not under location_settings
41d9fa0 -
feat: add geofence validation for check-in and check-out
- Validate employee GPS coordinates against geo_location (lat/lng) configured in location_settings of scm_employees collection - Use precision_level (in km) as the allowed radius boundary - Implement Haversine formula for accurate distance calculation - Skip validation gracefully if geo_location is not configured - Add ERROR_OUTSIDE_GEOFENCE error constant - Validation runs after consent check, before duplicate check-in check - Logs distance, precision, and boundary status for observability5291403
-
docs: update tracker emoji to location pin
- Change emoji from 🏭 (factory) to 📍 (location pin) - Better represents GPS tracking and location features60283dd -
docs: simplify Swagger documentation across all routers
- Simplify attendance router (check-in, check-out, summary) - Simplify tasks router (get tasks, update status) - Simplify expenses router (submit expense) - Remove verbose sections and keep only essential information - Improve documentation readability and concisenessdc5b19b -
docs: simplify Swagger documentation for trips endpoints
- Make descriptions more concise and readable - Remove verbose sections and redundant information - Keep only essential information for API users - Improve documentation clarityed049b3 -
test: add test script for notifications register endpoint
- Add comprehensive test suite for POST /notifications/register - Test iOS and Android token registration - Test token update functionality - Test validation for invalid platform - Test authentication requirement - Include usage instructions and test summary4a17f3c -
feat: implement GET /trips endpoint with optimizations
- Add GET /trips endpoint to fetch user trips from last 7 days - Format duration as human-readable string (e.g., '8h 30m', '45m') - Optimize query with composite index on (user_id, merchant_id, created_at) - Remove redundant indexes to improve write performance - Extract helper functions for duration calculation and formatting - Fix attendance location_id type from string to UUID - Add MS_PER_MINUTE constant for better code clarity - Use integer division for duration calculations80b4a42
-
feat: enhance health endpoint with connection status checks
- Add MongoDB connection check with ping command - Add PostgreSQL connection check with simple query - Return detailed connection status for each component - Set status to 'degraded' if any connection fails - Useful for monitoring and debugging infrastructure issues9d8e0f2 -
refactor: remove redundant health endpoints from individual routers
- Remove health endpoints from attendance, tasks, location, geofences, trips, expenses, notifications routers - Keep only main /health endpoint at app level - Reduces API clutter and follows best practices - Single health check endpoint is sufficient for service monitoringbd66b67 -
fix: add missing Optional import in notifications schemas
c078403 -
feat: implement POST /notifications/register endpoint for push tokens
- Add POST /tracker/notifications/register endpoint with JWT authentication - Create scm_push_tokens table in PostgreSQL - Support iOS and Android platforms - Upsert logic: update existing token or insert new - Enable task alerts, attendance reminders, admin messages - Production-ready error handling and logging - Comprehensive OpenAPI documentation81fa08d
-
Implement Expenses API and optimize startup performance
Expenses API Features: - POST /tracker/expenses endpoint for expense submission - Expense types: Fuel, Food, Lodging, Miscellaneous - Receipt photo mandatory for all expenses - Default status: pending (requires admin approval) - Amount validation (positive, max 1M) - Currency validation (ISO 4217, 3-letter codes) - Timestamp validation (within 30 days) Database: - Added trans.scm_expenses table to migrations - 3 performance indexes (user_date, merchant_status, status) - 4 data integrity constraints (status, amount, type, currency) - NUMERIC(12,2) for precise amount storage Security: - JWT authentication required - Merchant ID validated from token - User ID validated from token - All expenses merchant-scoped Testing: - test_expenses_api.py with 5 comprehensive test cases - Tests success, no receipt, negative amount, no auth Performance Optimizations: - Reduced Docker workers from 4 to 1 (faster startup) - Added timeout-keep-alive 30 seconds - Optimized connection handling - No autom…1be45c0 -
Implement stop trip API with production-ready code
Features: - POST /tracker/trips/stop endpoint to end business trips - Trip ownership verification (merchant + user) - Trip status validation (must be active) - End location mandatory - Distance validation (0 to 1000km) - Stop time must be after start time - Trip becomes immutable after stopping (status = completed) - Duration calculated automatically (in minutes) Security: - JWT authentication required - Merchant ID validated from token - User ID validated from token - Trip ownership verified before stopping - Proper HTTP status codes (404, 403, 400, 401, 500) Response: - Returns trip ID, distance, and duration - Success message with trip details Testing: - Updated test_trips_api.py with stop trip tests - Tests success case and duplicate stop (400) - 7 total test cases now Documentation: - Updated TRIPS_QUICK_START.md with stop endpoint - Updated TRACKER_API_COMPLETE_SUMMARY.md - Added SQL queries for checking trips2fad98d -
Change migrations from automatic to manual execution
- Removed automatic migration execution from startup - Moved app/startup_migrations.py to migrate_all_tables.py - Updated migrate_all_tables.py to work as standalone script - Added main() function with user-friendly output - Updated MIGRATIONS_GUIDE.md with manual migration instructions - Updated README.md to include migration step in setup - Migrations are now idempotent and safe to run multiple times Usage: python migrate_all_tables.py This gives developers more control over when migrations run and prevents issues with multiple workers running migrations.7743dfc -
Implement Trips API with JWT auth and automatic migrations
Features: - POST /tracker/trips/start endpoint for business trip tracking - One active trip per user enforcement - JWT authentication with merchant isolation - Comprehensive validation (coordinates, timestamps) - Production-ready error handling Database: - Added trans.scm_trips table to automatic migrations - 3 performance indexes (user_status, merchant_date, status) - 6 data integrity constraints - Automatic creation on startup Testing: - test_trips_api.py with 5 comprehensive test cases - Tests success, errors, validation, and authentication Documentation: - Removed redundant docs (GEOFENCES_README.md, LOCATION_TRACKING_README.md) - Updated TRACKER_API_COMPLETE_SUMMARY.md with trips info - Added TRIPS_QUICK_START.md for quick reference Code Quality: - Follows existing patterns (geofences, location) - Type hints throughout - Comprehensive docstrings - Structured logging - No diagnostics errors6c31d92 -
Update README short description
2116fa1 -
Optimize startup migrations and cleanup redundant files
- Add process-level locking to prevent duplicate migration runs across workers - Reduce logging noise with consolidated output - Remove 19 redundant files (old migration scripts, duplicate docs, test files) - Update MIGRATIONS_GUIDE.md to reflect automatic startup migrations - Migrations now run once per worker with minimal logginga08fa29 -
chore: cleanup redundant and outdated files
Removed: - Duplicate documentation files - Old migration fix scripts - Outdated implementation summaries - Test artifacts and temporary files - Unused SQL scripts Kept: - Essential documentation (README, API guides) - Active test scripts - Current migration scripts - Production code and configs44cef1d -
feat: add automatic startup migrations for all tables
- Created app/startup_migrations.py module - All 5 tables now created automatically on server startup: * trans.scm_attendance * trans.scm_tasks * trans.scm_task_attachments * trans.scm_location_points (TimescaleDB hypertable) * trans.scm_geofences - Updated app/main.py to call run_startup_migrations() - Idempotent: safe to restart server multiple times - Automatic TimescaleDB hypertable creation if extension available - No manual migration scripts needed for basic setup - Manual scripts still available for advanced use casesbf3a789 -
docs: add comprehensive migrations guide
83aab31 -
feat: add migration management tools
- Created run_all_migrations.py to run all migrations in order - Created check_migrations.py to verify migration status - Updated setup.sh to use new migration runner - Shows progress, summary, and troubleshooting tips - Checks TimescaleDB extension and hypertable status - Lists missing migrations with instructionsd00a415 -
docs: add complete tracker API summary
1477fa7 -
docs: add geofences API documentation
73b66cd -
feat: implement geofences API with merchant-scoped security
- Created GET /tracker/geofences endpoint - Merchant isolation with JWT validation - Active/inactive status filtering - Haversine distance calculation for point-in-geofence checks - Database table with validation constraints - Indexes on merchant_id, active status, and location - Comprehensive security: users only see their own merchant's geofences - Migration script with test data (4 geofences) - Complete documentation and test suite - Production-ready error handling6bf0a90 -
feat(database): enhance connection pool monitoring and SSL configuration
- Add SSL certificate chain loading support for PostgreSQL with root CA and client cert/key - Implement comprehensive connection pool metrics tracking with acquisition time monitoring - Add detailed logging for connection pool initialization with pool size configuration - Add health check logging and connection acquisition performance metrics - Improve MongoDB URI handling by stripping whitespace from environment variables - Add connection pool state logging (pool size and idle connections) on acquire/release - Implement memory-efficient acquisition times tracking (keep last 1000 entries) - Enhance error logging with contextual information (host, port, database details) - Add detailed docstrings to connection pool methods with parameter and exception documentation - Import defaultdict for potential future metrics aggregation2add2b9
-
fix: correct database connection import in location service
- Changed from app.core.database.get_db_connection to app.postgres module - Use get_postgres_connection() and release_postgres_connection() - Added proper connection cleanup in finally blocks - Fixes ImportError on server startup785a469 -
docs: add comprehensive location tracking documentation
2b2bb55 -
feat: implement location tracking API with TimescaleDB hypertable
- Created POST /tracker/tracking/points endpoint for batch location upload - Implemented TimescaleDB hypertable with 1-day partitioning - Added compression policy (7 days) and retention policy (90 days) - Created indexes on user_id, merchant_id, and recorded_at - Batch upload supports up to 1000 points per request - Comprehensive validation (timestamp order, ranges, coordinates) - JWT authentication required - Migration script with test data - Complete documentation and test suite - Performance: 10-100x faster time-range queries956cecd -
feat: implement task attachments API with MinIO storage integration
Implemented production-ready task attachments upload API with comprehensive features: API Endpoints: - POST /tracker/tasks/{task_id}/attachments - Upload photos and signatures Features: - MinIO S3-compatible object storage integration - File upload with validation (images only, max 10MB) - Support for photo and signature attachment types - JWT authentication and authorization - Employee and merchant validation - Automatic file organization by merchant/task - Public URL generation for uploaded files - Database tracking of all attachments MinIO Integration: - Created MinioStorageAdapter for async file operations - Automatic bucket creation and management - Direct file upload to MinIO - Public URL generation - Secure HTTPS connection Database: - Created trans.scm_task_attachments table - Foreign key to trans.scm_tasks with CASCADE delete - Indexes for fast lookups - Stores file metadata (URL, name, size, MIME type) Code Quality: - Clean separation of concerns (storage, service, route…e0b1eb1
-
chore: update .gitignore to allow task documentation files
a0b407e -
feat: implement tasks API with GET today and PATCH status endpoints
Implemented production-ready tasks API with comprehensive features: API Endpoints: - GET /tracker/tasks/today - Fetch employee's tasks for today - PATCH /tracker/tasks/:id/status - Update task status with validation Features: - JWT authentication and authorization - Status transition validation (not_started, in_progress, completed) - Location tracking on every status update - Timestamp tracking (started_at, completed_at) - Employee and merchant authorization checks - Comprehensive error handling with appropriate HTTP codes Database: - Created trans.scm_tasks table with indexes - Migration script (migrate_tasks.py) - SQL script for manual setup (create_tasks_table.sql) Code Quality: - Clean separation of concerns (router, service, schemas) - Full type hints and validation - Comprehensive logging - Idempotent status updates - Production-ready error handling Testing: - Comprehensive test suite (test_tasks_api.py) - Tests all valid and invalid status transitions - Tests authorization …32eb084
-
feat: implement daily attendance summary API
- Add GET /attendance/daily endpoint with optional date query parameter - Add DailyAttendanceResponse schema with onDuty, checkInTime, checkOutTime, totalHours - Add get_daily_attendance service method to query and calculate attendance summary - Implement JWT authentication and comprehensive error handling - Return empty attendance instead of 404 when no record found - Calculate on-duty status and convert minutes to hoursa8ee704
-
refactor: Change API context path from /api/v1 to /tracker
- Updated main.py router prefix - Updated all test files and documentation - New endpoints: - POST /tracker/attendance/check-in - POST /tracker/attendance/check-out - GET /tracker/attendance/health3d54c92 -
refactor: Use server time for check-in/check-out instead of client timestamp
- Remove timestamp field from CheckInRequest and CheckOutRequest - Use datetime.now() on server to generate timestamp and work_date - Prevents timestamp manipulation from client side - More secure and consistent time tracking - Updated API documentation and examples0c2c78b -
feat: Implement check-out API with total working time calculation
- Add CheckOutRequest and CheckOutResponse schemas - Implement create_checkout service method with edge case handling - Add POST /attendance/check-out endpoint - Calculate total working minutes automatically - Handle edge cases: no check-in found, already checked out, GPS disabled - Validate check-out time is after check-in time - Update attendance record with check-out detailsca7fde4 -
Update Dockerfile
Verified signature311caf1 -
Update README.md
Verified signature8f2c1e9 -
Fix: Parse DATABASE_URL to extract individual connection parameters for asyncpg
69c71e7 -
logged url
bf9c8c1 -
Updated Read me
d464e87 -
Updated Config
e1ff3d1 -
Added Wheel file for Dependency
7028ec3 -
Check in service
82fcb44
-
Delete .github/workflows/docker-image-ci.yml
Verified signature3de7757 -
Standardize Dockerfile (port 8000) and add GHCR workflow
1bd93b7
-
Add initial project structure with Dockerfile, environment configuration, and FastAPI setup
230f597 -
initial commit
Verified signaturef2d6f7a