(userId: string)
| 19 | |
| 20 | // Upload current localStorage state to Supabase |
| 21 | export 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 |
| 36 | export async function downloadAndMerge(userId: string): Promise<boolean> { |
no test coverage detected