diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c7f79b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +**/.env +**/node_modules diff --git a/README.md b/README.md index 4fd9b5e..5d9f85a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ [![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/QUdQy4ix) # CS3219 Project (PeerPrep) - AY2526S1 -## Group: Gxx +## Group: G01 ### Note: - You are required to develop individual microservices within separate folders within this repository. - The teaching team should be given access to the repositories as we may require viewing the history of the repository in case of any disputes or disagreements. + +### References: +- https://github.com/CS3219-AY2526Sem1/PeerPrep-UserService diff --git a/ai/usage-log.md b/ai/usage-log.md new file mode 100644 index 0000000..7fc09d1 --- /dev/null +++ b/ai/usage-log.md @@ -0,0 +1,397 @@ +# AI Usage Log + +## Entry 1 + +# Date/Time: +2025-09-15 12:00 + +# Tool: +ChatGPT (model: ChatGPT-4.1) + +# Prompt/Command: +Request to implement a reusable debounced input component in React with TypeScript support, extending shadcn/ui Input component with custom debouncing functionality. + +# Output Summary: +- Complete React component with TypeScript interfaces +- Custom useDebouncedValue hook implementation +- DebouncedInput component with forwardRef support +- Proper prop extension from React.ComponentProps<"input"> +- Integration with shadcn/ui Input component +- Debounce functionality with configurable delay (default 300ms) +- Support for controlled/uncontrolled input patterns + +# Action Taken: +- [x] Accepted as-is +- [ ] Modified +- [ ] Rejected + +# Author Notes: +- Validated correctness of debouncing logic and React hooks usage +- Confirmed security implications are minimal (client-side UI component) +- Tested performance with different debounce delays + +--- + +## Entry 2 + +# Date/Time: +2025-09-15 15:20 + +# Tool: +GitHub Copilot (model: Claude Sonnet 4) + +# Prompt/Command: +"set up docker file for my express app" - Request to create Dockerfile and .dockerignore for Node.js Express user-service application + +# Output Summary: +- Multi-stage Dockerfile with deps, builder, and runner stages +- Production-optimized configuration with Alpine Linux base +- Security features: non-root user (expressjs:nodejs), production dependencies only +- Performance optimizations: layer caching, small image size +- Health check endpoint configuration +- Comprehensive .dockerignore file excluding unnecessary files +- Proper file copying and permissions setup + +# Action Taken: +- [x] Accepted as-is +- [ ] Modified +- [ ] Rejected + +# Author Notes: +- Reviewed multi-stage build structure for optimization +- Verified security configurations (non-root user, Alpine base) +- Confirmed port 3001 matches application configuration +- Validated .dockerignore excludes sensitive files (.env, node_modules) +- Health check endpoint may need implementation in Express app +- Docker setup follows best practices for Node.js applications + +--- + +## Entry 3 + +# Date/Time: +2025-09-15 17:30 + +# Tool: +GitHub Copilot (model: Claude Sonnet 4) + +# Prompt/Command: +"Create a root package.json with concurrently scripts for concurrent development workflow" - Request to set up npm scripts for running both frontend and user-service simultaneously during development + +# Output Summary: +- Root-level package.json configuration for monorepo-style development +- Concurrently package integration for parallel script execution +- Development scripts: dev, dev:frontend, dev:user-service +- Production scripts: start, start:frontend, start:user-service +- Build scripts: build, build:frontend, build:user-service +- Utility scripts: install:all, clean +- Proper cross-platform script configuration for Windows/Unix compatibility + +# Action Taken: +- [x] Accepted as-is +- [ ] Modified +- [ ] Rejected + +# Author Notes: +- Validated script paths and directory navigation (cd commands) +- Confirmed concurrently package version (^8.2.2) is current +- Tested npm run dev workflow for concurrent frontend/backend startup +- Scripts support both development and production deployment scenarios +- Clean script properly removes node_modules from all service directories +- install:all script ensures all dependencies are installed across services +- Improves developer experience with single command for multi-service development + +--- + +## Entry 4 + +# Date/Time: +2025-09-15 18:45 + +# Tool: +GitHub Copilot (model: Claude Sonnet 4) + +# Prompt/Command: +Request to implement toast notifications for signup form validation with top-center positioning and custom styling, replacing disabled button with specific error feedback. + +# Output Summary: +- Sonner toast library integration in Next.js layout.tsx +- Custom toast positioning (top-center) with enhanced visual styling +- Password complexity validation with detailed toast feedback +- Custom CSS styling with backdrop blur, hover effects, and type-specific border colors +- Toast configuration with rich colors, close button, and 4-second duration +- Individual validation checks replacing single disabled button state + +# Action Taken: +- [x] Accepted as-is +- [ ] Modified +- [ ] Rejected + +# Author Notes: +- Validated toast notification UX improves over disabled button approach +- Confirmed Sonner library is modern and well-maintained for React/Next.js +- Reviewed custom CSS for accessibility and visual consistency +- Tested toast positioning and timing for optimal user experience +- Security implications minimal (client-side UI feedback only) +- Enhanced user experience with specific, actionable error messages + +--- + +## Entry 5 + +# Date/Time: +2025-09-15 19:15 + +# Tool: +GitHub Copilot (model: Claude Sonnet 4) + +# Prompt/Command: +Request to implement comprehensive signup form improvements including controlled inputs, debounced password validation, password complexity requirements with visual indicators, and enhanced UX patterns. + +# Output Summary: +- Converted all form inputs to controlled React components with proper state management +- Implemented DebouncedInput component for confirm password field with 300ms delay +- Added password complexity validation using regex patterns (length, uppercase, lowercase, number, special characters) +- Dynamic password requirements display with focus/blur states and visual indicators (Check/X icons) +- Password visibility toggle buttons for both password fields +- Real-time password match validation with error messaging +- Enhanced form validation logic with proper state synchronization +- Improved accessibility with proper labeling and error states + +# Action Taken: +- [ ] Accepted as-is +- [x] Modified +- [ ] Rejected + +# Author Notes: +- Validated all form state management follows React best practices +- Confirmed password regex patterns meet common security requirements +- Tested debounced validation prevents excessive API calls or state updates +- Reviewed accessibility features for screen readers and keyboard navigation +- Performance optimized with proper useCallback and state dependencies +- UX improvements provide clear visual feedback for password requirements +- Security considerations: client-side validation only, server validation still required + +--- + +## Entry 6 + +# Date/Time: +2025-09-15 20:30 + +# Tool: +GitHub Copilot (model: Claude Sonnet 4) + +# Prompt/Command: +Request to create reusable error handling utilities for consistent API error management and user feedback across the application. + +# Output Summary: +- Created comprehensive error handling utility (/utils/errorHandler.ts) +- Implemented extractErrorInfo function for normalizing different error types +- Added handleApiError function with smart error detection and toast notifications +- Created handleApiSuccess function for consistent success feedback +- Added withErrorHandling and withLoadingAndErrorHandling wrapper functions +- Integrated TypeScript interfaces for error responses +- Implemented status-specific error titles (Conflict, Validation Error, etc.) +- Added automatic toast management with loading state handling +- Updated SignUpComponent to use new error handling utilities + +# Action Taken: +- [x] Accepted as-is +- [ ] Modified +- [ ] Rejected + +# Author Notes: +- Validated error handling covers all HTTP status codes and network scenarios +- Confirmed TypeScript type safety for all error and response scenarios +- Reviewed reusable utility functions for DRY principle adherence +- Performance considerations: automatic loading toast dismissal prevents UI conflicts +- Security implications minimal: client-side error handling only +- UX improvements: consistent error messaging and user feedback across application +- Maintainability: centralized error handling logic for easy updates + +--- + +## Entry 7 + +# Date/Time: +2025-09-15 21:15 + +# Tool: +GitHub Copilot (model: Claude Sonnet 4) + +# Prompt/Command: +Request to implement simple cookie utilities for JWT token storage and removal, ensuring compatibility with Next.js middleware authentication. + +# Output Summary: +- Created minimal cookie management utilities (/services/userServiceCookies.ts) +- Implemented addToken function for setting JWT token in browser cookies +- Implemented removeToken function for clearing authentication cookies on logout + + +# Action Taken: +- [x] Accepted as-is +- [ ] Modified +- [ ] Rejected + +# Author Notes: +- Validated cookie naming convention matches middleware token reading logic +- Confirmed simplicity over complexity for basic token storage requirements +- Maintainability: simple two-function API for easy integration across application + +--- + +## Entry 8 + +# Date/Time: +2025-09-16 00:05 + +# Tool: +GitHub Copilot (model: Claude Sonnet 4) + +# Prompt/Command: +Request to implement UserContext for managing user authentication state and create a global navigation bar that appears on all non-auth pages with conditional rendering. + +# Output Summary: +- Created React UserContext (/contexts/UserContext.tsx) for centralized user state management +- Implemented automatic token verification using verifyToken API +- Added user data persistence across page refreshes with token-based restoration +- Created Navbar component (/app/components/layout/Navbar.tsx) with PeerPrep branding and navigation +- Implemented NavbarWrapper (/app/components/layout/NavbarWrapper.tsx) for conditional rendering +- Updated root layout.tsx to include UserProvider and NavbarWrapper +- Enhanced LoginComponent to set user data in context after successful authentication +- Updated WelcomeComponent to display actual username from UserContext instead of hardcoded name +- Fixed cookie utilities with getToken function for token retrieval + +# Action Taken: +- [ ] Accepted as-is +- [x] Modified +- [ ] Rejected + +# Author Notes: +- Validated UserContext properly handles token verification through API calls rather than JWT parsing +- Confirmed conditional navbar rendering excludes auth pages (/auth/*) as required +- Reviewed user state persistence across page refreshes and browser sessions +- Tested integration between LoginComponent, UserContext, and display components +- Security considerations: Token verification through backend API ensures data integrity +- UX improvements: Consistent navigation experience with user-aware display elements +- Maintainability: Centralized user state management with clear separation of concerns +- Debug logging enables easier troubleshooting of authentication state issues +- Navbar modified by me after AI implementation to meet specific design requirements + +--- + +## Entry 9 + +# Date/Time: +2025-09-16 16:00 + +# Tool: +GitHub Copilot (model: Claude Sonnet 4) + +# Prompt/Command: +Configure Nginx reverse proxy for PeerPrep frontend and user service with proper routing, CORS handling, and Next.js client-side navigation support. + +# Output Summary: +- Configured Nginx API gateway for frontend and user service routing +- Fixed Docker networking issues for login redirects +- Enhanced API configuration for server-side vs client-side calls + +# Action Taken: +- [x] Accepted as-is +- [ ] Modified +- [ ] Rejected + +# Author Notes: +- Validated correctness, security, and performance of the configuration + +--- + +## Entry 10 + +# Date/Time: +2025-09-16 16:30 + +# Tool: +GitHub Copilot (model: Claude Sonnet 4) + +# Prompt/Command: +Fix Docker networking bug where middleware (server-side) and browser (client-side) need different API endpoints for same service. + +# Output Summary: +- Added dynamic axios client creation to handle different execution contexts +- Implemented separate URLs for server-side (http://user-service:4000) and client-side (http://localhost/api) calls +- Fixed middleware token verification failing due to incorrect API endpoint routing +- Added comprehensive documentation explaining the Docker networking solution + +# Action Taken: +- [x] Accepted as-is +- [ ] Modified +- [ ] Rejected + +# Author Notes: +- Validated dynamic client creation approach fixes Docker container-to-container communication issues +- Confirmed solution maintains proper API gateway routing for browser requests + +--- + +## Entry 11 + +# Date/Time: +2025-09-16 20:00 + +# Tool: +ChatGPT (model: GPT-4.1) + +# Prompt/Command: +Request to generate email regex validation. + +# Output Summary: +- Comprehensive regex pattern for validating email addresses +- Support for various email formats including subdomains and special characters +- Edge case handling for common email validation pitfalls + +# Action Taken: +- [x] Accepted as-is +- [ ] Modified +- [ ] Rejected + +# Author Notes: +- I validated correctness, security, and performance of the code + +--- + +## Entry 12 + +# Date/Time: +2025-09-16 21:00 + +# Tool: +GitHub Copilot (model: Claude Sonnet 4) + +# Prompt/Command: +Request to create a simple client-side auth guard that prevents browser back navigation to cached protected pages after logout. + +# Output Summary: +- Created AuthGuard component (/app/components/layout/AuthGuard.tsx) for layout-level protection +- Implemented pathname-based token checking using Next.js usePathname hook +- Added immediate redirect to login when no token found on protected routes +- Integrated AuthGuard into root layout.tsx for automatic protection on all pages +- Enhanced middleware with cookie clearing on redirects for complete logout state +- Combined server-side cache control headers with client-side token verification + +# Action Taken: +- [ ] Accepted as-is +- [x] Modified +- [ ] Rejected + +# Author Notes: +- Validated AuthGuard catches browser back navigation edge case after logout +- Confirmed minimal performance impact with simple token existence check +- Security implications: client-side protection complements server-side middleware +- UX improvements: immediate redirect prevents brief flash of protected content +- Maintainability: simple, reusable component for future auth requirements + +--- + + diff --git a/api-gateway/default.conf b/api-gateway/default.conf index 364512a..b1a85b3 100644 --- a/api-gateway/default.conf +++ b/api-gateway/default.conf @@ -1,3 +1,8 @@ +# AI Assistance Disclosure: +# Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-16 +# Purpose: To configure Nginx reverse proxy for PeerPrep frontend and user service with proper routing, CORS handling, and Next.js client-side navigation support. +# Author Review: I validated correctness, security, and performance of the configuration. + server { listen 80; listen [::]:80; @@ -5,25 +10,115 @@ server { #access_log /var/log/nginx/host.access.log main; + # Frontend - Main application location / { - root /usr/share/nginx/html; - index index.html index.htm; + proxy_pass http://frontend:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # WebSocket support for Next.js dev mode + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + # Next.js specific headers for proper routing + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_redirect off; + + # Ensure proper handling of Next.js routes + try_files $uri $uri/ @nextjs; + } + + # Fallback for Next.js client-side routing + location @nextjs { + proxy_pass http://frontend:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; } + # Next.js static files and assets + location /_next/ { + proxy_pass http://frontend:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # Cache static assets + expires 1y; + add_header Cache-Control "public, immutable"; + } - location /user/ { - default_type application/json; - return 200 '{"message": "User service route working"}'; + # User Service API + location /api/users/ { + proxy_pass http://user-service:4000/users/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # Handle CORS if needed + add_header Access-Control-Allow-Origin *; + add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"; + add_header Access-Control-Allow-Headers "Content-Type, Authorization"; + + # Handle preflight OPTIONS requests + if ($request_method = 'OPTIONS') { + return 204; + } + } + + # Auth Service API + location /api/auth/ { + proxy_pass http://user-service:4000/auth/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # Handle CORS if needed + add_header Access-Control-Allow-Origin *; + add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"; + add_header Access-Control-Allow-Headers "Content-Type, Authorization"; + + # Handle preflight OPTIONS requests + if ($request_method = 'OPTIONS') { + return 204; + } + } + + # MongoDB Express Admin Interface (if localdb profile is used) + # location /admin/ { + # proxy_pass http://mongo-express:8081/; + # proxy_set_header Host $host; + # proxy_set_header X-Real-IP $remote_addr; + # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + # proxy_set_header X-Forwarded-Proto $scheme; + # } + + # Health check endpoint + location /health { + access_log off; + return 200 '{"status": "healthy", "timestamp": "$time_iso8601"}'; + add_header Content-Type application/json; } - location /matching/ { + # Future services placeholders + location /api/matching/ { default_type application/json; - return 200 '{"message": "Matching service route working"}'; + return 501 '{"message": "Matching service not yet implemented"}'; } - location /collab/ { + location /api/collab/ { default_type application/json; - return 200 '{"message": "Collaboration service route working"}'; + return 501 '{"message": "Collaboration service not yet implemented"}'; } #error_page 404 /404.html; diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..85b3564 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,82 @@ +# PeerPrep Docker Compose Configuration +# TODO: when deploying to production, switch to using images from Docker Hub -> using 'image' and 'pull_policy' and remove 'build' sections +services: + # API Gateway - Routes all external traffic + api-gateway: + image: honeydews/api-gateway:latest + pull_policy: never + build: + context: ./api-gateway + dockerfile: Dockerfile + ports: + - "80:80" # HTTP traffic + - "443:443" # HTTPS traffic (if configured) + depends_on: + - frontend + - user-service + environment: + - FRONTEND_URL=http://frontend:3000 + - USER_SERVICE_URL=http://user-service:4000 + + # Frontend Next.js Application + # Scalable service with port range mapping + # container_name is omitted for scaling + # which is important for peerprep where we do matching + frontend: + image: honeydews/frontend + pull_policy: never + build: + context: ./frontend + dockerfile: Dockerfile + target: runner # Production build target + # Remove external port exposure - accessed via API Gateway + expose: + - "3000" # Internal port only + environment: + - NODE_ENV=production # Set Node.js to production mode + + user-service: + image: foochao/user-service + pull_policy: never + build: + context: ./user-service + dockerfile: Dockerfile + # Use the runner stage from the multi-stage Dockerfile (not production) + target: runner + # Remove external port exposure - accessed via API Gateway + expose: + - "4000" # Internal port only + env_file: + - ./user-service/.env # Environment variables for user-service + environment: + - NODE_ENV=production # Set Node.js to production mode + + ### NOTE: LOCAL DATABASE SERVICES YET TO BE TESTED BY ME DO NOT USE YET ### + + # MongoDB Database for User Services + mongodb-user-services: + image: mongo:7.0.12 + container_name: peerprep-mongodb-user-services + volumes: + - mongodb-data-user-services:/data/db # Persistent data storage + env_file: + - ./mongodb/.env # Database credentials + profiles: + - localdb # Only runs with --profile localdb + + # MongoDB Web Admin Interface + mongo-express: + image: mongo-express:1.0.2 + container_name: peerprep-mongo-express + expose: + - "8081" # Internal port only - accessed via API Gateway at /admin/ + env_file: + - ./mongo-express/.env # Connection settings + depends_on: + - mongodb-user-services # Requires MongoDB to be running + profiles: + - localdb # Only runs with --profile localdb + +# Named volumes for data persistence +volumes: + mongodb-data-user-services: diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 0000000..72e9aa4 --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1,7 @@ +Dockerfile +.dockerignore +node_modules +npm-debug.log +README.md +.next +.git \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..059df87 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,57 @@ +# syntax=docker.io/docker/dockerfile:1 + +FROM node:20-alpine AS base + +# Install dependencies only when needed +FROM base AS deps +# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. +RUN apk add --no-cache libc6-compat +WORKDIR /app + +# Install dependencies based on the preferred package manager +COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ + +RUN npm i --frozen-lockfile + +# Rebuild the source code only when needed +FROM base AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +# Next.js collects completely anonymous telemetry data about general usage. +# Learn more here: https://nextjs.org/telemetry +# Uncomment the following line in case you want to disable telemetry during the build. +# ENV NEXT_TELEMETRY_DISABLED=1 + +ENV NEXT_PRIVATE_STANDALONE=true +RUN npm run build + +# Production image, copy all the files and run next +FROM base AS runner +WORKDIR /app + +ENV NODE_ENV=production +# Uncomment the following line in case you want to disable telemetry during runtime. +# ENV NEXT_TELEMETRY_DISABLED=1 + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +COPY --from=builder /app/public ./public + +# Automatically leverage output traces to reduce image size +# https://nextjs.org/docs/advanced-features/output-file-tracing +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +USER nextjs + +EXPOSE 3000 + +ENV PORT=3000 + +# server.js is created by next build from the standalone output +# https://nextjs.org/docs/pages/api-reference/config/next-config-js/output +ENV HOSTNAME="0.0.0.0" +CMD ["node", "server.js"] \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 860cc9d..c664b2b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -10,8 +10,10 @@ "dependencies": { "@hookform/resolvers": "^5.2.1", "@radix-ui/react-dialog": "^1.1.15", + "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-slot": "^1.2.3", + "axios": "^1.12.2", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "lucide-react": "^0.542.0", @@ -20,6 +22,7 @@ "react-dom": "19.1.0", "react-hook-form": "^7.62.0", "react-icons": "^5.5.0", + "sonner": "^2.0.7", "tailwind-merge": "^3.3.1", "zod": "^4.1.5" }, @@ -224,6 +227,44 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@floating-ui/core": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.3.tgz", + "integrity": "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==", + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.10" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.4.tgz", + "integrity": "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.7.3", + "@floating-ui/utils": "^0.2.10" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.6.tgz", + "integrity": "sha512-4JX6rEatQEvlmgU80wZyq9RT96HZJa88q8hp0pBd+LrczeDI4o6uA2M+uvxngVHo4Ihr8uibXxH6+70zhAFrVw==", + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.7.4" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.10.tgz", + "integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==", + "license": "MIT" + }, "node_modules/@hookform/resolvers": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-5.2.1.tgz", @@ -980,6 +1021,55 @@ "integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==", "license": "MIT" }, + "node_modules/@radix-ui/react-arrow": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.7.tgz", + "integrity": "sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.1.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-collection": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.7.tgz", + "integrity": "sha512-Fh9rGN0MoI4ZFUNyfFVNU4y9LUz93u9/0K+yLgA2bwRojxM8JU1DyvvMBabnZPBgMWREAJvU2jjVzq+LrFUglw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-slot": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-compose-refs": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.2.tgz", @@ -1046,6 +1136,21 @@ } } }, + "node_modules/@radix-ui/react-direction": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.1.tgz", + "integrity": "sha512-1UEWRX6jnOA2y4H5WczZ44gOOjTEmlqv1uNW4GAJEO5+bauCBhv8snY65Iw5/VOS/ghKN9gr2KjnLKxrsvoMVw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-dismissable-layer": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.11.tgz", @@ -1073,6 +1178,35 @@ } } }, + "node_modules/@radix-ui/react-dropdown-menu": { + "version": "2.1.16", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dropdown-menu/-/react-dropdown-menu-2.1.16.tgz", + "integrity": "sha512-1PLGQEynI/3OX/ftV54COn+3Sud/Mn8vALg2rWnBLnRaGtJDduNW/22XjlGgPdpcIbiQxjKtb7BkcjP00nqfJw==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-menu": "2.1.16", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-controllable-state": "1.2.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-focus-guards": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.3.tgz", @@ -1154,6 +1288,78 @@ } } }, + "node_modules/@radix-ui/react-menu": { + "version": "2.1.16", + "resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.1.16.tgz", + "integrity": "sha512-72F2T+PLlphrqLcAotYPp0uJMr5SjP5SL01wfEspJbru5Zs5vQaSHb4VB3ZMJPimgHHCHG7gMOeOB9H3Hdmtxg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-collection": "1.1.7", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-direction": "1.1.1", + "@radix-ui/react-dismissable-layer": "1.1.11", + "@radix-ui/react-focus-guards": "1.1.3", + "@radix-ui/react-focus-scope": "1.1.7", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-popper": "1.2.8", + "@radix-ui/react-portal": "1.1.9", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-roving-focus": "1.1.11", + "@radix-ui/react-slot": "1.2.3", + "@radix-ui/react-use-callback-ref": "1.1.1", + "aria-hidden": "^1.2.4", + "react-remove-scroll": "^2.6.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popper": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.8.tgz", + "integrity": "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw==", + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.1.7", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-callback-ref": "1.1.1", + "@radix-ui/react-use-layout-effect": "1.1.1", + "@radix-ui/react-use-rect": "1.1.1", + "@radix-ui/react-use-size": "1.1.1", + "@radix-ui/rect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-portal": { "version": "1.1.9", "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.9.tgz", @@ -1225,6 +1431,37 @@ } } }, + "node_modules/@radix-ui/react-roving-focus": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.11.tgz", + "integrity": "sha512-7A6S9jSgm/S+7MdtNDSb+IU859vQqJ/QAtcYQcfFC6W8RS4IxIZDldLR0xqCFZ6DCyrQLjLPsxtTNch5jVA4lA==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-collection": "1.1.7", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-direction": "1.1.1", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-callback-ref": "1.1.1", + "@radix-ui/react-use-controllable-state": "1.2.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-slot": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz", @@ -1328,6 +1565,48 @@ } } }, + "node_modules/@radix-ui/react-use-rect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.1.tgz", + "integrity": "sha512-QTYuDesS0VtuHNNvMh+CjlKJ4LJickCMUAqjlE3+j8w+RlRpwyX3apEQKGFzbZGdo7XNG1tXa+bQqIE7HIXT2w==", + "license": "MIT", + "dependencies": { + "@radix-ui/rect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-size": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.1.tgz", + "integrity": "sha512-ewrXRDTAqAXlkl6t/fkXWNAhFX9I+CkKlw6zjEwk86RSPKwZr3xpBRso655aqYafwtnbpHLj6toFzmd6xdVptQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/rect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.1.1.tgz", + "integrity": "sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==", + "license": "MIT" + }, "node_modules/@rtsao/scc": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", @@ -2514,6 +2793,12 @@ "node": ">= 0.4" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -2540,6 +2825,17 @@ "node": ">=4" } }, + "node_modules/axios": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz", + "integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/axobject-query": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", @@ -2604,7 +2900,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0", @@ -2760,6 +3055,18 @@ "simple-swizzle": "^0.2.2" } }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2911,6 +3218,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/detect-libc": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", @@ -2944,7 +3260,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "dev": true, "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.1", @@ -3049,7 +3364,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -3059,7 +3373,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -3097,7 +3410,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", - "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0" @@ -3110,7 +3422,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", - "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0", @@ -3717,6 +4028,26 @@ "dev": true, "license": "ISC" }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", @@ -3733,11 +4064,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/form-data": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3778,7 +4124,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "dev": true, "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", @@ -3812,7 +4157,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "dev": true, "license": "MIT", "dependencies": { "dunder-proto": "^1.0.1", @@ -3900,7 +4244,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -3979,7 +4322,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -3992,7 +4334,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", - "dev": true, "license": "MIT", "dependencies": { "has-symbols": "^1.0.3" @@ -4008,7 +4349,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, "license": "MIT", "dependencies": { "function-bind": "^1.1.2" @@ -4931,7 +5271,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -4961,6 +5300,27 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -5478,6 +5838,12 @@ "react-is": "^16.13.1" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -6026,6 +6392,16 @@ "is-arrayish": "^0.3.1" } }, + "node_modules/sonner": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.7.tgz", + "integrity": "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==", + "license": "MIT", + "peerDependencies": { + "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc", + "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc" + } + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index 2cf9706..8ce79a4 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,8 +13,10 @@ "dependencies": { "@hookform/resolvers": "^5.2.1", "@radix-ui/react-dialog": "^1.1.15", + "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-slot": "^1.2.3", + "axios": "^1.12.2", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "lucide-react": "^0.542.0", @@ -23,6 +25,7 @@ "react-dom": "19.1.0", "react-hook-form": "^7.62.0", "react-icons": "^5.5.0", + "sonner": "^2.0.7", "tailwind-merge": "^3.3.1", "zod": "^4.1.5" }, diff --git a/frontend/src/app/components/auth/LoginComponent.tsx b/frontend/src/app/components/auth/LoginComponent.tsx index 5211d27..0844d77 100644 --- a/frontend/src/app/components/auth/LoginComponent.tsx +++ b/frontend/src/app/components/auth/LoginComponent.tsx @@ -1,15 +1,83 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-15 + * Purpose: To implement controlled state management and password visibility toggle in login component, maintaining consistency with signup component patterns. + * Author Review: I validated correctness, security, and performance of the code. + */ + "use client"; import { Button } from "@/components/ui/button"; import { Card, CardTitle, CardHeader, CardContent } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; +import { Eye, EyeOff } from "lucide-react"; import Link from "next/link"; +import { useState } from "react"; +import { useRouter } from "next/navigation"; +import { login } from "@/services/userServiceApi"; +import { handleApiError, handleApiSuccess } from "@/services/errorHandler"; +import { toast } from "sonner"; +import { addToken } from "@/services/userServiceCookies"; +import { useUser } from "@/contexts/UserContext"; export default function LoginForm() { - function handleLogin() { - window.location.href = "/home"; - } + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [showPassword, setShowPassword] = useState(false); + + const router = useRouter(); + const { setUser } = useUser(); + + const handleLogin = async (e: React.MouseEvent) => { + e.preventDefault(); + + // Basic validation + if (!email || !password) { + toast.error("Please fill in all fields"); + return; + } + + try { + const response = await login(email, password); + + // Check if we got a token + const token = + response?.data?.data?.accessToken || response?.data?.accessToken; + if (!token) { + toast.error("Login failed: No token received"); + return; + } + + // Store token + addToken(token); + + // Set user data from the API response + const userData = response?.data?.data; + if (userData?.username && userData?.email) { + setUser({ + username: userData.username, + email: userData.email, + }); + } + + // Show success message + handleApiSuccess( + "Login successful!", + `Welcome back! Redirecting to homepage...`, + response.data, + ); + + // Use router.replace instead of push for better Docker/Nginx compatibility + setTimeout(() => { + toast.dismiss(); + router.replace("/home"); + }, 1000); + } catch (error) { + console.error("Login error details:", error); + handleApiError(error, "Login failed"); + } + }; return ( @@ -24,15 +92,43 @@ export default function LoginForm() {
- + setEmail(e.target.value)} + required + />
- +
+ setPassword(e.target.value)} + required + /> + +
-
-
diff --git a/frontend/src/app/components/auth/SignUpComponent.tsx b/frontend/src/app/components/auth/SignUpComponent.tsx index 32a26e6..ae44ec5 100644 --- a/frontend/src/app/components/auth/SignUpComponent.tsx +++ b/frontend/src/app/components/auth/SignUpComponent.tsx @@ -1,17 +1,191 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude 4 Sonnet), date: 2025-09-15 + * Purpose: To implement comprehensive signup form improvements including controlled inputs, + * debounced password validation, password complexity requirements with visual indicators, + * and enhanced UX patterns. + * Author Review: I validated correctness, security, and performance of the code. + * + * Tool: ChatGPT (model: GPT-4.1, date: 2025-09-16) + * Purpose: To Generate email regex validation + * Author Review: I validated correctness, security, and performance of the code. + */ + "use client"; import { Button } from "@/components/ui/button"; import { Card, CardTitle, CardHeader, CardContent } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; +import { DebouncedInput } from "@/components/ui/debouncedInput"; +import { Eye, EyeOff, UserPlus, AlertCircle, Check, X } from "lucide-react"; +import React, { useState } from "react"; +import { toast } from "sonner"; +import { signup } from "@/services/userServiceApi"; +import { handleApiError, handleApiSuccess } from "@/services/errorHandler"; +import Link from "next/link"; +import { useRouter } from "next/navigation"; export default function SignupForm() { - function NavigateToLogin() { - window.location.href = "/auth/login"; - } + const router = useRouter(); + + //#region states + // main state + const [username, setUsername] = useState(""); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [confirmPassword, setConfirmPassword] = useState(""); + + // UI password states + const [showPassword, setShowPassword] = useState(false); + const [showConfirmPassword, setShowConfirmPassword] = useState(false); + const [isPasswordFocused, setIsPasswordFocused] = useState(false); + // password validation states + const [passwordMatchError, setPasswordMatchError] = useState(""); + const [passwordValidation, setPasswordValidation] = useState({ + length: false, + uppercase: false, + lowercase: false, + number: false, + special: false, + }); + + //#endregion + + //#region derived states + const isPasswordsMatch = password === confirmPassword; + //#endregion + + //#region regex + // Password validation regex patterns + const passwordRegex = { + length: /.{8,}/, // At least 8 characters + uppercase: /[A-Z]/, // At least one uppercase letter + lowercase: /[a-z]/, // At least one lowercase letter + number: /\d/, // At least one number + special: /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/, // At least one special character + }; + //#endregion + + //#region password methods + // Check if password meets all requirements + const isPasswordValid = Object.values(passwordValidation).every(Boolean); + + // Handle debounced confirm password validation + const handleConfirmPasswordChange = (value: string) => { + // Only show error if both fields have content and they don't match + if (password && value && password !== value) { + setPasswordMatchError("Passwords do not match"); + } else { + setPasswordMatchError(""); + } + }; + + // Handle password change and validate complexity + const handlePasswordChange = (e: React.ChangeEvent) => { + const newPassword = e.target.value; + setPassword(newPassword); + + // Validate password complexity + setPasswordValidation({ + length: passwordRegex.length.test(newPassword), + uppercase: passwordRegex.uppercase.test(newPassword), + lowercase: passwordRegex.lowercase.test(newPassword), + number: passwordRegex.number.test(newPassword), + special: passwordRegex.special.test(newPassword), + }); + + // Clear error if passwords now match + if (confirmPassword && newPassword === confirmPassword) { + setPasswordMatchError(""); + } + }; + //#endregion + + //#region other methods + const onRegister = async (e: React.MouseEvent) => { + e.preventDefault(); + + const trimmedUsername = username.trim(); + const trimmedEmail = email.trim(); + // Specific validation checks with toast messages + if (!trimmedUsername) { + toast.error("Username is required!", { + description: "Please enter a username to continue.", + }); + return; + } + + if (!trimmedEmail) { + toast.error("Email is required!", { + description: "Please enter your email address.", + }); + return; + } + + // check if email format is valid using simple regex + const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + if (!emailPattern.test(trimmedEmail)) { + toast.error("Invalid email format!", { + description: "Please enter a valid email address.", + }); + return; + } + + if (!password) { + toast.error("Password is required!", { + description: "Please create a password for your account.", + }); + return; + } + if (!isPasswordValid) { + toast.error("Password doesn't meet requirements!", { + description: "Please check the password requirements below.", + }); + return; + } + + if (!confirmPassword) { + toast.error("Please confirm your password!", { + description: "Enter your password again to confirm.", + }); + return; + } + + if (!isPasswordsMatch) { + toast.error("Passwords don't match!", { + description: "Please make sure both password fields are identical.", + }); + return; + } + + try { + // sign up using apis - Axios automatically parses JSON + const response = await signup(trimmedUsername, trimmedEmail, password); + + // Use reusable success handler + handleApiSuccess( + response.data.message || "Account created successfully!", + `Welcome ${response.data.data?.username}! You can now sign in.`, + response.data.data, + ); + + //Redirect to login after short delay + setTimeout(() => { + router.push("/auth/login"); + }, 1500); + } catch (error: unknown) { + // Use reusable error handler + handleApiError(error, "Failed to create account"); + } + }; + //#endregion + + //#region rendering return ( - + + {/*Header */} Register an account @@ -21,25 +195,183 @@ export default function SignupForm() {
+ {/* Username input */} +
+ + setUsername(e.target.value)} + required + /> +
+ + {/* Email input */}
- + setEmail(e.target.value)} + required + />
+ + {/* Password input with visibility toggle */}
- -
+
+ setIsPasswordFocused(true)} + onBlur={() => setIsPasswordFocused(false)} + required + /> + +
-
- + {/* Password strength requirements */} + {(isPasswordFocused || password !== "") && !isPasswordValid && ( +
+
+ Password Requirements: +
+
+
+ {passwordValidation.length ? ( + + ) : ( + + )} + At least 8 characters +
+
+ {passwordValidation.uppercase ? ( + + ) : ( + + )} + One uppercase letter (A-Z) +
+
+ {passwordValidation.lowercase ? ( + + ) : ( + + )} + One lowercase letter (a-z) +
+
+ {passwordValidation.number ? ( + + ) : ( + + )} + One number (0-9) +
+
+ {passwordValidation.special ? ( + + ) : ( + + )} + One special character (!@#$%^&*) +
+
+
+ )}
+ {/* Confirm Password input with visibility toggle */}
- + +
+ setConfirmPassword(e.target.value)} + onDebouncedChange={handleConfirmPasswordChange} + debounceMs={300} + required + /> + +
+ + {/* Password match error message */} + {passwordMatchError && ( +
+ + {passwordMatchError} +
+ )} +
+ + {/* Register Button and already have an account*/} +
+ +
+ + {/* Navigate to login page */} +
+
+ Already have an account? +
+ + Sign in here +
); + //#endregion } diff --git a/frontend/src/app/components/home/WelcomeComponent.tsx b/frontend/src/app/components/home/WelcomeComponent.tsx index 827b43b..918bbed 100644 --- a/frontend/src/app/components/home/WelcomeComponent.tsx +++ b/frontend/src/app/components/home/WelcomeComponent.tsx @@ -2,10 +2,15 @@ import { Card, CardTitle, CardHeader, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; +import { useUser } from "@/contexts/UserContext"; +import { useRouter } from "next/navigation"; export default function WelcomePage() { - function directToHome() { - window.location.href = "/match"; + const { user } = useUser(); + const router = useRouter(); + + function directToMatch() { + router.push("/match"); } return ( @@ -13,7 +18,7 @@ export default function WelcomePage() { Hello -

Derrick Wong

+

{user?.username || "Guest"}

Ready to start coding?
@@ -21,7 +26,7 @@ export default function WelcomePage() { diff --git a/frontend/src/app/components/layout/AuthGuard.tsx b/frontend/src/app/components/layout/AuthGuard.tsx new file mode 100644 index 0000000..e3b9df3 --- /dev/null +++ b/frontend/src/app/components/layout/AuthGuard.tsx @@ -0,0 +1,98 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-16 + * Purpose: To create a simple client-side auth guard that prevents browser back navigation to cached protected pages after logout. + * Author Review: I validated correctness, security, and performance of the code. + * + */ + +/** + * Simple client-side auth guard that checks for token on page navigation. + * This catches cases where browser back button bypasses middleware cache controls. + */ + +"use client"; + +import { useEffect } from "react"; +import { usePathname, useRouter } from "next/navigation"; +import { getToken } from "@/services/userServiceCookies"; + +export default function AuthGuard() { + const pathname = usePathname(); + const router = useRouter(); + + // Check token immediately on mount and pathname changes + useEffect(() => { + // Skip auth routes + if (pathname.startsWith("/auth")) { + return; + } + + // Check for token + const token = getToken(); + if (!token) { + console.log("AuthGuard: No token found, redirecting to login"); + // Use setTimeout to ensure this runs after render + setTimeout(() => { + router.push("/auth/login"); + }, 0); + } + }, [pathname, router]); + + // Add popstate listener specifically for browser back/forward navigation + useEffect(() => { + const handlePopState = () => { + if (!pathname.startsWith("/auth")) { + const token = getToken(); + if (!token) { + console.log( + "AuthGuard: No token found on popstate (back/forward), redirecting to login", + ); + router.push("/auth/login"); + } + } + }; + + window.addEventListener("popstate", handlePopState); + return () => window.removeEventListener("popstate", handlePopState); + }, [pathname, router]); + + // Add visibility change listener to catch tab switching scenarios + useEffect(() => { + const handleVisibilityChange = () => { + if (!document.hidden && !pathname.startsWith("/auth")) { + const token = getToken(); + if (!token) { + console.log( + "AuthGuard: No token found on visibility change, redirecting to login", + ); + router.push("/auth/login"); + } + } + }; + + document.addEventListener("visibilitychange", handleVisibilityChange); + return () => + document.removeEventListener("visibilitychange", handleVisibilityChange); + }, [pathname, router]); + + // Add focus listener for additional protection + useEffect(() => { + const handleFocus = () => { + if (!pathname.startsWith("/auth")) { + const token = getToken(); + if (!token) { + console.log( + "AuthGuard: No token found on focus, redirecting to login", + ); + router.push("/auth/login"); + } + } + }; + + window.addEventListener("focus", handleFocus); + return () => window.removeEventListener("focus", handleFocus); + }, [pathname, router]); + + return null; // This component renders nothing +} diff --git a/frontend/src/app/components/layout/Navbar.tsx b/frontend/src/app/components/layout/Navbar.tsx new file mode 100644 index 0000000..f395c11 --- /dev/null +++ b/frontend/src/app/components/layout/Navbar.tsx @@ -0,0 +1,128 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-15 + * Purpose: To create a reusable navigation bar component for the PeerPrep application. + * Author Review: I validated correctness, security, and performance of the code. + * I modified the styling to match the application's theme. + */ + +"use client"; + +import Link from "next/link"; +import { usePathname } from "next/navigation"; +import { useRouter } from "next/navigation"; +import { Button } from "@/components/ui/button"; +import { User, LogOut, ChevronDown } from "lucide-react"; +import { removeToken } from "@/services/userServiceCookies"; +import { useUser } from "@/contexts/UserContext"; +import Image from "next/image"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; + +export default function Navbar() { + const pathname = usePathname(); + const { user, setUser } = useUser(); + const router = useRouter(); + + const navItems = [ + { name: "Dashboard", href: "/home" }, + { name: "Find Partner", href: "/match" }, + ]; + + const handleLogout = () => { + // Clear user context first + setUser(null); + + // Clear token from cookies + removeToken(); + + // Clear all localStorage and sessionStorage + if (typeof window !== "undefined") { + localStorage.clear(); + sessionStorage.clear(); + } + + // Use Next.js router.push for client-side navigation + router.push("/auth/login"); + }; + + return ( + + ); +} diff --git a/frontend/src/app/components/layout/NavbarWrapper.tsx b/frontend/src/app/components/layout/NavbarWrapper.tsx new file mode 100644 index 0000000..05e7885 --- /dev/null +++ b/frontend/src/app/components/layout/NavbarWrapper.tsx @@ -0,0 +1,24 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-16 + * Purpose: To implement conditional navbar rendering that hides navigation on authentication pages using Next.js pathname detection. + * Author Review: I validated correctness, security, and performance of the code. + */ + +"use client"; + +import { usePathname } from "next/navigation"; +import Navbar from "./Navbar"; + +export default function NavbarWrapper() { + const pathname = usePathname(); + + // Don't show navbar on auth pages + const isAuthPage = pathname.startsWith("/auth"); + + if (isAuthPage) { + return null; + } + + return ; +} diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index f28b732..7df16d2 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -1,3 +1,10 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-15 + * Purpose: To implement custom toast notification styling with enhanced visual effects and type-specific colors. + * Author Review: I validated correctness, security, and performance of the code. + */ + @import "tailwindcss"; @import "tw-animate-css"; @@ -128,3 +135,33 @@ @apply bg-background text-foreground; } } + +/* Custom Toast Styling */ +.toast-custom { + backdrop-filter: blur(8px); + background: rgba(255, 255, 255, 0.95) !important; + border: 1px solid rgba(0, 0, 0, 0.1) !important; + transition: all 0.2s ease-in-out; +} + +.toast-custom:hover { + transform: translateY(-2px); + box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15) !important; +} + +/* Toast type specific styling */ +[data-sonner-toast][data-type="success"] .toast-custom { + border-left: 4px solid #22c55e !important; +} + +[data-sonner-toast][data-type="error"] .toast-custom { + border-left: 4px solid #ef4444 !important; +} + +[data-sonner-toast][data-type="loading"] .toast-custom { + border-left: 4px solid #3b82f6 !important; +} + +[data-sonner-toast][data-type="info"] .toast-custom { + border-left: 4px solid #6366f1 !important; +} diff --git a/frontend/src/app/home/page.tsx b/frontend/src/app/home/page.tsx index eef6c2a..4454a99 100644 --- a/frontend/src/app/home/page.tsx +++ b/frontend/src/app/home/page.tsx @@ -5,17 +5,9 @@ import WelcomePage from "../components/home/WelcomeComponent"; export default function HomePage() { return ( -
-
-
hamburger
-
PeerPrep
-
Avatar
-
- +
- -
diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index f7fa87e..7c146d9 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -1,5 +1,16 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-15 + * Purpose: To configure Sonner toast notifications with top-center positioning and custom styling options. + * Author Review: I validated correctness, security, and performance of the code. + */ + import type { Metadata } from "next"; import { Geist, Geist_Mono } from "next/font/google"; +import { Toaster } from "sonner"; +import { UserProvider } from "@/contexts/UserContext"; +import NavbarWrapper from "./components/layout/NavbarWrapper"; +import AuthGuard from "./components/layout/AuthGuard"; import "./globals.css"; const geistSans = Geist({ @@ -13,8 +24,8 @@ const geistMono = Geist_Mono({ }); export const metadata: Metadata = { - title: "Create Next App", - description: "Generated by create next app", + title: "PeerPrep", + description: "A collaborative coding platform for interview preparation", }; export default function RootLayout({ @@ -27,7 +38,31 @@ export default function RootLayout({ - {children} + + + + {children} + + ); diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index c369ca3..c85f89a 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -1,5 +1,6 @@ import { redirect } from "next/navigation"; -export default function Home() { - redirect("/auth/login"); +export default function RootRedirect() { + redirect("/home"); + return null; } diff --git a/frontend/src/components/ui/debouncedInput.tsx b/frontend/src/components/ui/debouncedInput.tsx new file mode 100644 index 0000000..7b5ad94 --- /dev/null +++ b/frontend/src/components/ui/debouncedInput.tsx @@ -0,0 +1,72 @@ +/** + * AI Assistance Disclosure: + * Tool: ChatGPT (model: ChatGPT-4.1), date: 2025-09-15 + * Purpose: To implement a reusable debounced input component in React. + * Author Review: I validated correctness, security, and performance of the code. + */ + +"use client"; + +import * as React from "react"; +import { Input } from "@/components/ui/input"; + +// Custom hook: Returns a value only after 'delay' ms have passed without change +function useDebouncedValue(value: T, delay: number): T { + const [debounced, setDebounced] = React.useState(value); + + React.useEffect(() => { + // Set up a timer: update debounced value only after the delay + const handler = setTimeout(() => setDebounced(value), delay); + + // If value or delay changes, clear the timer + return () => clearTimeout(handler); + }, [value, delay]); + + return debounced; +} + +// Extend HTML input props to include debounced callback and delay +export interface DebouncedInputProps extends React.ComponentProps<"input"> { + onDebouncedChange?: (value: string) => void; // Called after user stops typing + debounceMs?: number; // Debounce duration, default 300ms +} + +// Forward ref so this input can be used like a normal input (with refs) +export const DebouncedInput = React.forwardRef< + HTMLInputElement, + DebouncedInputProps +>(({ onDebouncedChange, debounceMs = 300, ...props }, ref) => { + // Internal state for input value + const [value, setValue] = React.useState(props.value?.toString() || ""); + + // Sync with controlled value (if parent updates value prop) + React.useEffect(() => { + if (typeof props.value === "string" || typeof props.value === "number") { + setValue(props.value.toString()); + } + }, [props.value]); + + // Debounced version of the value (only updates after debounceMs) + const debounced = useDebouncedValue(value, debounceMs); + + // Fire debounced callback only when debounced value changes + React.useEffect(() => { + if (onDebouncedChange) onDebouncedChange(debounced); + // eslint-disable-next-line + }, [debounced]); + + return ( + { + setValue(e.target.value); + props.onChange?.(e); // Call parent onChange if supplied + }} + /> + ); +}); + +DebouncedInput.displayName = "DebouncedInput"; diff --git a/frontend/src/components/ui/dropdown-menu.tsx b/frontend/src/components/ui/dropdown-menu.tsx new file mode 100644 index 0000000..1fc1f4e --- /dev/null +++ b/frontend/src/components/ui/dropdown-menu.tsx @@ -0,0 +1,257 @@ +"use client"; + +import * as React from "react"; +import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; +import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"; + +import { cn } from "@/lib/utils"; + +function DropdownMenu({ + ...props +}: React.ComponentProps) { + return ; +} + +function DropdownMenuPortal({ + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function DropdownMenuTrigger({ + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function DropdownMenuContent({ + className, + sideOffset = 4, + ...props +}: React.ComponentProps) { + return ( + + + + ); +} + +function DropdownMenuGroup({ + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function DropdownMenuItem({ + className, + inset, + variant = "default", + ...props +}: React.ComponentProps & { + inset?: boolean; + variant?: "default" | "destructive"; +}) { + return ( + + ); +} + +function DropdownMenuCheckboxItem({ + className, + children, + checked, + ...props +}: React.ComponentProps) { + return ( + + + + + + + {children} + + ); +} + +function DropdownMenuRadioGroup({ + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function DropdownMenuRadioItem({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + + + + + + + {children} + + ); +} + +function DropdownMenuLabel({ + className, + inset, + ...props +}: React.ComponentProps & { + inset?: boolean; +}) { + return ( + + ); +} + +function DropdownMenuSeparator({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function DropdownMenuShortcut({ + className, + ...props +}: React.ComponentProps<"span">) { + return ( + + ); +} + +function DropdownMenuSub({ + ...props +}: React.ComponentProps) { + return ; +} + +function DropdownMenuSubTrigger({ + className, + inset, + children, + ...props +}: React.ComponentProps & { + inset?: boolean; +}) { + return ( + + {children} + + + ); +} + +function DropdownMenuSubContent({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +export { + DropdownMenu, + DropdownMenuPortal, + DropdownMenuTrigger, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuLabel, + DropdownMenuItem, + DropdownMenuCheckboxItem, + DropdownMenuRadioGroup, + DropdownMenuRadioItem, + DropdownMenuSeparator, + DropdownMenuShortcut, + DropdownMenuSub, + DropdownMenuSubTrigger, + DropdownMenuSubContent, +}; diff --git a/frontend/src/contexts/UserContext.tsx b/frontend/src/contexts/UserContext.tsx new file mode 100644 index 0000000..1baab23 --- /dev/null +++ b/frontend/src/contexts/UserContext.tsx @@ -0,0 +1,85 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-16 + * Purpose: To implement React UserContext for managing user authentication state with automatic token verification and user data fetching from API. + * Author Review: I validated correctness, security, and performance of the code. + */ + +"use client"; + +import React, { + createContext, + useContext, + useState, + useEffect, + ReactNode, +} from "react"; +import { getToken } from "@/services/userServiceCookies"; +import { verifyToken } from "@/services/userServiceApi"; + +interface User { + username: string; + email: string; +} + +interface UserContextType { + user: User | null; + setUser: (user: User | null) => void; +} + +const UserContext = createContext(undefined); + +export const useUser = () => { + const context = useContext(UserContext); + if (context === undefined) { + throw new Error("useUser must be used within a UserProvider"); + } + return context; +}; + +interface UserProviderProps { + children: ReactNode; +} + +export const UserProvider: React.FC = ({ children }) => { + const [user, setUser] = useState(null); + + useEffect(() => { + console.log("UserContext useEffect triggered, current user:", user); + + // If user context is empty but we have a token, fetch user data + if (!user) { + const token = getToken(); + console.log("Token from cookies:", token); + + if (token) { + console.log("Token found, calling verifyToken API..."); + verifyToken(token) + .then((response) => { + console.log("VerifyToken response:", response.data); + const userData = response.data?.data; + if (userData?.username && userData?.email) { + console.log("Setting user data:", userData); + setUser({ + username: userData.username, + email: userData.email, + }); + } else { + console.log("User data incomplete:", userData); + } + }) + .catch((error) => { + console.error("Error verifying token:", error); + }); + } else { + console.log("No token found in cookies"); + } + } + }, [user]); + + return ( + + {children} + + ); +}; diff --git a/frontend/src/middleware.ts b/frontend/src/middleware.ts new file mode 100644 index 0000000..778ee92 --- /dev/null +++ b/frontend/src/middleware.ts @@ -0,0 +1,101 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-16 + * Purpose: To fix a bug where users can navigate back to protected pages after logout by implementing cache control headers in middleware. + * Author Review: I validated correctness, security, and performance of the code. + */ + +import { NextResponse } from "next/server"; +import type { NextRequest } from "next/server"; +import { verifyToken } from "@/services/userServiceApi"; + +// Middleware to protect routes and verify JWT token +export async function middleware(request: NextRequest) { + const { pathname } = request.nextUrl; + const token = request.cookies.get("token")?.value; + const isAuthRoute = pathname.startsWith("/auth"); + + // Allow static files (images, icons, etc.) + const isStaticFile = /\.(png|jpg|jpeg|gif|svg|ico|webp)$/i.test(pathname); + if (isStaticFile) { + return NextResponse.next(); + } + + // Allow access to auth routes without token + if (isAuthRoute) { + return NextResponse.next(); + } + + // If no token, redirect to login + if (!token) { + const loginUrl = new URL("/auth/login", request.url); + const response = NextResponse.redirect(loginUrl); + + // Clear any existing token cookie to ensure clean state + response.cookies.set("token", "", { + path: "/", + expires: new Date(0), + }); + + return response; + } + + try { + // Verify token with backend + const response = await verifyToken(token); + + if (response.status !== 200) { + // Token is invalid, redirect to login + const loginUrl = new URL("/auth/login", request.url); + const redirectResponse = NextResponse.redirect(loginUrl); + + // Clear invalid token cookie + redirectResponse.cookies.set("token", "", { + path: "/", + expires: new Date(0), + }); + + return redirectResponse; + } + + // Token is valid, allow access but add cache control headers + const response_next = NextResponse.next(); + + // Prevent browser caching of protected pages to avoid back navigation issues + response_next.headers.set( + "Cache-Control", + "no-cache, no-store, must-revalidate", + ); + response_next.headers.set("Pragma", "no-cache"); + response_next.headers.set("Expires", "0"); + + return response_next; + } catch (error) { + console.error("Token verification failed:", error); + // On error, redirect to login + const loginUrl = new URL("/auth/login", request.url); + const redirectResponse = NextResponse.redirect(loginUrl); + + // Clear potentially corrupted token cookie + redirectResponse.cookies.set("token", "", { + path: "/", + expires: new Date(0), + }); + + return redirectResponse; + } +} + +// Configure which paths the middleware should run on +export const config = { + matcher: [ + /* + * Match all request paths except for the ones starting with: + * - auth (authentication routes) + * - api (API routes) + * - _next (Next.js internals) + * - favicon.ico + */ + "/((?!auth|api|_next|favicon.ico).*)", + ], +}; diff --git a/frontend/src/services/errorHandler.ts b/frontend/src/services/errorHandler.ts new file mode 100644 index 0000000..bf849bc --- /dev/null +++ b/frontend/src/services/errorHandler.ts @@ -0,0 +1,187 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-15 + * Purpose: To implement reusable error handling utilities for consistent API error management and user feedback across the application. + * Author Review: I validated correctness, security, and performance of the code. + */ + +/** + * Utility functions for handling API errors consistently across the application + */ + +import { toast } from "sonner"; + +// Type definitions for error handling +export interface ErrorResponse { + message: string; + status?: number; + type: "server" | "network" | "unknown"; +} + +/** + * Extracts error information from different types of errors + * @param error - The caught error object + * @returns Normalized error information + */ +export function extractErrorInfo(error: unknown): ErrorResponse { + // Handle Axios errors + if (error && typeof error === "object" && "response" in error) { + // Server responded with error status (400, 409, 500, etc.) + const axiosError = error as { + response: { + status: number; + data?: { message?: string }; + }; + }; + + return { + message: axiosError.response.data?.message || "Server error occurred", + status: axiosError.response.status, + type: "server", + }; + } + + // Handle network errors (no response received) + if (error && typeof error === "object" && "request" in error) { + return { + message: "Unable to connect to server. Please check your connection.", + type: "network", + }; + } + + // Handle other errors + const errorMessage = + error instanceof Error ? error.message : "An unexpected error occurred"; + return { + message: errorMessage, + type: "unknown", + }; +} + +/** + * Displays appropriate toast notification based on error type + * @param error - The caught error object + * @param customTitle - Optional custom title for the toast + * @param customDescription - Optional custom description override + */ +export function handleApiError( + error: unknown, + customTitle?: string, + customDescription?: string, +): void { + console.error("API Error:", error); + + const errorInfo = extractErrorInfo(error); + + // Dismiss any existing loading toasts + toast.dismiss(); + + // Determine toast title and description + let title = customTitle; + const description = customDescription || errorInfo.message; + + // Set default titles based on error type if not provided + if (!title) { + switch (errorInfo.type) { + case "server": + title = getServerErrorTitle(errorInfo.status); + break; + case "network": + title = "Connection Error"; + break; + default: + title = "Error"; + break; + } + } + + // Show toast notification + toast.error(title, { + description: description, + }); +} + +/** + * Gets appropriate title for server errors based on status code + * @param status - HTTP status code + * @returns Appropriate error title + */ +function getServerErrorTitle(status?: number): string { + if (!status) return "Server Error"; + + switch (status) { + case 400: + return "Invalid Request"; + case 401: + return "Authentication Required"; + case 403: + return "Access Denied"; + case 404: + return "Not Found"; + case 409: + return "Conflict"; + case 422: + return "Validation Error"; + case 429: + return "Too Many Requests"; + case 500: + return "Server Error"; + case 502: + return "Service Unavailable"; + case 503: + return "Service Unavailable"; + default: + return "Server Error"; + } +} + +/** + * Handles API success responses with consistent toast notifications + * @param message - Success message from API or custom message + * @param description - Optional description + * @param userData - Optional user data to include in message + */ +export function handleApiSuccess( + message: string, + description?: string, + userData?: { username?: string }, +): void { + // Dismiss any existing loading toasts + toast.dismiss(); + + // Enhance description with user data if available + let finalDescription = description; + if (userData?.username && !description) { + finalDescription = `Welcome ${userData.username}!`; + } + + toast.success(message, { + description: finalDescription, + }); +} + +/** + * Higher-order function that wraps async operations with error handling + * @param operation - The async operation to execute + * @param errorTitle - Custom error title + * @param successMessage - Custom success message + * @returns Promise that handles errors automatically + */ +export async function withErrorHandling( + operation: () => Promise, + errorTitle?: string, + successMessage?: string, +): Promise { + try { + const result = await operation(); + + if (successMessage) { + toast.success(successMessage); + } + + return result; + } catch (error) { + handleApiError(error, errorTitle); + return null; + } +} diff --git a/frontend/src/services/userServiceApi.ts b/frontend/src/services/userServiceApi.ts new file mode 100644 index 0000000..ec2faec --- /dev/null +++ b/frontend/src/services/userServiceApi.ts @@ -0,0 +1,155 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-16 + * Purpose: To fix Docker networking bug where middleware (server-side) and browser (client-side) need different API endpoints for same service. + * Author Review: I validated correctness, security, and performance of the dynamic client creation approach. + */ + +// API Configuration for PeerPrep Frontend +// Based on docker-compose.yml configuration with API Gateway +import axios from "axios"; + +// TypeScript interfaces for API responses +export interface User { + id: string; + username: string; + email: string; + isAdmin: boolean; + createdAt: string; +} + +export interface ApiResponse { + message: string; + data?: T; +} + +/** + * Dynamic Base URL Detection + * + * This function determines the correct API endpoint based on execution context: + * - Server-side (middleware): Direct container-to-container communication + * - Client-side (browser): Through API Gateway proxy + * + * This fixes a Docker networking bug where the same code runs in different environments + * and needs different URLs to reach the same service. + */ +const getBaseURL = () => { + // Check if we're running server-side (middleware) or client-side (browser) + const isServerSide = typeof window === "undefined"; + + if (process.env.NODE_ENV === "production") { + if (isServerSide) { + // Server-side: Direct call to user-service container + // This bypasses the API gateway for internal Docker networking + return "http://user-service:4000"; + } else { + // Client-side: Through API Gateway + // Browser requests go through the nginx proxy on localhost + return "http://localhost/api"; + } + } else { + // Development: Direct to user-service (no Docker containers) + return "http://localhost:4000"; + } +}; + +/** + * Dynamic Axios Client Creation + * + * We create a new axios instance for each request instead of using a module-level singleton. + * This is necessary because: + * + * 1. The same module code runs in both server-side (middleware) and client-side (browser) contexts + * 2. Each context needs a different base URL to reach the user service + * 3. A singleton axios instance would "freeze" the URL from the first context that loads it + * 4. Dynamic creation ensures getBaseURL() runs fresh for each request context + * + * This fixes the Docker networking bug where middleware couldn't reach the user service. + */ +const createApiClient = () => { + return axios.create({ + baseURL: getBaseURL(), // Fresh URL calculation for current execution context + headers: { + "Content-Type": "application/json", + }, + timeout: 10000, // 10 seconds timeout + }); +}; + +// API Endpoints +const API_ENDPOINTS = { + // users + USER_SERVICE: "/users", + // auth + AUTH_SERVICE: "/auth", +}; + +/** + * @param token JWT token string + * @returns Response containing the user name + */ +const verifyToken = async (token: string) => { + try { + const apiClient = createApiClient(); + const response = await apiClient.get( + `${API_ENDPOINTS.AUTH_SERVICE}/verify-token`, + { + headers: { + Authorization: `Bearer ${token}`, + }, + }, + ); + return response; + } catch (error) { + console.error("Error verifying token:", error); + throw error; + } +}; + +/** + * Logs in a user with email and password + * @param email User's email address + * @param password User's password + * @returns Response containing access token and user data + */ +const login = async (email: string, password: string) => { + try { + const apiClient = createApiClient(); + const response = await apiClient.post( + `${API_ENDPOINTS.AUTH_SERVICE}/login`, + { + email, + password, + }, + ); + return response; + } catch (error) { + console.error("Error logging in:", error); + throw error; + } +}; + +/** + * Signs up a new user + * @param username User's username + * @param email User's email address + * @param password User's password + * @returns Response containing user data + */ +const signup = async (username: string, email: string, password: string) => { + try { + const apiClient = createApiClient(); + const response = await apiClient.post(`${API_ENDPOINTS.USER_SERVICE}/`, { + username, + email, + password, + }); + return response; + } catch (error) { + console.error("Error signing up:", error); + throw error; + } +}; + +// Export configuration +export { verifyToken, login, signup }; diff --git a/frontend/src/services/userServiceCookies.ts b/frontend/src/services/userServiceCookies.ts new file mode 100644 index 0000000..6b30e0b --- /dev/null +++ b/frontend/src/services/userServiceCookies.ts @@ -0,0 +1,27 @@ +/** + * AI Assistance Disclosure: + * Tool: GitHub Copilot (model: Claude Sonnet 4), date: 2025-09-15 + * Purpose: To implement simple cookie utilities for JWT token storage and removal, ensuring compatibility with Next.js middleware authentication. + * Author Review: I validated correctness, security, and performance of the code. + */ + +export function addToken(token: string): void { + document.cookie = `token=${token}; path=/`; +} + +export function removeToken(): void { + document.cookie = "token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC"; +} + +export function getToken(): string | null { + if (typeof document === "undefined") return null; + + const cookies = document.cookie.split(";"); + for (const cookie of cookies) { + const [name, value] = cookie.trim().split("="); + if (name === "token") { + return value; + } + } + return null; +} diff --git a/mongo-express/.env.sample b/mongo-express/.env.sample new file mode 100644 index 0000000..033519e --- /dev/null +++ b/mongo-express/.env.sample @@ -0,0 +1,3 @@ +ME_CONFIG_MONGODB_URL=mongodb://root:example@mongodb-user-services:27017 +ME_CONFIG_BASICAUTH_USERNAME=root +ME_CONFIG_BASICAUTH_PASSWORD=example diff --git a/mongodb/.env.sample b/mongodb/.env.sample new file mode 100644 index 0000000..4541289 --- /dev/null +++ b/mongodb/.env.sample @@ -0,0 +1,3 @@ +MONGO_INITDB_ROOT_USERNAME=root +MONGO_INITDB_ROOT_PASSWORD=example +MONGODB_CONNECTION_STRING=mongodb://root:example@mongodb-user-services:27017 diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..efd9b04 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,373 @@ +{ + "name": "peerprep", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "peerprep", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "concurrently": "^8.2.2" + } + }, + "node_modules/@babel/runtime": { + "version": "7.28.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz", + "integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/concurrently": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-8.2.2.tgz", + "integrity": "sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.2", + "date-fns": "^2.30.0", + "lodash": "^4.17.21", + "rxjs": "^7.8.1", + "shell-quote": "^1.8.1", + "spawn-command": "0.0.2", + "supports-color": "^8.1.1", + "tree-kill": "^1.2.2", + "yargs": "^17.7.2" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": "^14.13.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/date-fns": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.21.0" + }, + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "license": "MIT" + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/shell-quote": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz", + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/spawn-command": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", + "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..6ac3a70 --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "_aiCredits": "Root package.json with concurrently scripts created with GitHub Copilot assistance - 2025-09-15", + "name": "peerprep", + "version": "1.0.0", + "description": "PeerPrep - Collaborative coding interview platform", + "scripts": { + "dev": "concurrently \"npm run dev:frontend\" \"npm run dev:user-service\"", + "dev:frontend": "cd frontend && npm run dev", + "dev:user-service": "cd user-service && npm run dev", + "start": "concurrently \"npm run start:frontend\" \"npm run start:user-service\"", + "start:frontend": "cd frontend && npm run start", + "start:user-service": "cd user-service && npm run start", + "build": "npm run build:frontend && npm run build:user-service", + "build:frontend": "cd frontend && npm run build", + "build:user-service": "echo 'No build step for user-service'", + "install:all": "npm install && cd frontend && npm install && cd ../user-service && npm install", + "clean": "cd frontend && rm -rf node_modules && cd ../user-service && rm -rf node_modules && rm -rf node_modules" + }, + "devDependencies": { + "concurrently": "^8.2.2" + }, + "keywords": [ + "coding", + "interview", + "collaboration", + "peer-programming" + ], + "author": "", + "license": "ISC" +} \ No newline at end of file diff --git a/user-service/.dockerignore b/user-service/.dockerignore new file mode 100644 index 0000000..f4bde53 --- /dev/null +++ b/user-service/.dockerignore @@ -0,0 +1,71 @@ +# AI Assistance Disclosure: +# Tool: GitHub Copilot(Claude Sonnet 4), date: 2025-09-15 +# Purpose: To create comprehensive .dockerignore for Express.js user-service build optimization. +# Author Review: I validated file exclusions for security and build performance. + +# Dependencies +node_modules +npm-debug.log* + +# Environment files +.env +.env.local +.env.development +.env.test +.env.production + +# Logs +logs +*.log +pids +*.pid +*.seed +*.pid.lock + +# Runtime data +lib-cov +coverage +.nyc_output +.coverage +*.lcov + +# Dependency directories +jspm_packages/ + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# Git +.git +.gitignore +README.md +MongoDBSetup.md + +# Docker +Dockerfile +.dockerignore + +# IDE +.vscode +.idea +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Guide assets +GuideAssets/ + +# Other +*.md \ No newline at end of file diff --git a/user-service/.env.sample b/user-service/.env.sample index b3518e0..5212e89 100644 --- a/user-service/.env.sample +++ b/user-service/.env.sample @@ -1,6 +1,6 @@ DB_CLOUD_URI= -DB_LOCAL_URI=mongodb://127.0.0.1:27017/peerprepUserServiceDB -PORT=3001 +DB_LOCAL_URI=mongodb://root:example@mongodb-user-services:27017 +PORT=4000 # Will use cloud MongoDB Atlas database ENV=PROD diff --git a/user-service/Dockerfile b/user-service/Dockerfile new file mode 100644 index 0000000..43df65c --- /dev/null +++ b/user-service/Dockerfile @@ -0,0 +1,56 @@ +# syntax=docker.io/docker/dockerfile:1 + +# AI Assistance Disclosure: +# Tool: GitHub Copilot (Claude Sonnet 4), date: 2025-09-15 +# Purpose: To create optimized multi-stage Docker configuration for Express.js user-service. +# Author Review: I validated security, performance, and production readiness of the setup. + +# Use Node.js 20 Alpine for smaller image size +FROM node:20-alpine AS base + +# Install dependencies only when needed +FROM base AS deps +# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. +RUN apk add --no-cache libc6-compat +WORKDIR /app + +# Install dependencies based on the preferred package manager +COPY package.json package-lock.json* ./ +RUN npm ci --only=production + +# Rebuild the source code only when needed +FROM base AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +# Production image, copy all the files and run the app +FROM base AS runner +WORKDIR /app + +ENV NODE_ENV=production + +# Create a non-root user for security +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 expressjs + +# Copy built application +COPY --from=builder --chown=expressjs:nodejs /app/node_modules ./node_modules +COPY --from=builder --chown=expressjs:nodejs /app/package.json ./package.json +COPY --from=builder --chown=expressjs:nodejs /app/server.js ./server.js +COPY --from=builder --chown=expressjs:nodejs /app/index.js ./index.js +COPY --from=builder --chown=expressjs:nodejs /app/controller ./controller +COPY --from=builder --chown=expressjs:nodejs /app/middleware ./middleware +COPY --from=builder --chown=expressjs:nodejs /app/model ./model +COPY --from=builder --chown=expressjs:nodejs /app/routes ./routes + +USER expressjs + +EXPOSE 4000 + +# Health check +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD node -e "require('http').get('http://localhost:3001/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))" + +# Start the server +CMD ["npm", "start"] \ No newline at end of file diff --git a/user-service/controller/user-controller.js b/user-service/controller/user-controller.js index 985a833..b305251 100644 --- a/user-service/controller/user-controller.js +++ b/user-service/controller/user-controller.js @@ -16,9 +16,13 @@ export async function createUser(req, res) { try { const { username, email, password } = req.body; if (username && email && password) { - const existingUser = await _findUserByUsernameOrEmail(username, email); + let existingUser = await _findUserByUsername(username) if (existingUser) { - return res.status(409).json({ message: "username or email already exists" }); + return res.status(409).json({ message: "Username already exists" }); + } + existingUser = await _findUserByEmail(email); + if (existingUser) { + return res.status(409).json({ message: "Email already exists" }); } const salt = bcrypt.genSaltSync(10); diff --git a/user-service/model/user-model.js b/user-service/model/user-model.js index df37491..668b384 100644 --- a/user-service/model/user-model.js +++ b/user-service/model/user-model.js @@ -23,9 +23,12 @@ const UserModelSchema = new Schema({ }, isAdmin: { type: Boolean, - required: true, default: false, }, + verified: { + type: Boolean, + default: false, + } }); export default mongoose.model("UserModel", UserModelSchema); diff --git a/user-service/package-lock.json b/user-service/package-lock.json index 8841b53..01ed1f2 100644 --- a/user-service/package-lock.json +++ b/user-service/package-lock.json @@ -14,6 +14,7 @@ "dotenv": "^16.4.5", "express": "^4.19.2", "jsonwebtoken": "^9.0.2", + "mongodb": "^6.19.0", "mongoose": "^8.5.4" }, "devDependencies": { @@ -40,9 +41,10 @@ } }, "node_modules/@mongodb-js/saslprep": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.8.tgz", - "integrity": "sha512-qKwC/M/nNNaKUBMQ0nuzm47b7ZYWQHN3pcXq4IIcoSBc2hOIrflAxJduIvvqmhoz3gR2TacTAs8vlsCVPkiEdQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.3.0.tgz", + "integrity": "sha512-zlayKCsIjYb7/IdfqxorK5+xUMyi4vOKcFy10wKJYc63NSdKI8mNME+uJqfatkPmOSMMUiojrL58IePKBm3gvQ==", + "license": "MIT", "dependencies": { "sparse-bitfield": "^3.0.3" } @@ -184,9 +186,10 @@ } }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "license": "MIT", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", @@ -196,7 +199,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -207,9 +210,10 @@ } }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -228,9 +232,10 @@ } }, "node_modules/bson": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz", - "integrity": "sha512-iOJg8pr7wq2tg/zSlCCHMi3hMm5JTOxLTagf3zxhcenHsFp+c6uOs6K7W5UE7A4QIJGtqh/ZovFNMP4mOPJynQ==", + "version": "6.10.4", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.4.tgz", + "integrity": "sha512-WIsKqkSC0ABoBJuT1LEX+2HEvNmNKKgnTAyd0fL8qzK4SH2i9NXg+t08YtdZp/V9IZ33cxe3iV4yM0qg8lMQng==", + "license": "Apache-2.0", "engines": { "node": ">=16.20.1" } @@ -244,20 +249,32 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, - "node_modules/call-bind": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", "dependencies": { - "es-define-property": "^1.0.0", "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, "engines": { "node": ">= 0.4" @@ -331,14 +348,16 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -364,26 +383,11 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -393,6 +397,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -401,6 +406,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", "engines": { "node": ">= 0.8", "npm": "1.2.8000 || >= 1.4.16" @@ -425,6 +431,20 @@ "url": "https://dotenvx.com" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -436,7 +456,8 @@ "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" }, "node_modules/emoji-regex": { "version": "8.0.0", @@ -444,20 +465,19 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", - "dependencies": { - "get-intrinsic": "^1.2.4" - }, + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -466,6 +486,19 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, "engines": { "node": ">= 0.4" } @@ -473,47 +506,50 @@ "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", + "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.12", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -522,6 +558,10 @@ }, "engines": { "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/fill-range": { @@ -537,12 +577,13 @@ } }, "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "license": "MIT", "dependencies": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -565,6 +606,7 @@ "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -614,6 +656,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -639,15 +682,21 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -656,6 +705,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -689,11 +751,12 @@ } }, "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dependencies": { - "get-intrinsic": "^1.1.3" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -708,32 +771,11 @@ "node": ">=4" } }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -750,6 +792,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", "dependencies": { "function-bind": "^1.1.2" }, @@ -761,6 +804,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", @@ -809,6 +853,7 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, @@ -1005,10 +1050,20 @@ "semver": "bin/semver.js" } }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1016,12 +1071,17 @@ "node_modules/memory-pager": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==" + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "license": "MIT" }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/methods": { "version": "1.1.2", @@ -1035,6 +1095,7 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", "bin": { "mime": "cli.js" }, @@ -1115,12 +1176,13 @@ } }, "node_modules/mongodb": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.7.0.tgz", - "integrity": "sha512-TMKyHdtMcO0fYBNORiYdmM25ijsHs+Njs963r4Tro4OQZzqYigAzYQouwWRg4OIaiLRUEGUh/1UAcH5lxdSLIA==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.19.0.tgz", + "integrity": "sha512-H3GtYujOJdeKIMLKBT9PwlDhGrQfplABNF1G904w6r5ZXKWyv77aB0X9B+rhmaAwjtllHzaEkvi9mkGVZxs2Bw==", + "license": "Apache-2.0", "dependencies": { - "@mongodb-js/saslprep": "^1.1.5", - "bson": "^6.7.0", + "@mongodb-js/saslprep": "^1.1.9", + "bson": "^6.10.4", "mongodb-connection-string-url": "^3.0.0" }, "engines": { @@ -1128,11 +1190,11 @@ }, "peerDependencies": { "@aws-sdk/credential-providers": "^3.188.0", - "@mongodb-js/zstd": "^1.1.0", + "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", "gcp-metadata": "^5.2.0", "kerberos": "^2.0.1", "mongodb-client-encryption": ">=6.0.0 <7", - "snappy": "^7.2.2", + "snappy": "^7.3.2", "socks": "^2.7.1" }, "peerDependenciesMeta": { @@ -1169,13 +1231,14 @@ } }, "node_modules/mongoose": { - "version": "8.5.4", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.5.4.tgz", - "integrity": "sha512-nG3eehhWf9l1q80WuHvp5DV+4xDNFpDWLE5ZgcFD5tslUV2USJ56ogun8gaZ62MKAocJnoStjAdno08b8U57hg==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.18.1.tgz", + "integrity": "sha512-K0RfrUXXufqNRZZjvAGdyjydB91SnbWxlwFYi5t7zN2DxVWFD3c6puia0/7xfBwZm6RCpYOVdYFlRFpoDWiC+w==", + "license": "MIT", "dependencies": { - "bson": "^6.7.0", + "bson": "^6.10.4", "kareem": "2.6.3", - "mongodb": "6.7.0", + "mongodb": "~6.18.0", "mpath": "0.9.0", "mquery": "5.0.0", "ms": "2.1.3", @@ -1189,6 +1252,52 @@ "url": "https://opencollective.com/mongoose" } }, + "node_modules/mongoose/node_modules/mongodb": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.18.0.tgz", + "integrity": "sha512-fO5ttN9VC8P0F5fqtQmclAkgXZxbIkYRTUi1j8JO6IYwvamkhtYDilJr35jOPELR49zqCJgXZWwCtW7B+TM8vQ==", + "license": "Apache-2.0", + "dependencies": { + "@mongodb-js/saslprep": "^1.1.9", + "bson": "^6.10.4", + "mongodb-connection-string-url": "^3.0.0" + }, + "engines": { + "node": ">=16.20.1" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", + "gcp-metadata": "^5.2.0", + "kerberos": "^2.0.1", + "mongodb-client-encryption": ">=6.0.0 <7", + "snappy": "^7.2.2", + "socks": "^2.7.1" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "gcp-metadata": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + }, + "socks": { + "optional": true + } + } + }, "node_modules/mongoose/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -1237,7 +1346,8 @@ "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" }, "node_modules/negotiator": { "version": "0.6.3", @@ -1385,9 +1495,10 @@ } }, "node_modules/object-inspect": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", - "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -1399,6 +1510,7 @@ "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", "dependencies": { "ee-first": "1.1.1" }, @@ -1418,6 +1530,7 @@ "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -1431,9 +1544,10 @@ } }, "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" }, "node_modules/picomatch": { "version": "2.3.1", @@ -1474,11 +1588,12 @@ } }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -1491,6 +1606,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1499,6 +1615,7 @@ "version": "2.5.2", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "license": "MIT", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", @@ -1571,7 +1688,8 @@ "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" }, "node_modules/semver": { "version": "7.6.3", @@ -1585,9 +1703,10 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "license": "MIT", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -1607,20 +1726,31 @@ "node": ">= 0.8.0" } }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/send/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "license": "MIT", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" @@ -1631,36 +1761,76 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", "dependencies": { - "define-data-property": "^1.1.4", "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bound": "^1.0.2", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" }, "engines": { "node": ">= 0.4" @@ -1695,6 +1865,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "license": "MIT", "dependencies": { "memory-pager": "^1.0.2" } @@ -1703,6 +1874,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -1783,6 +1955,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", "engines": { "node": ">=0.6" } @@ -1811,6 +1984,7 @@ "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" @@ -1829,6 +2003,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } diff --git a/user-service/package.json b/user-service/package.json index b3ac4db..94ad691 100644 --- a/user-service/package.json +++ b/user-service/package.json @@ -21,6 +21,7 @@ "dotenv": "^16.4.5", "express": "^4.19.2", "jsonwebtoken": "^9.0.2", + "mongodb": "^6.19.0", "mongoose": "^8.5.4" } }