mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00

* fix if-else find variables (#92) * fix if-else find variables * change workflow output type * fix tooltip style * fix * 4.8 (#93) * api middleware * perf: app version histories * faq * perf: value type show * fix: ts * fix: Run the same node multiple times * feat: auto save workflow * perf: auto save workflow --------- Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
37 lines
832 B
TypeScript
37 lines
832 B
TypeScript
import { connectionMongo, type Model } from '../../common/mongo';
|
|
const { Schema, model, models } = connectionMongo;
|
|
import { AppVersionSchemaType } from '@fastgpt/global/core/app/version';
|
|
|
|
export const AppVersionCollectionName = 'app.versions';
|
|
|
|
const AppVersionSchema = new Schema({
|
|
appId: {
|
|
type: Schema.Types.ObjectId,
|
|
ref: AppVersionCollectionName,
|
|
required: true
|
|
},
|
|
time: {
|
|
type: Date,
|
|
default: () => new Date()
|
|
},
|
|
nodes: {
|
|
type: Array,
|
|
default: []
|
|
},
|
|
edges: {
|
|
type: Array,
|
|
default: []
|
|
}
|
|
});
|
|
|
|
try {
|
|
AppVersionSchema.index({ appId: 1, time: -1 });
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
|
|
export const MongoAppVersion: Model<AppVersionSchemaType> =
|
|
models[AppVersionCollectionName] || model(AppVersionCollectionName, AppVersionSchema);
|
|
|
|
MongoAppVersion.syncIndexes();
|