mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-06 22:23:53 -05:00
29 lines
470 B
TypeScript
29 lines
470 B
TypeScript
import { Schema, model } from 'mongoose';
|
|
import { EMAIL_TOKEN_LIFETIME } from '../config';
|
|
|
|
export interface IToken {
|
|
email: String;
|
|
token: String;
|
|
createdAt: Date;
|
|
}
|
|
|
|
const tokenSchema = new Schema<IToken>({
|
|
email: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
token: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
createdAt: {
|
|
type: Date,
|
|
expires: EMAIL_TOKEN_LIFETIME,
|
|
default: Date.now
|
|
}
|
|
});
|
|
|
|
const Token = model<IToken>('Token', tokenSchema);
|
|
|
|
export default Token;
|