mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-26 04:32:50 +00:00
27 lines
572 B
TypeScript
27 lines
572 B
TypeScript
import { Schema, model, models, Model } from 'mongoose';
|
|
import { AuthCodeSchema as AuthCodeType } from '@/types/mongoSchema';
|
|
|
|
const AuthCodeSchema = new Schema({
|
|
email: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
code: {
|
|
type: String,
|
|
required: true,
|
|
length: 6
|
|
},
|
|
type: {
|
|
type: String,
|
|
enum: ['register', 'findPassword'],
|
|
required: true
|
|
},
|
|
expiredTime: {
|
|
type: Number,
|
|
default: () => Date.now() + 5 * 60 * 1000
|
|
}
|
|
});
|
|
|
|
export const AuthCode: Model<AuthCodeType> =
|
|
models['auth_code'] || model('auth_code', AuthCodeSchema);
|