Schema Model - new Version Added

This commit is contained in:
2025-05-17 11:15:53 +05:30
parent 5566b74633
commit 1c55013c2b
18 changed files with 833 additions and 0 deletions

View 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;