Implement the backend functionality to allow users to create a new distribution. This includes defining the entity, setting up the service logic, implementing the controller method, and registering the route.
Folder Structure
src/
├──component/
│ ├──v1
│ ├──Distribution
│ ├── Distribution.entity.ts
│ ├── Distribution.service.ts
│ ├── Distribution.controller.ts
Service: createDistribution
Add a method to handle business logic:
Validate required fields
Calculate derived values if needed (e.g., total_usd_amount)
Persist to the database
Return created record or success response
Controller:
POST /distributions
Accept JSON body with required distribution fields
Call service method
Return response with status 201 Created and distribution ID or details
Routing:
Register the controller method in your routes configuration (e.g., using @post() decorator if using NestJS or express-like router if not).
✳️ Acceptance Criteria
- Proper input validation (DTO/schema) should be enforced
- Error handling and response standardization should follow project conventions
- You may stub out additional logic (e.g., metadata parsing) and implement in future issues
- Return Response Json Object with
{data: {}, success: boolan, message?: string }
Implement the backend functionality to allow users to create a new distribution. This includes defining the entity, setting up the service logic, implementing the controller method, and registering the route.
Folder Structure
Service: createDistribution
Add a method to handle business logic:
Validate required fields
Calculate derived values if needed (e.g., total_usd_amount)
Persist to the database
Return created record or success response
Controller:
POST /distributionsAccept JSON body with required distribution fields
Call service method
Return response with status 201 Created and distribution ID or details
Routing:
Register the controller method in your routes configuration (e.g., using @post() decorator if using NestJS or express-like router if not).
✳️ Acceptance Criteria
{data: {}, success: boolan, message?: string }