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:
Mir Arif Hasan
2024-06-21 13:10:21 +06:00
committed by GitHub
parent cfb77f2bfe
commit c2085b8b6f
8 changed files with 100 additions and 5 deletions

View File

@@ -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',
})

View File

@@ -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