eggi-ai-db-schema
Version:
Type-safe database schema and ORM client for Eggi.AI with direct RDS connection
121 lines • 3.9 kB
TypeScript
/**
* =============================================================================
* LINKEDIN DATA OPERATIONS - COMPREHENSIVE PROFILE STORAGE
* =============================================================================
* High-level functions for storing complete LinkedIn profiles
* These functions orchestrate multiple table inserts for our lambdas
*/
import { type User, type SocialAccount, type LinkedinProfile } from "../lib/schema";
/**
* Interface for complete LinkedIn profile data from LinkedIn data providers
*/
export interface LinkedInProfileData {
provider_id?: string;
public_identifier?: string;
first_name?: string;
last_name?: string;
headline?: string;
summary?: string;
location?: string;
profile_picture_url?: string;
profile_picture?: string;
follower_count?: number;
connections_count?: number;
skills?: Array<{
name: string;
endorsement_count?: number;
}>;
work_experience?: Array<{
position?: string;
title?: string;
company?: string;
company_id?: string;
company_linkedin_url?: string;
location?: string;
employment_type?: string;
description?: string;
current?: boolean;
is_current?: boolean;
start?: string;
start_date?: string;
end?: string;
end_date?: string;
skills?: string[];
}>;
education?: Array<{
degree?: string;
school?: string;
school_id?: string;
field_of_study?: string;
grade?: string;
description?: string;
activities_and_societies?: string;
school_linkedin_url?: string;
url?: string;
start?: string;
start_date?: string;
end?: string;
end_date?: string;
skills?: string[];
}>;
certifications?: Array<{
name?: string;
organization?: string;
url?: string;
}>;
projects?: Array<{
name?: string;
description?: string;
start?: string;
start_date?: string;
end?: string;
end_date?: string;
}>;
contact_info?: {
emails?: string[];
phones?: string[];
adresses?: string[];
socials?: Array<{
type: string;
name: string;
}>;
};
websites?: string[];
}
/**
* Result type for complete LinkedIn profile storage
*/
export interface CompleteLinkedInProfileResult {
user: User;
socialAccount: SocialAccount;
linkedinProfile: LinkedinProfile;
stats: {
skillsStored: number;
workExperienceStored: number;
educationStored: number;
certificationsStored: number;
projectsStored: number;
contactInfoStored: number;
};
linkedin_profile_was_newly_created: boolean;
}
/**
* COMPREHENSIVE LinkedIn profile storage function
* This is the main function our lambdas should call for complete profile storage
*
* @param userId - The user ID to associate the profile with
* @param socialAccountId - The social account ID to associate the profile with
* @param profileData - Complete LinkedIn profile data from provider
* @returns Complete profile storage result with statistics
*/
export declare function storeCompleteLinkedInProfile(userId: number, socialAccountId: number, profileData: LinkedInProfileData): Promise<CompleteLinkedInProfileResult>;
/**
* Simple function to create user + social account + basic profile
* Used when we just need to establish the core records
*/
export declare function createUserAndSocialAccountForLinkedIn(requestIdentifier: string, // Could be ACoA, ACW, or public identifier from request path
profileData: LinkedInProfileData, providerAccountId?: string): Promise<{
user: User;
socialAccount: SocialAccount;
}>;
//# sourceMappingURL=linkedin-data-operations.d.ts.map