mirror of
https://github.com/velocitatem/cvfs.git
synced 2026-05-31 16:53:38 +00:00
feat: add CV view analytics and PDF rendering for public share links
Agent-Logs-Url: https://github.com/velocitatem/cvfs/sessions/fb35fb9a-a89e-4df0-9584-109f7151509c Co-authored-by: velocitatem <60182044+velocitatem@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b63417b8b3
commit
7435a0f1bf
@@ -73,6 +73,12 @@ export type PublicAsset = {
|
||||
created_at: string;
|
||||
};
|
||||
|
||||
export type PublicAssetAnalytics = {
|
||||
slug: string;
|
||||
view_count: number;
|
||||
last_viewed_at?: string | null;
|
||||
};
|
||||
|
||||
// reads OIDC bearer token from client-readable cookie (set by /api/auth/callback)
|
||||
function getAuthHeader(): Record<string, string> {
|
||||
if (typeof document === 'undefined') return {};
|
||||
@@ -178,6 +184,12 @@ export async function publishVersion(
|
||||
});
|
||||
}
|
||||
|
||||
export const getPublicPdfUrl = (slug: string): string =>
|
||||
`${API}/api/v1/public/${encodeURIComponent(slug)}/pdf`;
|
||||
|
||||
export const fetchPublicAssetAnalytics = (slug: string): Promise<PublicAssetAnalytics> =>
|
||||
req<PublicAssetAnalytics>(`/api/v1/public/${encodeURIComponent(slug)}/analytics`);
|
||||
|
||||
export async function deleteDocument(documentId: string): Promise<void> {
|
||||
const res = await fetch(`${API}/api/v1/documents/${documentId}`, {
|
||||
method: 'DELETE',
|
||||
|
||||
Reference in New Issue
Block a user