-
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
246 Implement findCommunityDistrictsByBoroughId endpoint #303
246 Implement findCommunityDistrictsByBoroughId endpoint #303
Conversation
a8a69e6
to
104e86b
Compare
bdf0c19
to
727b99a
Compare
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.
We should remove 🚧 from /boroughs/{boroughId}/community-districts:
in the openapi documentation since this PR implements it
16f5e5b
to
f746ec9
Compare
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.
If you could include 'Related to' or 'Closes' with the ticket number so the merge automatically handles the ticket, that'd be great. :) Otherwise LGTM
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.
Wait, wrong documentation... you want to remove the emoji from "summary: 🚧 Find community districts within a borough"
implement find community districts by borough id endpoint - cd by id controller, module, repository, service - added notNull contraints to community districts schema + migration - added unit and e2e tests
f746ec9
to
0c501f7
Compare
🤦🏽♂️ @pratishta |
@@ -20,6 +22,6 @@ export const communityDistrict = pgTable( | |||
); | |||
|
|||
export const communityDistrictEntitySchema = z.object({ | |||
boroughId: z.string().length(1), | |||
id: z.string().length(2), | |||
boroughId: z.string().length(1).regex(new RegExp("[1-9]")), |
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.
We updated this schema. It now includes 0 in the range:
ae-zoning-api/openapi/openapi.yaml
Line 863 in 16f5e5b
pattern: '^([0-9])$' |
.expect(400); | ||
expect(response.body.error).toBe(HttpName.BAD_REQUEST); | ||
}); | ||
|
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.
We should tests for 404s when requests are made to non-existent boroughs.
).not.toThrow(); | ||
}); | ||
|
||
it("service should throw a resource error when requesting with a missing id", async () => { |
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.
An empty string is different from an id that is not in the database. Empty strings are invalid request parameters. In practical terms, it would never make it to the service. The controller should throw an error before it gets to the service.
To test for a missing id, we want to look at what zod-mock lists and then pick an id that's not in that generated list. This is why we leverage seeding in our mocks- to ensure the generated data is always the same and never accidentally includes the id we designated as "missing"
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 misunderstood, thanks for explaining. I was thinking missing id as in not there and not as in missing from the db.
Description
implement find community districts by borough id endpoint
- cd by id controller, module, repository, service
- added notNull constraints to community districts schema + migration
- added unit and e2e tests
Tickets
Closes #246