Created the Session.ts model

This commit is contained in:
2023-01-14 23:16:46 +01:00
parent b9ef786131
commit 00c00d40a2

22
src/models/Session.ts Normal file
View File

@ -0,0 +1,22 @@
import {model, ObjectId, Schema, Types} from "mongoose";
interface ISession {
id: ObjectId,
userId: ObjectId,
token: string,
userAgent: string
}
const SessionSchema = new Schema<ISession>({
userId: {
type: Types.ObjectId,
required: true
},
token: {
type: String,
required: true
},
userAgent: String
});
export const Session = model<ISession>('sessions', SessionSchema);