Files
homepage/src/models/RosaryStreak.ts
T
Alexander 19e46b2b3a fix: replace any types with proper types across codebase
Replace ~100 `any` usages with proper types: use existing interfaces
(RecipeModelType, BriefRecipeType, IPayment, etc.), Record<string, unknown>
for dynamic objects, unknown for catch clauses with proper narrowing,
and inline types for callbacks. Remaining `any` types are in Svelte
components and cases where mongoose document mutation requires casts.
2026-03-02 20:15:08 +01:00

21 lines
643 B
TypeScript

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 }
);
interface IRosaryStreak {
username: string;
length: number;
lastPrayed: string | null;
}
let _model: mongoose.Model<IRosaryStreak>;
try { _model = mongoose.model<IRosaryStreak>("RosaryStreak"); } catch { _model = mongoose.model<IRosaryStreak>("RosaryStreak", RosaryStreakSchema); }
export const RosaryStreak = _model;