mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-24 02:01:45 +08:00
v4.6.2-alpah (#511)
This commit is contained in:
31
packages/service/core/plugin/store/schema.ts
Normal file
31
packages/service/core/plugin/store/schema.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { connectionMongo, type Model } from '../../../common/mongo';
|
||||
const { Schema, model, models } = connectionMongo;
|
||||
import type { PluginItemSchema } from '@fastgpt/global/core/plugin/type.d';
|
||||
|
||||
import { PluginCollectionName } from '../schema';
|
||||
|
||||
export const ModuleCollectionName = 'plugins';
|
||||
|
||||
const PluginStoreSchema = new Schema({
|
||||
pluginId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: PluginCollectionName,
|
||||
required: true
|
||||
},
|
||||
price: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
updateTime: {
|
||||
type: Date,
|
||||
default: () => new Date()
|
||||
},
|
||||
modules: {
|
||||
type: Array,
|
||||
default: []
|
||||
}
|
||||
});
|
||||
|
||||
export const MongoPluginStore: Model<PluginItemSchema> =
|
||||
models[ModuleCollectionName] || model(ModuleCollectionName, PluginStoreSchema);
|
||||
MongoPluginStore.syncIndexes();
|
||||
Reference in New Issue
Block a user