1 Commits

Author SHA1 Message Date
0b6b92876e Merge pull request 'dev' (#1) from dev into main
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 3m0s
Reviewed-on: #1
2025-10-08 08:45:05 +00:00

View File

@@ -1,99 +1,12 @@
# COOPGO Fleets # COOPGO Fleets
COOPGO Fleets is a vehicle fleet management microservice providing vehicle and booking management capabilities. COOPGO Fleets is a vehicle management and booking service.
## Features It provides :
- gRPC API for vehicle and booking management - a gRPC API to manage fleets of vehicles and bookings
- Vehicle availability tracking with booking integration - availability information on véhicles
- Flexible data schema for custom vehicle and booking attributes - a flexible data schema to push any information on vehicles or bookings
- Soft delete for bookings with metadata preservation
- Multi-namespace support for fleet isolation
- Vehicle filtering by type, administrator, and availability
## Architecture It is not a full featured booking platform but just a microservice intended to be used as part of a bigger platform, like the COOPGO Technical Platform. It doesn't provide any king of booking UI or management interface.
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=<user> \
--build-arg ACCESS_TOKEN_PWD=<password> \
-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)