forked from Code-4-Community/scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 0
SSF-225 FM Deleting & Editing Donation Item Backend #188
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6f4c9d5
backend
Juwang110 b6b6b6c
comments
Juwang110 3ed2f2f
Merge branch 'main' into jw/ssf-225-FM-edit-donation-items-backend
Juwang110 2c4a902
Merge branch 'main' into jw/ssf-225-FM-edit-donation-items-backend
Juwang110 5ff3444
comment
Juwang110 de76f07
Merge branch 'main' into jw/ssf-225-FM-edit-donation-items-backend
Juwang110 2f72783
Merge branch 'main' into jw/ssf-225-FM-edit-donation-items-backend
Juwang110 349f4d4
comment
Juwang110 d7afee7
Merge branch 'jw/ssf-225-FM-edit-donation-items-backend' of https://g…
Juwang110 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
apps/backend/src/donationItems/dtos/replace-donation-item.dto.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { | ||
| IsNumber, | ||
| IsString, | ||
| Min, | ||
| IsEnum, | ||
| IsNotEmpty, | ||
| Length, | ||
| IsOptional, | ||
| IsInt, | ||
| IsBoolean, | ||
| } from 'class-validator'; | ||
| import { FoodType } from '../types'; | ||
|
|
||
| // itemId present = update row, else add | ||
| export class ReplaceDonationItemDto { | ||
| @IsOptional() | ||
| @IsInt() | ||
| @Min(1) | ||
| itemId?: number; | ||
|
|
||
| @IsString() | ||
| @IsNotEmpty() | ||
| @Length(1, 255) | ||
| itemName!: string; | ||
|
|
||
| @IsInt() | ||
| @Min(1) | ||
| quantity!: number; | ||
|
|
||
| @IsNumber( | ||
|
Juwang110 marked this conversation as resolved.
|
||
| { maxDecimalPlaces: 2 }, | ||
| { message: 'ozPerItem must have at most 2 decimal places' }, | ||
| ) | ||
| @Min(0.01) | ||
| ozPerItem!: number; | ||
|
|
||
| @IsNumber( | ||
| { maxDecimalPlaces: 2 }, | ||
| { message: 'estimatedValue must have at most 2 decimal places' }, | ||
| ) | ||
| @Min(0.01) | ||
| estimatedValue!: number; | ||
|
|
||
| @IsEnum(FoodType) | ||
| foodType!: FoodType; | ||
|
|
||
| @IsBoolean() | ||
| foodRescue!: boolean; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.