import { Schema, Document } from "mongoose"; import MainModel from "../../connect/mongoose.ts"; import { User } from "./userAuthModel.ts"; export interface Token extends Document { userId: User["_id"]; isArchive: boolean; refreshToken: string; resetTokenExpiry?: Date; resetToken: string; role: string; } const tokenSchema: Schema = new Schema({ userId: { type: Schema.Types.ObjectId, ref: "User" }, isArchive: { 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;