19e46b2b3a
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.
21 lines
643 B
TypeScript
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;
|