feat:新增离线存储
This commit is contained in:
27
apps/backend/src/models/notification-channel.model.ts
Normal file
27
apps/backend/src/models/notification-channel.model.ts
Normal 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);
|
||||
Reference in New Issue
Block a user