# COOPGO Fleets COOPGO Fleets is a vehicle fleet management microservice providing vehicle and booking management capabilities. ## Features - gRPC API for vehicle and booking management - Vehicle availability tracking with booking integration - Flexible data schema for custom vehicle and booking attributes - Soft delete for bookings with metadata preservation - Multi-namespace support for fleet isolation - Vehicle filtering by type, administrator, and availability ## Architecture This microservice is designed to be part of the COOPGO Technical Platform. It does not provide a UI or management interface. ``` ├── grpcapi/ # gRPC server and protocol definitions ├── handlers/ # Business logic └── storage/ # Database access layer (MongoDB, PostgreSQL) ``` ## Configuration Configuration is managed via Viper. Create a `config.yaml` file or use environment variables. ### Default configuration ```yaml name: "COOPGO Fleets" dev_env: false storage: db: type: mongodb # or "psql" mongodb: host: localhost port: "27017" db_name: coopgo_platform collections: vehicles: fleet_vehicles bookings: fleet_bookings services: grpc: enable: true port: 8093 ``` ### Environment variables Use underscore-separated uppercase names: `STORAGE_DB_TYPE`, `SERVICES_GRPC_PORT`, etc. ## Storage backends - **MongoDB** (default) - **PostgreSQL** (with Atlas migrations) ## Build ```bash go build ``` ## Docker ```bash docker build \ --build-arg ACCESS_TOKEN_USR= \ --build-arg ACCESS_TOKEN_PWD= \ -t coopgo-fleets . ``` ## gRPC API ### Vehicles | Method | Description | |--------|-------------| | `AddVehicle` | Create a new vehicle | | `GetVehicle` | Get a vehicle by ID (includes bookings) | | `GetVehicles` | List vehicles with filters | | `UpdateVehicle` | Update vehicle data | ### Bookings | Method | Description | |--------|-------------| | `CreateBooking` | Create a booking | | `GetBooking` | Get a booking by ID | | `GetBookings` | List all bookings | | `GetDriverBookings` | Get bookings for a driver | | `UpdateBooking` | Update a booking | | `DeleteBooking` | Soft delete a booking | ## License See [LICENSE.md](LICENSE.md)