-
Notifications
You must be signed in to change notification settings - Fork 8
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
#3169 getparttags endpoint #3207
base: feature/cad-project-file-review
Are you sure you want to change the base?
#3169 getparttags endpoint #3207
Conversation
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.
Really good job. For the postman tests, can you include a couple part tags in the seed data and show that they show up in the get request
static async getAllPartTags(organizationId: string) { | ||
const organization = await prisma.organization.findUnique({ | ||
where: { organizationId } | ||
}); |
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.
Because the organization is pulled from the request and not an input from the user, you don't need to check for a notFoundException here. If the organization id for whatever reason did not exist here, it would be a problem on our end not the requester's end. Instead you can just get rid of this check
return prisma.partTag.findMany({ | ||
where: { organizationId }, | ||
select: { | ||
partTagId: true, |
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.
don't need to include partTagId: true here
name: string; | ||
colorHexCode: string; | ||
dateCreated: Date; | ||
dateDeleted?: Date; |
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.
Don't include dateDeleted in the shared type. If it was deleted, people should not be seeing it on the frontend
} | ||
|
||
return prisma.partTag.findMany({ | ||
where: { organizationId }, |
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.
Only return partTags where dateDeleted is null
const partTags = await OrganizationsService.getAllPartTags(organizationID); | ||
expect(partTags.length).toEqual(2); | ||
expect(partTags.some((tag) => tag.partTagId === '123')).toBeTruthy(); | ||
expect(partTags.some((tag) => tag.partTagId === '456')).toBeTruthy(); |
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.
Add a partTag to a different organization, and a partTag that is deleted, and check that these are not in the result
Changes
Added new route at /organizations/getAllPartTags for #3169
Added service function using given organization id and returns an array of part tags.
Added a controller and parts-review.types.ts in shared types
Unit Tests
Notes
Could not do extensive postman tests, but unit tests passed
Test Cases
No organizationId, empty parts array, array with 2 parts
Screenshots
Checklist
It can be helpful to check the
Checks
andFiles changed
tabs.Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.
yarn.lock
changes (unless dependencies have changed)Closes #3169