feat:新增离线存储

This commit is contained in:
2025-11-10 14:14:51 +08:00
parent 2e2caeaab5
commit ba757017ae
20 changed files with 969 additions and 20 deletions

View File

@@ -0,0 +1,27 @@
import mongoose, { type InferSchemaType } from 'mongoose';
const notificationTemplateSchema = new mongoose.Schema(
{
name: { type: String },
keywords: { type: [String], default: [] },
category: { type: String },
type: { type: String, enum: ['income', 'expense'] },
amountPattern: { type: String }
},
{ _id: false }
);
const notificationChannelSchema = new mongoose.Schema(
{
packageName: { type: String, required: true, unique: true },
displayName: { type: String, required: true },
enabled: { type: Boolean, default: true },
templates: { type: [notificationTemplateSchema], default: [] }
},
{ timestamps: true }
);
export type NotificationChannelDocument = InferSchemaType<typeof notificationChannelSchema>;
export const NotificationChannelModel =
mongoose.models.NotificationChannel ?? mongoose.model('NotificationChannel', notificationChannelSchema);