perf: send code

This commit is contained in:
archer
2023-08-05 12:56:37 +08:00
parent bb824ab35e
commit 8d3ad943be
11 changed files with 167 additions and 89 deletions

View File

@@ -1,26 +0,0 @@
import { Schema, model, models, Model } from 'mongoose';
import { AuthCodeSchema as AuthCodeType } from '@/types/mongoSchema';
const AuthCodeSchema = new Schema({
username: {
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);