HSB-450 feature: user last active on (#4121)
* feat: userLastActiveOnInterceptor added and update func added in userService * chore: changed user model parameter description * chore: commented out docker volume for hopp-old-service * chore: changed backend to work with secure cookies --------- Co-authored-by: Balu Babu <balub997@gmail.com>
This commit is contained in:
@@ -36,6 +36,12 @@ export class User {
|
||||
})
|
||||
lastLoggedOn: Date;
|
||||
|
||||
@Field({
|
||||
nullable: true,
|
||||
description: 'Date when the user last interacted with the app',
|
||||
})
|
||||
lastActiveOn: Date;
|
||||
|
||||
@Field({
|
||||
description: 'Date when the user account was created',
|
||||
})
|
||||
|
||||
@@ -334,6 +334,22 @@ export class UserService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update user's lastActiveOn timestamp
|
||||
* @param userUID User UID
|
||||
*/
|
||||
async updateUserLastActiveOn(userUid: string) {
|
||||
try {
|
||||
await this.prisma.user.update({
|
||||
where: { uid: userUid },
|
||||
data: { lastActiveOn: new Date() },
|
||||
});
|
||||
return E.right(true);
|
||||
} catch (e) {
|
||||
return E.left(USER_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate and parse currentRESTSession and currentGQLSession
|
||||
* @param sessionData string of the session
|
||||
|
||||
Reference in New Issue
Block a user