Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Ot.past donations #11

wants to merge 4 commits into from

Conversation

CerberusLatrans
Copy link

@CerberusLatrans CerberusLatrans commented Oct 28, 2024

ℹ️ 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.
Screenshot 2024-12-02 at 2 30 01 PM

Screenshot 2024-12-02 at 2 29 25 PM

@CerberusLatrans
Copy link
Author

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) {

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

Copy link
Author

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?

Copy link
Author

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()

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

Copy link
Author

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does +id do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants