Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.

Dev#3

Merged
RandithaK merged 3 commits into
mainfrom
dev
Sep 28, 2025
Merged

Dev#3
RandithaK merged 3 commits into
mainfrom
dev

Conversation

@RandithaK

Copy link
Copy Markdown
Member

No description provided.

RandithaK and others added 3 commits September 28, 2025 11:40
…ges and add dashboard/profile

- Add centralized axios client with runtime base URL setter (`src/lib/apiClient.ts`)
- Implement auth service with login/register, create admin/employee, health/test endpoints and token management (`src/services/authService.ts`)
- Implement user service covering all user controller endpoints (`src/services/userService.ts`)
- Add dashboard and profile pages (`src/app/dashboard/page.tsx`, `src/app/profile/page.tsx`)
- Wire login and register pages to authService and show loading/error UI (`src/app/auth/login/page.tsx`, `src/app/auth/register/page.tsx`)
- Add TypeScript API types generated from OpenAPI (`src/types/api.ts`)
- Add `.env.local.example` and `integration-report.md` with verification summary

This commit integrates frontend pages with backend OpenAPI endpoints, centralizes API configuration for future gateway/Docker changes, and adds initial UI feedback for auth flows.
…rmation

feat: Enhance dashboard page to render role-specific dashboards and improve loading states

fix: Add request and response interceptors to apiClient for token management and error handling

feat: Implement authService to manage login and token storage with logging

feat: Create AdminDashboard component with management features and performance metrics

feat: Create CustomerDashboard component for vehicle management and service history

feat: Create EmployeeDashboard component with schedule and task management

feat: Create SuperAdminDashboard component for system management and analytics
Implement comprehensive theme system and enhance authentication pages
@RandithaK
RandithaK requested a review from Copilot September 28, 2025 07:08
@RandithaK RandithaK self-assigned this Sep 28, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request implements a full-stack authentication and dashboard system for a TechTorque automotive service application. The changes establish API integration, user management services, and role-based dashboard components.

  • Adds comprehensive TypeScript API types and service layers for authentication and user management
  • Implements role-based dashboard components (SuperAdmin, Admin, Employee, Customer)
  • Creates functional login/register pages with backend integration and error handling

Reviewed Changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/types/api.ts Defines TypeScript interfaces for API requests, responses, and user data models
src/services/userService.ts Implements user management service with CRUD operations and role management
src/services/authService.ts Provides authentication service with login, registration, and token management
src/lib/apiClient.ts Creates Axios HTTP client with authentication interceptors and error handling
src/app/profile/page.tsx Basic profile page displaying current user information
src/app/dashboard/page.tsx Main dashboard with role-based component rendering and navigation
src/app/components/dashboards/*.tsx Role-specific dashboard components with tailored UI and functionality
src/app/auth/login/page.tsx Enhanced login page with backend integration and demo user credentials
src/app/auth/register/page.tsx Enhanced registration page with form validation and error handling
package.json Updates dependencies to include axios and js-cookie for API integration
.github/workflows/buildtest.yaml Adds CI/CD workflow for automated building and testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +56 to +69
// Request interceptor to attach token
api.interceptors.request.use((config) => {
try {
const token = Cookies.get(TOKEN_COOKIE);
if (token && config.headers) {
config.headers['Authorization'] = `Bearer ${token}`;
}
} catch (err) {
// log to help debugging in production builds
console.warn('auth interceptor error', err);
}
return config;
});

Copilot AI Sep 28, 2025

Copy link

Choose a reason for hiding this comment

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

There is duplicate request interceptor logic between authService.ts and apiClient.ts. The token attachment logic should be centralized in one place to avoid maintenance issues and potential inconsistencies.

Suggested change
// Request interceptor to attach token
api.interceptors.request.use((config) => {
try {
const token = Cookies.get(TOKEN_COOKIE);
if (token && config.headers) {
config.headers['Authorization'] = `Bearer ${token}`;
}
} catch (err) {
// log to help debugging in production builds
console.warn('auth interceptor error', err);
}
return config;
});

Copilot uses AI. Check for mistakes.
Comment thread src/lib/apiClient.ts
// Add a request interceptor to include the auth token
client.interceptors.request.use(
(config) => {
const token = Cookies.get('tt_access_token');

Copilot AI Sep 28, 2025

Copy link

Choose a reason for hiding this comment

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

The token cookie name is hardcoded as 'tt_access_token' here but defined as TOKEN_COOKIE constant in authService.ts. This should use the same constant to avoid inconsistencies.

Copilot uses AI. Check for mistakes.
Comment thread src/lib/apiClient.ts
(error) => {
if (error.response?.status === 401) {
// Clear token and redirect to login
Cookies.remove('tt_access_token');

Copilot AI Sep 28, 2025

Copy link

Choose a reason for hiding this comment

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

The token cookie name is hardcoded again. This should reference the same TOKEN_COOKIE constant used in authService.ts to maintain consistency.

Copilot uses AI. Check for mistakes.
@RandithaK
RandithaK merged commit 89fef71 into main Sep 28, 2025
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants