MCPcopy
hub / github.com/seanprashad/leetcode-patterns / uploadProgress

Function uploadProgress

src/lib/sync.ts:21–33  ·  view source on GitHub ↗
(userId: string)

Source from the content-addressed store, hash-verified

19
20// Upload current localStorage state to Supabase
21export async function uploadProgress(userId: string): Promise<void> {
22 const payload = {
23 user_id: userId,
24 completed: [...loadCompleted()],
25 starred: [...loadStarred()],
26 notes: loadNotes(),
27 solved_dates: loadSolvedDates(),
28 reminders: loadReminders(),
29 updated_at: new Date().toISOString(),
30 };
31
32 await supabase.from("user_progress").upsert(payload, { onConflict: "user_id" });
33}
34
35// Download remote progress and replace local state with it
36export async function downloadAndMerge(userId: string): Promise<boolean> {

Callers 3

sync.test.tsFile · 0.90
downloadAndMergeFunction · 0.85
doUploadFunction · 0.85

Calls 5

loadCompletedFunction · 0.90
loadStarredFunction · 0.90
loadNotesFunction · 0.90
loadSolvedDatesFunction · 0.90
loadRemindersFunction · 0.90

Tested by

no test coverage detected