feat: add server persistence for rosary streak
All checks were successful
CI / update (push) Successful in 1m21s

- 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 06477d656a
commit a58e52c891
5 changed files with 195 additions and 3 deletions

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);