first
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import { Types } from "mongoose";
|
||||
|
||||
export interface IToken {
|
||||
userId: Types.ObjectId;
|
||||
refreshToken: string;
|
||||
refreshTokenExpire: Date;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Schema, model } from "mongoose";
|
||||
|
||||
import { IToken } from "./Abstraction/IToken";
|
||||
|
||||
const tokenSchema = new Schema<IToken>(
|
||||
{
|
||||
userId: { type: Schema.Types.ObjectId, ref: "User", required: true },
|
||||
refreshToken: String,
|
||||
refreshTokenExpire: Date,
|
||||
},
|
||||
{ timestamps: true, id: false },
|
||||
);
|
||||
|
||||
const TokenModel = model<IToken>("Token", tokenSchema);
|
||||
|
||||
export { TokenModel };
|
||||
Reference in New Issue
Block a user