Skip to content

Commit

Permalink
EPMRPP-95299 save last login time as integer value of milliseconds (#…
Browse files Browse the repository at this point in the history
…1049)

* EPMRPP-95299 save last login time as integer value of milliseconds
  • Loading branch information
grabsefx authored Nov 22, 2024
1 parent 5730610 commit 6e3726d
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,11 @@ Page<User> findAllByUserTypeAndExpired(@Param("userType") UserType userType,

/**
* Updates user's last login value
*
* @param lastLogin Last login date
* @param username User
*/
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE users SET metadata = jsonb_set(metadata, '{metadata,last_login}', to_jsonb(extract(EPOCH FROM CAST (:lastLogin AS TIMESTAMP)) * 1000), TRUE ) WHERE login = :username", nativeQuery = true)
void updateLastLoginDate(@Param("lastLogin") Instant lastLogin,
@Param("username") String username);
@Query(value = "UPDATE users SET metadata = jsonb_set(metadata, '{metadata,last_login}', to_jsonb(round(extract(EPOCH from clock_timestamp()) * 1000)), TRUE ) WHERE login = :username", nativeQuery = true)
void updateLastLoginDate(@Param("username") String username);

@Query(value = "SELECT u.login FROM users u JOIN project_user pu ON u.id = pu.user_id WHERE pu.project_id = :projectId", nativeQuery = true)
List<String> findNamesByProject(@Param("projectId") Long projectId);
Expand Down

0 comments on commit 6e3726d

Please sign in to comment.