Skip to content
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

Week10 #2

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Week10 #2

wants to merge 18 commits into from

Conversation

Leonardo-Reyes-Munoz
Copy link
Owner

Jobs API part 2. Finish setting up controllers and add security packages. API has successfully launched to Render.com and Swagger API documentation has been created.

created a new createJWT method on UserSchema which generates jwt token. Calls createJWT method within the auth.js controller to generate a new user token
set-up environment variables to contain a 256 encryption key and JWT_LIFETIME variable to increase user privacy
Updates login controller to verify user email and password against DB. Generates jwt token if email and password are correct
Starts logic within auth middleware. Looks for auth header and uses verifies token using jwt package
This updates the logic withing the createJob controller. It appends the createdBy attribute to the request body and utilizes the Job model to create a new job entry
This destructures the userId and the jobId from the req object. Utilitizes the mongoose .findOne filter method to find the appropiate job. Sends response with job if successful
This adds updateJob logic. Destructures company, position, userId, and jobId from req object. Utilizes mongoose findneAndUpdate method to update job. Throws error if jobId is not found or provides res object with updated job.
This destructures the userId and jobId from req object. Utilizes the findOneAndRemove() mongoose method to delete job with associtedid and user. Throws error if job is not found. Provides res object with status code 200
This imports and invokes the following security packaages: helmet, cors, xss-clean, and express-rate-limit.
Copy link

@alexgs alexgs left a comment

Choose a reason for hiding this comment

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

See comments

params: { id: jobId },
} = req;

if (company === '' || position === '') {
Copy link

Choose a reason for hiding this comment

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

This won't catch undefined or null values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants