Created the Session.ts model

This commit is contained in:
Mathias Wagner 2023-01-14 23:16:46 +01:00
parent b9ef786131
commit 00c00d40a2
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

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