mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 12:20:34 +00:00

* feat: log store * fix: full text search match query * perf: mongo schema import, Avoid duplicate import
28 lines
693 B
TypeScript
28 lines
693 B
TypeScript
import { connectionMongo, getMongoModel, type Model } from '../../mongo';
|
|
import { timerIdMap } from './constants';
|
|
const { Schema, model, models } = connectionMongo;
|
|
import { TimerLockSchemaType } from './type.d';
|
|
|
|
export const collectionName = 'systemtimerlocks';
|
|
|
|
const TimerLockSchema = new Schema({
|
|
timerId: {
|
|
type: String,
|
|
required: true,
|
|
unique: true,
|
|
enum: Object.keys(timerIdMap)
|
|
},
|
|
expiredTime: {
|
|
type: Date,
|
|
required: true
|
|
}
|
|
});
|
|
|
|
try {
|
|
TimerLockSchema.index({ expiredTime: 1 }, { expireAfterSeconds: 5 });
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
|
|
export const MongoTimerLock = getMongoModel<TimerLockSchemaType>(collectionName, TimerLockSchema);
|