Chat - #9
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements comprehensive authentication and user management features for the homeWork platform, adding Google OAuth integration, JWT-based authentication, user signup flows, and supporting infrastructure.
Key Changes:
- Google OAuth 2.0 authentication with Passport.js and JWT token management
- Teacher and student signup workflows with role-based access control
- Legal document management system for privacy policies, terms of service, and help content
- Conversation service enhancements with thought tags for AI responses
- Database schema expansion with User, Teacher, Student, and related models
Reviewed changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/shared/lib/passport.ts |
Passport.js configuration for Google OAuth authentication |
src/features/auth/auth.service.ts |
Core authentication business logic including JWT generation and user management |
src/features/auth/auth.controller.ts |
HTTP handlers for OAuth callbacks and profile endpoints |
src/features/auth/auth.routes.ts |
Authentication route definitions with rate limiting |
src/features/auth/middleware/auth.middleware.ts |
JWT verification and role-based access control middleware |
src/features/signup/signup.*.ts |
Teacher and student profile completion after OAuth |
src/features/legal/legal.*.ts |
Legal document CRUD operations for compliance content |
src/shared/config/index.ts |
Added auth configuration and changed default port to 3001 |
src/shared/lib/errors.ts |
New error classes and asyncHandler utility |
src/features/ai/ai.service.ts |
Added thought tags generation for AI responses |
src/features/ai/conversation.service.ts |
Updated to support thought tags and userId field |
src/server.ts |
Added CORS, passport initialization, and new route handlers |
prisma/schema.prisma |
New User, Teacher, Student models with visibility controls |
package.json |
Auth-related dependencies (passport, JWT, cors, rate-limit, firebase) |
public/*.html |
Frontend test pages for auth and signup flows |
|
|
||
| // Pre-fill name if in URL | ||
| const name = urlParams.get('name'); | ||
| const email = urlParams.get('email'); |
There was a problem hiding this comment.
Unused variable email.
| const email = urlParams.get('email'); |
| } | ||
|
|
||
| function displayUserProfile(data) { | ||
| const { user, profile } = data; |
There was a problem hiding this comment.
Unused variable profile.
| const { user, profile } = data; | |
| const { user } = data; |
| getUserProfileService, | ||
| deactivateUserService, | ||
| } from './auth.service'; | ||
| import { AuthenticatedRequest, GoogleProfile, JWTPayload } from './auth.types'; |
There was a problem hiding this comment.
Unused import AuthenticatedRequest.
| import { UserRole } from '@prisma/client'; | ||
| import { verifyTokenService } from '../auth.service'; | ||
| import { UnauthorizedError } from '../../../shared/lib/errors'; | ||
| import { AuthenticatedRequest, JWTPayload } from '../auth.types'; |
There was a problem hiding this comment.
Unused import AuthenticatedRequest.
| }); | ||
|
|
||
| // Create teacher profile | ||
| const teacher = await prisma.teacher.create({ |
There was a problem hiding this comment.
Unused variable teacher.
| const teacher = await prisma.teacher.create({ | |
| await prisma.teacher.create({ |
| }); | ||
|
|
||
| // Create student profile | ||
| const student = await prisma.student.create({ |
There was a problem hiding this comment.
Unused variable student.
| const student = await prisma.student.create({ | |
| await prisma.student.create({ |
we4rw4 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…used code Co-authored-by: TrendySloth1001 <133957092+TrendySloth1001@users.noreply.github.com>
Co-authored-by: TrendySloth1001 <133957092+TrendySloth1001@users.noreply.github.com>
No description provided.