Added user action and versioning for login attempt.
This commit is contained in:
@@ -38,18 +38,12 @@ public class LoginAttemptDao {
|
||||
public LoginAttemptEntity createLoginAttempt(LoginAttemptEntity loginAttemptEntity) {
|
||||
|
||||
VersionActionTypeEnum actionType;
|
||||
LoginAttemptEntity oldLoginAttemptEntity = Utils.getClonedEntityForData(loginAttemptEntity);
|
||||
loginAttemptEntity.setAttemptDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
if(loginAttemptEntity.getId() != null ) {
|
||||
actionType = VersionActionTypeEnum.UPDATE;
|
||||
}else{
|
||||
actionType = VersionActionTypeEnum.INSERT;
|
||||
oldLoginAttemptEntity = null;
|
||||
}
|
||||
loginAttemptEntity = loginAttemptRepository.save(loginAttemptEntity);
|
||||
loginAttemptEntity = loginAttemptRepository.save(loginAttemptEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for "Create Login Attempt" operation. **/
|
||||
loggingUtil.addVersionHistoryWithoutToken(VersionHistoryRequest.builder().actionType(actionType).request(request).oldData(oldLoginAttemptEntity).newData(loginAttemptEntity).build());
|
||||
loggingUtil.addVersionHistoryWithoutToken(
|
||||
VersionHistoryRequest.builder().actionType(VersionActionTypeEnum.INSERT).request(request).oldData(null).newData(loginAttemptEntity).build());
|
||||
|
||||
return loginAttemptEntity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user