Skip to content

Commit

Permalink
fix(express-session-mikro-orm): fix express mikro orm touch update
Browse files Browse the repository at this point in the history
  • Loading branch information
Frantz Kati committed Dec 4, 2020
1 parent ade52f7 commit db3f14d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"randomstring": "^1.1.5",
"request": "^2.88.2",
"speakeasy": "^2.0.0",
"uniqid": "^5.2.0"
"uniqid": "^5.2.0",
"express-session-mikro-orm": "^0.4.3"
},
"gitHead": "e891d0776360c97f7d8035cb283b296739c29ff8"
}
21 changes: 10 additions & 11 deletions packages/express-session-mikro-orm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,18 @@ const StoreFactory = (Store: any) => {
expires = data.cookie.expires
}

return this.orm.em
.findOne('Session', {
session_id: sid
})
.then((session: any) => {
this.orm.em.assign(session, {
return this.em
.nativeUpdate(
'Session',
{
session_id: sid
},
{
expires
})

return this.orm.em.persistAndFlush(session)
})
}
)
.then(() => callback(null, null))
.catch(error => callback(error, null))
.catch((error: any) => callback(error, null))
}
startExpiringSessions = () => {
this.expirationInterval = setInterval(
Expand Down

0 comments on commit db3f14d

Please sign in to comment.