Closed coderoyalty closed 8 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
pseudonym | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Feb 16, 2024 4:24pm |
chore(backend-deps): update package.json file
add zod
add jsonwebtoken
add cookie-parser
add http-status-codes
add uuid
feat(backend): add error middleware
chore(backend): update config.ts
add utils for data connection
feat(backend): add authentication module
add auth controller, service, middleware and validator file
create POST - /api/auth/register
route handler
refactor: improve email and username handling in registration
transform email and username inputs to lowercase for consistency
update auth.validator.ts to transform email and username inputs to lowercase before validation
feat: add JWT token generation method to user model
implement a new method createToken()
in the user model to generate JWT tokens
update the configuration file to include JWT secret and expiration duration
feat(backend): implement JWT token handling for user authentication
add cookie-parser middleware to parse cookies in the request.
create a utility function to verify JWT tokens.
update the auth controller to handle user login and issue JWT tokens upon successful authentication.
add middleware to validate login credentials and check if the user is already logged in.
feat(backend): implement user logout and isLoggedIn middleware
add logout functionality to clear the authentication cookie
implement middleware to check if the user is logged in
modify the AuthUser type to include the user id
chore(backend-deps): add nodemailer package
feat(backend): add email utility service
add email verification model
add email-related service file
update config utility file
add email utility template generator
feat(backend): configure auth service to send verification mail
feat(backend): add User Message controller and services
add a new controller and services for handling user messages
add routes for checking if a username exists, creating messages, fetching messages
implemented corresponding services to handle message creation and fetching based on pagination
introduced necessary validation and error handling
refactor(backend): organize user and message into separate modules
feat: add endpoint to fetch user statistics
added a new endpoint in the UserController to fetch statistics for the current authenticated user
The endpoint, GET /me/stats, retrieves data such as the total count of messages, count of archived messages, and the most recent messages
implemented corresponding service method userStats in the UserService to handle the logic for fetching user statistics
also included error handling to ensure the validity of the user ID and handle cases where the user is not found
fix: fix fetching empty messages
avoid returning archived messages
fix parsing "req.query" instead of "req.body" in create function
update pagination schema This commit fix an issue regard an invalid find operation using "ownerID" instead of "owner: ownerID" as filter parameter
chore(deps): add express-rate-limit package
feat(backend): login throttling using rate limiter middleware
implemented login throttling by applying the rate limiter middleware to the login route in the AuthController
this feature helps prevent brute-force-attack
refactor: add cookie class for easily creating cookies
feat(api): set secure flag for auth cookie in production environment
Implement backend features and dependencies: