eggi-ai-db-schema
Version:
Type-safe database schema and ORM client for Eggi.AI with direct RDS connection
52 lines • 2.43 kB
TypeScript
/**
* =============================================================================
* AUTHENTICATED USER OPERATIONS UTILITIES
* =============================================================================
* Utility functions for managing authenticated users table operations
*/
import { type AuthenticatedUser } from "../lib/schema";
/**
* Finds an authenticated user record by Cognito User ID
*
* This function queries the authenticated_users table specifically and returns
* the authenticated user record which contains:
* - id: Primary key of authenticated_users table
* - userId: Foreign key linking to the users table (use this for social accounts)
* - cognitoUserId: The Cognito ID for authentication
*
* @param cognitoUserId - The Cognito User ID to search for
* @returns Promise resolving to authenticated user record or null if not found
*/
export declare function findAuthenticatedUserByCognitoId(cognitoUserId: string): Promise<AuthenticatedUser | null>;
/**
* Finds an authenticated user record by authenticated user ID
*
* @param authenticatedUserId - The authenticated_users.id to search for
* @returns Promise resolving to authenticated user record or null if not found
*/
export declare function findAuthenticatedUserById(authenticatedUserId: number): Promise<AuthenticatedUser | null>;
/**
* Finds an authenticated user record by user ID (foreign key to users table)
*
* @param userId - The authenticated_users.user_id to search for
* @returns Promise resolving to authenticated user record or null if not found
*/
export declare function findAuthenticatedUserByUserId(userId: number): Promise<AuthenticatedUser | null>;
/**
* Finds an authenticated user by LinkedIn identifier
*
* This function performs the complete chain lookup:
* LinkedIn identifier → social_account → user → authenticated_user
*
* Used by pre-signup validation to prevent duplicate accounts when a user
* already has an authenticated account linked to their LinkedIn profile.
*
* @param linkedinIdentifier - LinkedIn identifier (ACoA, ACwA, AEMA, or public)
* @returns Promise resolving to authenticated user details or null if not found
*/
export declare function findAuthenticatedUserByLinkedInIdentifier(linkedinIdentifier: string): Promise<{
user_id: number;
social_account_id: number;
cognito_user_id: string;
} | null>;
//# sourceMappingURL=authenticated-user-operations.d.ts.map