Skip to content

#2702: Created createFaq Endpoint#2750

Merged
Peyton-McKee merged 3 commits intodevelopfrom
2702-recruitment-createfaq-endpoint
Aug 9, 2024
Merged

#2702: Created createFaq Endpoint#2750
Peyton-McKee merged 3 commits intodevelopfrom
2702-recruitment-createfaq-endpoint

Conversation

@Zwendle
Copy link
Copy Markdown
Contributor

@Zwendle Zwendle commented Aug 6, 2024

Changes

Created a create FAQ endpoint

Added unit tests (not 100% if they are correct though)

Notes

Confused on how to go about Postman testing so I left out those screenshots for now

Screenshots

Postman test where user is not an admin
Screenshot 2024-08-07 at 14 43 47

Postman test where organizationId is invalid
Screenshot 2024-08-08 at 13 53 29

Postman test where createFaq endpoint succeeds
Screenshot 2024-08-07 at 14 46 16

To Do

  • Postman testing

Checklist

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #2702

@Zwendle Zwendle linked an issue Aug 6, 2024 that may be closed by this pull request
@Zwendle Zwendle requested a review from Aaryan1203 August 6, 2024 16:13
@Zwendle Zwendle self-assigned this Aug 6, 2024
Copy link
Copy Markdown
Contributor

@Aaryan1203 Aaryan1203 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks amazing, great job!!

For postman testing, your going to have to open postman, then in the URL, it should be smth like this: http://localhost:3001/recruitment/faq/create and make sure its a post request you are sending. After that in the body, create a json object and add two fields for question and answer and give them values. In the headers, make sure you have a valid authorization ID which is going to be the id of anyone who is an admin, and make sure yu have an organization Id as well. You can get these by running yarn prisma:studio. Here is an example of what those look like.
image
image

Copy link
Copy Markdown
Contributor

@Aaryan1203 Aaryan1203 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!! lgtm

Copy link
Copy Markdown
Contributor

@Aaryan1203 Aaryan1203 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change and it should be good

});

if (!organization) {
throw new HttpException(400, `Organization with id ${organizationId} doesn't exist`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a not found exception instead of an HTTP exception

await expect(
async () =>
await RecruitmentServices.createFaq(await createTestUser(batmanAppAdmin, orgId), 'question', 'answer', '5')
).rejects.toThrow(new HttpException(400, `Organization with id 5 doesn't exist`));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will have to be not found exception as well

Copy link
Copy Markdown
Contributor

@Aaryan1203 Aaryan1203 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Peyton-McKee Peyton-McKee merged commit 3bef087 into develop Aug 9, 2024
@Peyton-McKee Peyton-McKee deleted the 2702-recruitment-createfaq-endpoint branch August 9, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Recruitment] - createFAQ endpoint

3 participants