feat: refactor backend services and add direct PDF links, import/export, and dashboard sync
This commit is contained in:
parent
ba7976d935
commit
7f7a8ce2b0
26 changed files with 4170 additions and 2440 deletions
|
|
@ -11,6 +11,7 @@ export interface PublicationItem {
|
|||
citation_count: number;
|
||||
venue_text: string | null;
|
||||
pub_url: string | null;
|
||||
pdf_url: string | null;
|
||||
is_read: boolean;
|
||||
first_seen_at: string;
|
||||
is_new_in_latest_run: boolean;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,50 @@ export interface ScholarSearchResult {
|
|||
warnings: string[];
|
||||
}
|
||||
|
||||
export interface ScholarExportItem {
|
||||
scholar_id: string;
|
||||
display_name: string | null;
|
||||
is_enabled: boolean;
|
||||
profile_image_override_url: string | null;
|
||||
}
|
||||
|
||||
export interface PublicationExportItem {
|
||||
scholar_id: string;
|
||||
cluster_id: string | null;
|
||||
fingerprint_sha256: string | null;
|
||||
title: string;
|
||||
year: number | null;
|
||||
citation_count: number;
|
||||
author_text: string | null;
|
||||
venue_text: string | null;
|
||||
pub_url: string | null;
|
||||
pdf_url: string | null;
|
||||
is_read: boolean;
|
||||
}
|
||||
|
||||
export interface DataExportPayload {
|
||||
schema_version: number;
|
||||
exported_at: string;
|
||||
scholars: ScholarExportItem[];
|
||||
publications: PublicationExportItem[];
|
||||
}
|
||||
|
||||
export interface DataImportPayload {
|
||||
schema_version?: number;
|
||||
scholars: ScholarExportItem[];
|
||||
publications: PublicationExportItem[];
|
||||
}
|
||||
|
||||
export interface DataImportResult {
|
||||
scholars_created: number;
|
||||
scholars_updated: number;
|
||||
publications_created: number;
|
||||
publications_updated: number;
|
||||
links_created: number;
|
||||
links_updated: number;
|
||||
skipped_records: number;
|
||||
}
|
||||
|
||||
interface ScholarsListData {
|
||||
scholars: ScholarProfile[];
|
||||
}
|
||||
|
|
@ -115,3 +159,20 @@ export async function clearScholarImage(
|
|||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function exportScholarData(): Promise<DataExportPayload> {
|
||||
const response = await apiRequest<DataExportPayload>("/scholars/export", {
|
||||
method: "GET",
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function importScholarData(
|
||||
payload: DataImportPayload,
|
||||
): Promise<DataImportResult> {
|
||||
const response = await apiRequest<DataImportResult>("/scholars/import", {
|
||||
method: "POST",
|
||||
body: payload,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue