feat: add server persistence for rosary streak

- Add RosaryStreak MongoDB model for logged-in users
- Add /api/glaube/rosary-streak GET/POST endpoints
- Sync streak to server when logged in, merge local/server data
- Auto-sync when coming back online (PWA offline support)
- Falls back to localStorage for guests
This commit is contained in:
2026-01-30 12:30:29 +01:00
parent 1b73032305
commit 8a56661d31
5 changed files with 195 additions and 3 deletions
+12
View File
@@ -0,0 +1,12 @@
import mongoose from 'mongoose';
const RosaryStreakSchema = new mongoose.Schema(
{
username: { type: String, required: true, unique: true },
length: { type: Number, required: true, default: 0 },
lastPrayed: { type: String, default: null } // ISO date string (YYYY-MM-DD)
},
{ timestamps: true }
);
export const RosaryStreak = mongoose.models.RosaryStreak || mongoose.model("RosaryStreak", RosaryStreakSchema);