Bus and staff management microservice for the Choreo platform testing project.
- Bus registration and management
- Staff registration and management
- CRUD operations for both buses and staff
- In-memory storage for quick testing
GET /health
- Service health check
POST /api/buses
- Register new busGET /api/buses
- List all busesGET /api/buses/:id
- Get specific busPUT /api/buses/:id
- Update bus informationDELETE /api/buses/:id
- Delete bus
POST /api/staff
- Register new staff memberGET /api/staff
- List all staffGET /api/staff/:id
- Get specific staff memberPUT /api/staff/:id
- Update staff informationDELETE /api/staff/:id
- Delete staff member
POST /api/buses
Content-Type: application/json
{
"plate_number": "ABC-1234",
"model": "Toyota Coaster",
"capacity": 30
}
Response:
{
"id": 1,
"plate_number": "ABC-1234",
"model": "Toyota Coaster",
"capacity": 30,
"status": "active",
"created_at": "2025-09-21T13:30:00Z",
"updated_at": "2025-09-21T13:30:00Z"
}
POST /api/staff
Content-Type: application/json
{
"name": "John Driver",
"email": "john.driver@example.com",
"phone": "+1234567890",
"position": "driver",
"license_no": "DL123456"
}
Response:
{
"id": 1,
"name": "John Driver",
"email": "john.driver@example.com",
"phone": "+1234567890",
"position": "driver",
"license_no": "DL123456",
"status": "active",
"created_at": "2025-09-21T13:30:00Z",
"updated_at": "2025-09-21T13:30:00Z"
}
# Install dependencies
go mod tidy
# Run the service
go run .
# Or build and run
go build -o bus-management
./bus-management
PORT
- Server port (default: 8081)GIN_MODE
- Gin framework mode (debug/release)DB_HOST
- Database hostDB_PORT
- Database portDB_USER
- Database userDB_PASSWORD
- Database passwordDB_NAME
- Database name
# Build image
docker build -t bus-management .
# Run container
docker run -p 8081:8081 bus-management
id
- Unique identifierplate_number
- Bus registration plate numbermodel
- Bus model/typecapacity
- Passenger capacitystatus
- Bus status (active, maintenance, retired)created_at
- Creation timestampupdated_at
- Last update timestamp
id
- Unique identifiername
- Staff member nameemail
- Email addressphone
- Phone numberposition
- Job position (driver, conductor, mechanic)license_no
- Driver's license number (optional)status
- Staff status (active, inactive)created_at
- Creation timestampupdated_at
- Last update timestamp