Skip to content

Commit c50f372

Browse files
committed
#4148: removed createdId parameter
1 parent b022dee commit c50f372

4 files changed

Lines changed: 12 additions & 17 deletions

File tree

src/backend/src/controllers/recruitment.controllers.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,11 @@ export default class RecruitmentController {
118118

119119
static async getGuestDefinition(req: Request, res: Response, next: NextFunction) {
120120
try {
121-
const { userCreatedId, organizationId, definitionId } = req.params as {
122-
userCreatedId: string;
123-
organizationId: string;
124-
definitionId: string;
125-
};
126-
const definition = await RecruitmentServices.getGuestDefinition(userCreatedId, organizationId, definitionId);
121+
console.log({ organizationId: req.organization.organizationId, definitionId: req.params.definitionId as string });
122+
const definition = await RecruitmentServices.getGuestDefinition(
123+
req.organization.organizationId,
124+
req.params.definitionId as string
125+
);
127126
res.status(200).json(definition);
128127
} catch (error: unknown) {
129128
next(error);

src/backend/src/routes/recruitment.routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ recruitmentRouter.post(
6262
RecruitmentController.createGuestDefinition
6363
);
6464

65-
recruitmentRouter.get('/guestDefinition/:id', RecruitmentController.getGuestDefinition);
65+
recruitmentRouter.get('/guestDefinition/:definitionId', RecruitmentController.getGuestDefinition);
6666

6767
export default recruitmentRouter;

src/backend/src/services/recruitment.services.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,23 +256,18 @@ export default class RecruitmentServices {
256256

257257
/**
258258
* Gets a single guest defenition with the given user, organization, and definition ids
259-
* @param userCreatedId the id of guest to retrieve
260259
* @param organizationId the organization the user is currently in
261260
* @param definitionId the id of the specific defenition being found
262261
* @returns a definition
263262
* @throws if the defenition is not found in the db
264263
*/
265-
static async getGuestDefinition(
266-
userCreatedId: string,
267-
organizationId: string,
268-
definitionId: string
269-
): Promise<Guest_Definition> {
270-
const guest = await prisma.guest_Definition.findFirst({
271-
where: { userCreatedId, organizationId, definitionId }
264+
static async getGuestDefinition(organizationId: string, definitionId: string): Promise<Guest_Definition> {
265+
const guest = await prisma.guest_Definition.findUnique({
266+
where: { organizationId, definitionId }
272267
});
273268

274269
if (!guest) {
275-
throw new NotFoundException('User', userCreatedId);
270+
throw new NotFoundException('Guest Defenition', definitionId);
276271
}
277272

278273
return guest;

src/backend/src/utils/errors.utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,5 @@ export type ExceptionObjectNames =
212212
| 'Event'
213213
| 'Schedule Slot'
214214
| 'ProspectiveSponsor'
215-
| 'SponsorTier';
215+
| 'SponsorTier'
216+
| 'Guest Defenition';

0 commit comments

Comments
 (0)