# LMD Phase 1 Planning
## General Setup
- Setting up Configuration `3hrs`
- Setting up debugging in vs code `2hrs`
- Setting up logging `3hrs` ⚠️
- Setting up docker
- Setting up K8s
- Setting up source control (branches, etc) `1hr`
- Setting up deployment plans
- Setting up unit testing `3hrs`
- Setting up Pagination
- Setting up filteration
- Setting up unified error handling
## Services
1. Organization Service (`12hrs`)
- As Merchant
- Organization Management
- CRUD Organization `3hrs`
- Project Management
- CRUD Projects `3hrs`
- Pickup Location Management
- CRUD Locations `3hrs`
- Bank Account Management
- CRUD Banks `3hrs`
2. Shipments Service (`13hrs`)
- As Merchant
- Add Single `4hrs`
- Validations
- Multiple types of shipments and shiping locations
- Add Bulk `3hrs`
- Parsing Excel in Typescript
- Reusing the same "Single Shipment" core logic
- View Summary of added Shipments `1hr`
- As Operations
- View Summary of added Shipments `ALREADY_CALCULATED`
- Take actions on these Shipments `~2hrs`
- Update delivery locations of these Shipments `~3hrs`
- Location validation and Long Lat resolving
3. Cash Collection / Settlement Service (`6hrs`)
- As Merchant
- View COD summaries of added Shipments `2hrs`
- As Finance
- View COD summaries of added Shipments `ALREADY_CALCULATED`
- Collect COD (Approve collection from driver) `1hr`
- As Driver
- Collect COD `1hr`
- Reject COD (With reason) `1hr`
4. Task Management Service (`7hrs`)
- Trip Planning
- As Operations
- Assigning shipment to Driver `1hr`
- Unassigning shipment from Driver `1hr`
- As Driver
- View Assigned tasks and their details `1hr`
- Shipment Transfer
- As Driver
- Scan Shipment upon arrival to merchant `1hr`
- Scan Shipment upon arrival to hub `1hr`
- Scan Shipment upon arrival to customer `1hr`
- As Operator
- Scan Shipment upon arrival to hub (hub-to-hub transfers) `1hr`
5. OnFleet Service (`20hrs`)
- HTTP Client initialization `3hrs`
- Add Task `2hrs`
- Setup Metadata Extraction from incoming shipment `2hrs`
- Remove Task `1hr`
- Setup Webhooks for added tasks `8hrs`
- Query added tasks by merchant ids `1hr`
- Query added tasks by shipment ids `1hr`
- Query current tasks for driver `2hr`
6. Tracking Service
- Shipment Tracking
- As Hub Manager
- Hub Manager Dashboard
- As Supervisor
- Supervisor Dashboard
- As Merchant
- Merchant Dashboard
7. Fleet Management Service (`20hrs`)
- As Operations
- Resource Management
- Vehicles `CRUD` `4hrs`
- Drivers `CRUD` `4hrs`
- Hubs `CRUD` `4hrs`
- Teams `CRUD` `4hrs`
- Roles `CRUD` `4hrs`
➡️ Single Gateway for these services
### Foreach Service (7 Services) (`14hrs`)
- Initialization `2hrs`
- Entities Designing and Database Initialization `4hrs`
- Configuring Message Bus Communication `3hrs`
- Syncing needed data from other services `4hrs`
- Setting up swagger and other packages `1hrs`
#### Total Estimate
`12 hrs resolving missing concepts (one time)` + `78 hrs` + `{Tracking Service}` + `7x14hrs` = **`188hrs // 24 days`**
> Adding 2 hrs buffer per day:
> 24 x 2 = `48hrs`
> **Total With Buffer *(without tracking serivce)* `236hrs // 30 days`**
\* Unit testing and TDD overhead not calculated
## Lifecycles
### Shipment
- Merchant add Shipment
- **`Requested`**
- Operator assigns shipment to an available driver
- **`Picking Up`**
- Driver arrives to merchant, attaches waybill, scans it
- **`Collected`**
- Driver arrives hub, hub manager scans waybill
- **`At Station`**
- Operator marks shipment for transfer and chooses a hub
- **`In Transit: Unplanned`**
- Operator assigns shipment to an availble driver (while in transit)
- **`In Transit: Picking Up`**
- Driver scans shipment waybill (while in transit and being assigned to him)
- **`In Transit: Collected`**
- Driver arrives hub, hub manager scans waybill
- **`At Station`**
- Operator marks shipment for delivery and assigns to a driver
- **`Delivering: Picking Up`**
- Driver scans shipment waybill (while delivering and being assigned to him)
- **`Delivering: Collected (Out for delivery)`**
- Driver arrives destination and scans waybill
- **`Delivered`**
### COD
- Merchant creates a shipment having COD or CCOD
- Shipment details on task has information for COD collection
- Driver Console
- OnFleet
- Driver's balance now has a pending transaction for collecting the amount
- Once task is completed, Driver's balance is now in negative (with the amount that should be delivered to treasury)
- Once driver arrives treasury, finance member should mark shipment's COD as collected for driver's balance to reset
-----------
### Questions
- merchant > visibility dashboard ??
- hub management > materials management??
- waypay??
- operator vs hub specialist vs planner??
- driver vs driver associate??