Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions src/types/auth.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Request } from "express";
* This file consolidates all authentication-related type definitions
* to prevent conflicts and ensure consistency across the application.
*/

/**
* Unified user interface for authentication
* This interface combines all user properties needed across the application
Expand All @@ -17,7 +16,6 @@ export interface AuthenticatedUser {
role: string;
isVerified: boolean;
}

/**
* Unified authenticated request interface
* Extends Express Request with user and traceId properties
Expand All @@ -26,7 +24,6 @@ export interface AuthenticatedRequest extends Request {
user?: AuthenticatedUser;
traceId?: string;
}

/**
* Decoded JWT user interface (from auth middleware)
*/
Expand All @@ -38,15 +35,6 @@ export interface DecodedUser {
iat?: number;
exp?: number;
}

// Legacy user interface for backward compatibility
export interface LegacyUser {
id: number | string;
role: string;
isVerified?: boolean;
email?: string;
}

/**
* Type guard to check if user has required authentication properties
*/
Expand All @@ -59,7 +47,6 @@ export function isAuthenticatedUser(user: any): user is AuthenticatedUser {
typeof user.isVerified === "boolean"
);
}

/**
* Helper function to convert DecodedUser to AuthenticatedUser
*/
Expand All @@ -73,17 +60,6 @@ export function toAuthenticatedUser(
isVerified: decodedUser.isVerified || false,
};
}

/**
* Helper function to convert AuthenticatedUser to LegacyUser for backward compatibility
*/
export const toLegacyUser = (user: AuthenticatedUser): LegacyUser => ({
id: user.id,
role: user.role,
isVerified: user.isVerified,
email: user.email,
});

// Global Express namespace extension
declare global {
namespace Express {
Expand Down