Files
FastGPT/packages/service/core/app/version/schema.ts
heheer 6288dc9492 feat: undo-redo & edit snapshots (#2436)
* feat: undo-redo & edit snapshots

* fix merge

* add simple history back

* fix some undo

* change app latest version

* fix

* chatconfig

* fix snapshot

* fix

* fix

* fix

* fix compare

* fix initial

* fix merge:

* fix useEffect

* fix snapshot initial and saved state

* chore

* fix

* compare snapshot

* nodes edges useEffct

* fix chatconfig

* fix

* delete unused method

* fix

* fix

* fix

* default version name
2024-08-23 15:58:43 +08:00

51 lines
1004 B
TypeScript

import { connectionMongo, getMongoModel, type Model } from '../../../common/mongo';
const { Schema, model, models } = connectionMongo;
import { AppVersionSchemaType } from '@fastgpt/global/core/app/version';
import { chatConfigType } from '../schema';
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: []
},
chatConfig: {
type: chatConfigType
},
isPublish: {
type: Boolean
},
versionName: {
type: String,
default: ''
},
tmbId: {
type: String
}
});
try {
AppVersionSchema.index({ appId: 1, time: -1 });
} catch (error) {
console.log(error);
}
export const MongoAppVersion = getMongoModel<AppVersionSchemaType>(
AppVersionCollectionName,
AppVersionSchema
);