Schema Model - new Version Added
This commit is contained in:
24
src/shared/V1Models/Auth/tokenModel.ts
Normal file
24
src/shared/V1Models/Auth/tokenModel.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Schema, Document } from "mongoose";
|
||||
import MainModel from "../../connect/mongoose.ts";
|
||||
import { User } from "./userAuthModel.ts";
|
||||
export interface Token extends Document {
|
||||
userId: User["_id"];
|
||||
isArchieve: Boolean;
|
||||
refreshToken: string;
|
||||
resetTokenExpiry?: Date;
|
||||
resetToken: string;
|
||||
}
|
||||
const tokenSchema: Schema = new Schema({
|
||||
userId: { type: Schema.Types.ObjectId, ref: "User" },
|
||||
isArchieve: { type: Boolean, default: false },
|
||||
token: { type: String },
|
||||
refreshToken: { type: String },
|
||||
tokenCreatedAt: { type: Date },
|
||||
resetToken: { type: String },
|
||||
resetTokenExpiry: { type: Date },
|
||||
});
|
||||
|
||||
const tokenType = (db: any) => {
|
||||
return MainModel(db, "Token", tokenSchema, "Token");
|
||||
};
|
||||
export default tokenType;
|
||||
Reference in New Issue
Block a user