merge staging in main#48
Conversation
…tor offer status handling in OffersService
…ustomRider schema and controller for managing custom riders
…aging custom riders with CRUD operations
…aging offer acceptances and rejections
…ntroller, and new offer retrieval pipeline; refactor offer service methods for consistency
…troller for retrieving rider applications and offer dashboards; refactor CustomRiderController and service for improved ownership checks; remove unused custom rider pipeline
… streamline code and improve maintainability
… readability and maintainability
…d refactor getOffers method in OfferService to utilize the new pipeline; update GetOffersQueryDto to use z.coerce for better type handling
…ebase and improve maintainability
… to allow optional input
…tor OfferService to use updated types for improved type safety
… for sponsorId and streamline offer dashboard response by returning raw result
…ation support with page and limit parameters; update related DTOs and service methods for improved offer dashboard retrieval
… response with pagination details; update service and interface definitions for improved type safety and clarity
…applications; update service and pipeline to return structured response with pagination details
…tId for riderId, enhancing type safety and consistency
…eline, and result for improved debugging and monitoring
…sary fields and adjusting output structure for customRiders; enhance ApplicationService to streamline application retrieval
… createdAt and restructure output to return applications and total count; improve pagination handling
…iderId instead of converting it to ObjectId, enhancing code clarity and maintainability
…erface to standardize response structure; modify getRiderApplicationsPipeline for improved field handling and pagination support
…validation and modify getOffers method to accept riderId, improving offer retrieval logic and user authorization
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
merge sponsor offer feature into staging env
add swagger, and upgrade nest@11 and fastfy@5
There was a problem hiding this comment.
Pull Request Overview
This PR merges staging into main, bringing significant infrastructure updates and a complete new offers feature to the API.
- Adds comprehensive Swagger API documentation across all endpoints
- Implements a complete offers management system with CRUD operations and applications
- Updates core dependencies including NestJS 11, Fastify 5, and adds security middleware
Reviewed Changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.ts | Adds Swagger documentation setup and Helmet security middleware |
| src/features/offers/ | Complete new offers module with controllers, services, schemas, and pipelines |
| src/features/mails/mails.module.ts | Fixes module class name from MailService to MailModule |
| src/features/features.module.ts | Updates module imports replacing contracts with offers |
| Multiple controllers | Adds comprehensive Swagger API documentation decorators |
| package.json | Major dependency updates to NestJS 11, Fastify 5, and security packages |
| README.md | Complete documentation overhaul with detailed setup and API information |
Comments suppressed due to low confidence (1)
src/features/offers/services/custom-rider.service.ts:49
- The error message 'User is not a custom rider' at line 50 is misleading. It should be 'User is not a rider' since the check is verifying if the user type is RIDER, not specifically a 'custom rider'.
return customRider;
| if (!updatedOffer) { | ||
| throw new NotFoundException("Failed to update offer. Offer not found."); | ||
| } |
There was a problem hiding this comment.
This null check is redundant since findOneAndUpdate with 'new: true' will return null if no document matches, but the previous existence check at line 175 already handles the not found case. Consider removing this check or consolidating the error handling logic.
| if (!updatedOffer) { | |
| throw new NotFoundException("Failed to update offer. Offer not found."); | |
| } |
| _id: new (mongoose as any).Types.ObjectId(offerId), | ||
| sponsorId: new (mongoose as any).Types.ObjectId(sponsorId), |
There was a problem hiding this comment.
Using 'as any' type assertion bypasses TypeScript's type safety. Consider importing Types properly from mongoose or using a more type-safe approach.
| _id: new (mongoose as any).Types.ObjectId(offerId), | |
| sponsorId: new (mongoose as any).Types.ObjectId(sponsorId), | |
| _id: new Types.ObjectId(offerId), | |
| sponsorId: new Types.ObjectId(sponsorId), |
| return [ | ||
| { | ||
| $match: { | ||
| sponsorId: new (mongoose as any).Types.ObjectId(sponsorId), |
There was a problem hiding this comment.
Using 'as any' type assertion bypasses TypeScript's type safety. Consider importing Types properly from mongoose or using a more type-safe approach.
| sponsorId: new (mongoose as any).Types.ObjectId(sponsorId), | |
| sponsorId: new mongoose.Types.ObjectId(sponsorId), |
| const pipeline = [ | ||
| { | ||
| $match: { | ||
| sponsorId: new MongooseSchema.Types.ObjectId(sponsorId), |
There was a problem hiding this comment.
Inconsistent ObjectId creation pattern. This file uses 'MongooseSchema.Types.ObjectId' while pipeline files use 'mongoose.Types.ObjectId'. Consider standardizing the ObjectId creation approach across the codebase.
| sponsorId: new MongooseSchema.Types.ObjectId(sponsorId), | |
| sponsorId: new mongoose.ObjectId(sponsorId), |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.