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

backend: created user model and authMiddleware #71

Closed

Conversation

sethdivyansh
Copy link
Contributor

@sethdivyansh sethdivyansh commented Jun 5, 2024

Fixes: #62

Description

added:

  • User Model: Created with username and password fields.
  • Auth Middleware: JWT authentication middleware.
  • User Controller: Login and Register user.
  • Auth Endpoints: Register and login endpoints (pending completion).

Checklist

  • I have tested these changes locally.
  • I have reviewed the code and ensured it follows the project's coding guidelines.
  • I have updated the documentation, if necessary.
  • I have assigned reviewers to this pull request.

Test Screenshots

Register
image
Login
image

Copy link

vercel bot commented Jun 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
multiplayer-uno ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 8, 2024 8:39pm

@kuv2707
Copy link
Collaborator

kuv2707 commented Jun 6, 2024

@sethdivyansh The implementation seems alright!
How have you tested it?

@sethdivyansh
Copy link
Contributor Author

@kuv2707 I have not tested the authMiddleware yet. I'm unsure how to do so without involving the user controller. However, I have written a test for the user model in user.model.ts.


dotenv.config();

describe('insert user', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This would need setting up mongodb in github actions. I'll do it in a while.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I've add a mongodb server in the jest testing workflow, which starts a server at localhost:27017. Update this accordingly.

Copy link
Collaborator

@kuv2707 kuv2707 left a comment

Choose a reason for hiding this comment

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

Posted some minor comments.

It can be merged once these comments are addressed.

.DS_Store Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add this to .gitignore.


dotenv.config();

describe('insert user', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've add a mongodb server in the jest testing workflow, which starts a server at localhost:27017. Update this accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Backend(API) Issues related to the API layer in the backend. can be merged soon priority: high
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement JWT Authentication for User login and registration
2 participants