feat: add server persistence for rosary streak
All checks were successful
CI / update (push) Successful in 1m21s
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:
12
src/models/RosaryStreak.ts
Normal file
12
src/models/RosaryStreak.ts
Normal 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);
|
||||
Reference in New Issue
Block a user