bmc_hub/test_bulk_customer_update.py
Christian 246ad27fe3 Feature: Bulk customer hourly rate updates (v1.3.52)
Added bulk selection and update functionality for customer hourly rates:

Frontend (customers.html):
- Added checkbox column with select-all functionality
- Created bulk price update modal with customer list
- Implemented JavaScript for selection state management
- Shows selected count in UI badge
- Supports indeterminate state for partial selection

Backend (router.py):
- New POST /api/v1/timetracking/customers/bulk-update-rate endpoint
- Accepts {customer_ids: List[int], hourly_rate: float}
- Updates multiple customers in single SQL query
- Creates audit log entries for each updated customer
- Returns updated count

Use case: Select multiple customers and update hourly rate simultaneously
2025-12-23 14:31:10 +01:00

26 lines
683 B
Python

"""
Quick test of bulk customer hourly rate update endpoint
"""
import json
# Test payload structure
test_payload = {
"customer_ids": [1, 2, 3],
"hourly_rate": 1200.00
}
print("Test payload for POST /api/v1/timetracking/customers/bulk-update-rate:")
print(json.dumps(test_payload, indent=2))
print("\nExpected response:")
expected_response = {
"updated": 3,
"hourly_rate": 1200.00
}
print(json.dumps(expected_response, indent=2))
print("\nEndpoint ready for testing!")
print("curl -X POST http://172.16.31.183:8000/api/v1/timetracking/customers/bulk-update-rate \\")
print(' -H "Content-Type: application/json" \\')
print(f' -d \'{json.dumps(test_payload)}\'')