fix: SQLite boolean binding, CSS brace, race condition, 0 npm vulns, code-splitting

This commit is contained in:
Leopoldadmin
2026-07-04 16:08:51 +02:00
parent a4371ca3ce
commit 0606dbb501
20 changed files with 1070 additions and 53 deletions
+78
View File
@@ -387,6 +387,84 @@ export async function loadProjectDataTyped(token: string, projectId: string): Pr
return promise;
}
// ─── Notifications ───────────────────────────────────────
export interface NotificationItem {
id: string;
user_id: string;
type: string;
title: string;
message: string;
read: number;
created_at: string;
}
export async function getNotifications(token: string): Promise<NotificationItem[]> {
const res = await fetch(`${API_BASE}/api/notifications`, { headers: authHeaders(token) });
if (!res.ok) throw new Error('Failed to load notifications');
return res.json();
}
export async function createNotification(token: string, data: { type?: string; title: string; message: string }): Promise<NotificationItem> {
const res = await fetch(`${API_BASE}/api/notifications`, {
method: 'POST',
headers: { ...authHeaders(token), 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
if (!res.ok) throw new Error('Failed to create notification');
return res.json();
}
export async function markNotificationRead(token: string, id: string): Promise<void> {
const res = await fetch(`${API_BASE}/api/notifications/${id}/read`, {
method: 'PATCH',
headers: authHeaders(token),
});
if (!res.ok) throw new Error('Failed to mark notification as read');
}
export async function deleteNotification(token: string, id: string): Promise<void> {
const res = await fetch(`${API_BASE}/api/notifications/${id}`, {
method: 'DELETE',
headers: authHeaders(token),
});
if (!res.ok) throw new Error('Failed to delete notification');
}
// ─── Project Shares ──────────────────────────────────────
export interface ProjectShare {
id: string;
project_id: string;
shared_with_email: string;
shared_by: string;
permission: string;
share_token: string | null;
created_at: string;
}
export async function getProjectShares(token: string, projectId: string): Promise<ProjectShare[]> {
const res = await fetch(`${API_BASE}/api/projects/${projectId}/shares`, { headers: authHeaders(token) });
if (!res.ok) throw new Error('Failed to load shares');
return res.json();
}
export async function createProjectShare(token: string, projectId: string, data: { shared_with_email: string; permission?: string }): Promise<ProjectShare> {
const res = await fetch(`${API_BASE}/api/projects/${projectId}/shares`, {
method: 'POST',
headers: { ...authHeaders(token), 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
if (!res.ok) throw new Error('Failed to create share');
return res.json();
}
export async function deleteProjectShare(token: string, shareId: string): Promise<void> {
const res = await fetch(`${API_BASE}/api/shares/${shareId}`, {
method: 'DELETE',
headers: authHeaders(token),
});
if (!res.ok) throw new Error('Failed to delete share');
}
export { API_BASE };
// ─── AI Copilot ─────────────────────────────────────────