#2702: Created createFaq Endpoint#2750
Conversation
Aaryan1203
left a comment
There was a problem hiding this comment.
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.


Aaryan1203
left a comment
There was a problem hiding this comment.
Small change and it should be good
| }); | ||
|
|
||
| if (!organization) { | ||
| throw new HttpException(400, `Organization with id ${organizationId} doesn't exist`); |
There was a problem hiding this comment.
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`)); |
There was a problem hiding this comment.
this will have to be not found exception as well
…tman test ss for orgid)
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

Postman test where organizationId is invalid

Postman test where createFaq endpoint succeeds

To Do
Checklist
yarn.lockchanges (unless dependencies have changed)Closes #2702