-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ot.past donations #11
base: main
Are you sure you want to change the base?
Conversation
I put UNFULFILLED/FULFILLED as the status but will work the same if it is: requested, processing, in delivery, or received |
@@ -21,7 +21,6 @@ export class DonationsController { | |||
|
|||
@Get('orders') | |||
filter(@Body() filterDonationsDto: FilterDonationsDto) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to replace the @Body() with @query() because we usually do @query() with GET requests and @Body with POST or PUT
https://dev.to/shameel/nestjs-request-param-body-query-headers-ip-5e6k
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean instead of using a FilterDonationsDto to put all of the filter conditions in the url to use @query?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
IsEnum, | ||
IsInt, | ||
IsOptional, | ||
} from 'class-validator'; | ||
import { DonationStatus } from '../types'; | ||
import { Timestamp } from 'typeorm'; | ||
|
||
export class FilterDonationsDto { | ||
@IsDateString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do @isdate() instead to match with the Date types in DTO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this and it broke. Is there anything wrong with isDateString?
|
||
@Get(':id') | ||
findOne(@Param('id') id: string) { | ||
return this.donationsService.findOne(+id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does +id do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
converts to number representation of id
https://en.wikibooks.org/wiki/JavaScript/Operators#Arithmetic_operators
ℹ️ Issue
Closes
📝 Description
Gives ability to fetch donation orders and filter by due date start, due date end, a list of pantry ids, and status (FULFILLED/UNFULFILLED). All the filter conditions are optional, so all nulls will fetch all orders.
✔️ Verification
Sent requests via postman to test inclusion/exclusion of dates, pantry ids, and status (including all nulls).
Provide screenshots of any new components, styling changes, or pages.