Created the Session.ts model
This commit is contained in:
parent
b9ef786131
commit
00c00d40a2
22
src/models/Session.ts
Normal file
22
src/models/Session.ts
Normal 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);
|
Loading…
x
Reference in New Issue
Block a user