Archer 3412d7009d
perf: password check;perf: image upload check;perf: sso login check (#3509)
* perf: password check

* perf: image upload check

* perf: sso login check
2025-01-06 12:43:27 +08:00

32 lines
882 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { TeamCollectionName } from '@fastgpt/global/support/user/team/constant';
import { connectionMongo, getMongoModel } from '../../mongo';
import { MongoImageSchemaType } from '@fastgpt/global/common/file/image/type.d';
const { Schema } = connectionMongo;
const ImageSchema = new Schema({
teamId: {
type: Schema.Types.ObjectId,
ref: TeamCollectionName,
required: true
},
createTime: {
type: Date,
default: () => new Date()
},
expiredTime: Date,
binary: Buffer,
metadata: Object
});
try {
// tts expired60 Minutes
ImageSchema.index({ expiredTime: 1 }, { expireAfterSeconds: 60 * 60 });
ImageSchema.index({ type: 1 });
// delete related img
ImageSchema.index({ teamId: 1, 'metadata.relatedId': 1 });
} catch (error) {
console.log(error);
}
export const MongoImage = getMongoModel<MongoImageSchemaType>('image', ImageSchema);