Conversation
| }); | ||
| } | ||
|
|
||
| validateEnv(name: string): string { |
There was a problem hiding this comment.
Could we put this in the validation.utils.ts file? Could be useful for other aws setups that we use down the road.
| @MaxLength(255) | ||
| additionalInformation?: string; | ||
|
|
||
| @IsDate() |
There was a problem hiding this comment.
Creating a food request should never have these 3 bottom fields. They should always be initialized to null at the start. Can you update this as well as the test?
| foodType: FoodType; | ||
| name!: string; | ||
| quantity!: number; | ||
| foodType?: FoodType; |
| referencedColumnName: 'foodManufacturerId', | ||
| }) | ||
| foodManufacturer?: FoodManufacturer; | ||
| foodManufacturer?: FoodManufacturer | null; |
There was a problem hiding this comment.
Now that I think about it, the food manufacturer should not be null I dont think. When an order is created, we know who the food manufacturer is, we are just waiting for them to ship it out. We are also changing shippedBy to be the food manufacturer id, so that field should also end up being required.
| items: OrderItemDetailsDto[]; | ||
| orderId!: number; | ||
| status!: OrderStatus; | ||
| foodManufacturerName?: string; |
There was a problem hiding this comment.
Same here, see https://github.com/Code-4-Community/ssf/pull/105/changes#r2813954379 as to why.
| contactPhone: '(508) 222-2222', | ||
| hasEmailContact: true, | ||
| emailContactOther: null, | ||
| emailContactOther: undefined, |
There was a problem hiding this comment.
Any reason why we made this undefined?
| newsletterSubscription?: string; | ||
| } | ||
|
|
||
| export interface CreateRequestDto { |
There was a problem hiding this comment.
We will need to change this too to not have dataReceived, feedback, or photos
ℹ️ Issue
Closes https://vidushimisra.atlassian.net/jira/software/projects/SSF/boards/1?selectedIssue=SSF-131 and
https://vidushimisra.atlassian.net/jira/software/projects/SSF/boards/1?selectedIssue=SSF-138
📝 Description
This PR enables typescript strict mode in the backend which enables the compiler to be a lot more picky and strict with types, null and undefined checks, etc. The PR includes changes to make our backend adhere with all the rules that strict mode enforces. This involved work making entity fields optional or required, and also handling null/undefined errors and return values.
✔️ Verification
I made sure all the backend tests pass and npx nx serve backend properly runs without error.
🏕️ (Optional) Future Work / Notes
N/A