-
Notifications
You must be signed in to change notification settings - Fork 9
#4076: created getGuestDefinition endpoint #4148
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
Changes from 9 commits
b022dee
c50f372
c353145
c2d1e74
9eb5c02
b5c7cfd
e4f9fcd
9ef1c1c
b97ce6e
adced8a
1abf4d4
147e524
1cc1ed2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,6 +116,18 @@ export default class RecruitmentController { | |
| } | ||
| } | ||
|
|
||
| static async getGuestDefinition(req: Request, res: Response, next: NextFunction) { | ||
| try { | ||
| const definition = await RecruitmentServices.getGuestDefinition( | ||
| req.organization.organizationId, | ||
| req.params.definitionId as string | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. follow the conventions for accessing a req.params |
||
| ); | ||
| res.status(200).json(definition); | ||
| } catch (error: unknown) { | ||
| next(error); | ||
| } | ||
| } | ||
|
|
||
| static async editGuestDefinition(req: Request, res: Response, next: NextFunction) { | ||
| try { | ||
| const { definitionId } = req.params as Record<string, string>; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -338,4 +338,23 @@ export default class RecruitmentServices { | |
| }); | ||
| return guestDefinitionTransformer(updatedGuest); | ||
| } | ||
|
|
||
| /** | ||
| * Gets a single guest definition with the given user, organization, and definition ids | ||
| * @param organizationId the organization the user is currently in | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update doc string |
||
| * @param definitionId the id of the specific definition being found | ||
| * @returns a definition | ||
| * @throws if the definition is not found in the db | ||
| */ | ||
| static async getGuestDefinition(organizationId: string, definitionId: string) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. call this getSingleGuestDefinition so its use is clear |
||
| const guest = await prisma.guest_Definition.findUnique({ | ||
| where: { organizationId, definitionId } | ||
| }); | ||
|
|
||
| if (!guest) { | ||
| throw new NotFoundException('Guest Definition', definitionId); | ||
| } | ||
|
|
||
| return guestDefinitionTransformer(guest); | ||
| } | ||
| } | ||
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.
send the whole organization not just the id