diff --git a/README.md b/README.md index 5359edf..975a753 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,131 @@ -# COOPGO Solidarity Transport +# COOPGO Solidarity Transport -COOPGO Solidarity Transport is a solidarity transport management microservice. It handles : +A microservice for managing solidarity transport, enabling volunteer drivers to provide rides to passengers in need. Part of the COOPGO cooperative mobility platform. -- driver availabilities declarations -- passenger journeys requests -- matching between passenger journeys requests and driver availabilities +## Features -## TO DO +- **Driver Availability Management**: Drivers can declare their regular weekly availability slots +- **Journey Matching**: Automatically matches passenger journey requests with available drivers based on time and location +- **Booking System**: Full booking lifecycle management with status tracking +- **Route Calculation**: Integration with Valhalla routing service for distance and duration calculations +- **Round-trip Support**: Handles both one-way and return journeys with the "noreturn" toggle -- Save passenger trip requests +## Architecture + +### Components + +``` +├── handler/ # Business logic layer +├── servers/grpc/ # GRPC API server +│ ├── proto/ # Protocol buffer definitions +│ ├── server/ # GRPC service implementations +│ └── transformers/ # Type converters (proto <-> internal types) +├── storage/ # Data persistence layer (MongoDB, Memory, Mock) +└── types/ # Domain types +``` + +### Dependencies + +- **Routing Service**: Valhalla-based routing for journey calculations +- **Storage**: MongoDB (default), in-memory, or mock storage +- **GRPC**: Service communication protocol + +## Configuration + +Configuration is managed via Viper. Create a `config.yaml` file or use environment variables (with `_` as separator). + +### Default Configuration + +```yaml +name: "COOPGO Solidarity Transport" +dev_env: false + +storage: + db: + type: mongodb + mongodb: + host: localhost + port: 27017 + db_name: coopgo_platform + collections: + drivers_regular_availabilities: solidarity_drivers_regular_availabilities + bookings: solidarity_bookings + driver_journeys: solidarity_driver_journeys + +services: + grpc: + enable: true + port: 8080 + +routing: + type: valhalla + valhalla: + base_url: https://valhalla.coopgo.io + +parameters: + limits: + distance: + min: 4 # Minimum journey distance (km) + max: 200 # Maximum journey distance (km) +``` + +## Building + +```bash +go build +``` + +### Docker + +```bash +docker build -t solidarity-transport \ + --build-arg ACCESS_TOKEN_USR= \ + --build-arg ACCESS_TOKEN_PWD= . +``` + +## Running + +```bash +./solidarity-transport +``` + +The GRPC server starts on port 8080 by default. + +## GRPC API + +### Driver Availabilities + +| Method | Description | +|--------|-------------| +| `AddDriverRegularAvailability` | Add a single availability slot | +| `AddDriverRegularAvailabilities` | Add multiple availability slots | +| `GetDriverRegularAvailabilities` | Get all availabilities for a driver | +| `DeleteDriverRegularAvailability` | Remove an availability slot | + +### Driver Journeys + +| Method | Description | +|--------|-------------| +| `GetDriverJourneys` | Search for available driver journeys matching a route and date | +| `GetDriverJourney` | Get details of a specific journey | +| `ToggleSolidarityTransportNoreturn` | Toggle round-trip/one-way mode for a journey | + +### Bookings + +| Method | Description | +|--------|-------------| +| `BookDriverJourney` | Create a booking for a journey | +| `GetSolidarityTransportBookings` | List bookings (supports status filtering) | +| `GetSolidarityTransportBooking` | Get a specific booking | +| `UpdateSolidarityTransportBooking` | Update booking details | +| `UpdateSolidarityTransportBookingStatus` | Update booking status | + +## Testing + +```bash +go test ./... +``` + +## License + +COOPGO