feat: update package.json scripts and add prisma seed command

refactor: improve refresh-sessions API handler for better readability and error handling

fix: enhance NextAuth configuration with session token handling and cookie settings

chore: update dashboard API handlers for consistency and improved error responses

style: format dashboard API routes for better readability

feat: implement forgot password and reset password functionality with security improvements

feat: add user registration API with email existence check and initial company creation

chore: create initial database migration and seed script for demo data

style: clean up PostCSS and Tailwind CSS configuration files

fix: update TypeScript configuration for stricter type checking

chore: add development environment variables for NextAuth

feat: create Providers component for session management in the app

chore: initialize Prisma migration and seed files for database setup
This commit is contained in:
2025-05-21 21:41:07 +02:00
parent b6b67dcd78
commit 50b2fbda55
42 changed files with 8233 additions and 7627 deletions

View File

@ -1,94 +1,94 @@
import { Session as NextAuthSession } from 'next-auth';
import { Session as NextAuthSession } from "next-auth";
export interface UserSession extends NextAuthSession {
user: {
id?: string;
name?: string;
email?: string;
image?: string;
companyId: string;
role: string;
};
user: {
id?: string;
name?: string;
email?: string;
image?: string;
companyId: string;
role: string;
};
}
export interface Company {
id: string;
name: string;
csvUrl: string;
csvUsername?: string;
csvPassword?: string;
sentimentAlert?: number; // Match Prisma schema naming
createdAt: Date;
updatedAt: Date;
id: string;
name: string;
csvUrl: string;
csvUsername?: string;
csvPassword?: string;
sentimentAlert?: number; // Match Prisma schema naming
createdAt: Date;
updatedAt: Date;
}
export interface User {
id: string;
email: string;
password: string;
role: string;
companyId: string;
resetToken?: string | null;
resetTokenExpiry?: Date | null;
company?: Company;
createdAt: Date;
updatedAt: Date;
id: string;
email: string;
password: string;
role: string;
companyId: string;
resetToken?: string | null;
resetTokenExpiry?: Date | null;
company?: Company;
createdAt: Date;
updatedAt: Date;
}
export interface ChatSession {
id: string;
sessionId: string;
companyId: string;
userId?: string | null;
category?: string | null;
language?: string | null;
sentiment?: number | null;
startTime: Date;
endTime?: Date | null;
createdAt: Date;
updatedAt: Date;
id: string;
sessionId: string;
companyId: string;
userId?: string | null;
category?: string | null;
language?: string | null;
sentiment?: number | null;
startTime: Date;
endTime?: Date | null;
createdAt: Date;
updatedAt: Date;
// Extended session properties that might be used in metrics
avgResponseTime?: number | null;
escalated?: boolean;
forwardedHr?: boolean;
tokens?: number;
tokensEur?: number;
initialMsg?: string;
// Extended session properties that might be used in metrics
avgResponseTime?: number | null;
escalated?: boolean;
forwardedHr?: boolean;
tokens?: number;
tokensEur?: number;
initialMsg?: string;
}
export interface DayMetrics {
[day: string]: number;
[day: string]: number;
}
export interface CategoryMetrics {
[category: string]: number;
[category: string]: number;
}
export interface LanguageMetrics {
[language: string]: number;
[language: string]: number;
}
export interface MetricsResult {
totalSessions: number;
avgSessionsPerDay: number;
avgSessionLength: number | null;
days: DayMetrics;
languages: LanguageMetrics;
categories: CategoryMetrics;
belowThresholdCount: number;
// Additional properties for dashboard
escalatedCount?: number;
forwardedCount?: number;
avgSentiment?: number;
avgResponseTime?: number;
totalTokens?: number;
totalTokensEur?: number;
sentimentThreshold?: number | null;
totalSessions: number;
avgSessionsPerDay: number;
avgSessionLength: number | null;
days: DayMetrics;
languages: LanguageMetrics;
categories: CategoryMetrics;
belowThresholdCount: number;
// Additional properties for dashboard
escalatedCount?: number;
forwardedCount?: number;
avgSentiment?: number;
avgResponseTime?: number;
totalTokens?: number;
totalTokensEur?: number;
sentimentThreshold?: number | null;
}
export interface ApiResponse<T> {
success: boolean;
data?: T;
error?: string;
success: boolean;
data?: T;
error?: string;
}