Skip to content

Commit

Permalink
Merge branch 'main' into improve-docs-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
programmiri authored Aug 7, 2023
2 parents b34b402 + db535d2 commit f71c290
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ List<SchemaRequest> getAllSchemaRequests(

List<RegisterUserInfo> getAllRegisterUsersInformation();

List<RegisterUserInfo> getAllStagingRegisterUsersInfo(String userId);
RegisterUserInfo getFirstStagingRegisterUsersInfo(String userName);

UserInfo getUsersInfo(String username);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ public List<RegisterUserInfo> getAllRegisterUsersInformation() {
}

@Override
public List<RegisterUserInfo> getAllStagingRegisterUsersInfo(String userName) {
return jdbcSelectHelper.selectAllStagingRegisterUsersInfo(userName);
public RegisterUserInfo getFirstStagingRegisterUsersInfo(String userName) {
return jdbcSelectHelper.selectFirstStagingRegisterUsersInfo(userName);
}

public UserInfo getUsersInfo(String username) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,8 +1030,8 @@ public List<RegisterUserInfo> selectAllRegisterUsersInfo() {
return registerInfoRepo.findAllByStatus("PENDING");
}

public List<RegisterUserInfo> selectAllStagingRegisterUsersInfo(String userId) {
return registerInfoRepo.findAllByUsernameAndStatus(userId, "STAGING");
public RegisterUserInfo selectFirstStagingRegisterUsersInfo(String userId) {
return registerInfoRepo.findFirstByUsernameAndStatus(userId, "STAGING");
}

public RegisterUserInfo selectRegisterUsersInfo(String username) {
Expand Down Expand Up @@ -1376,17 +1376,17 @@ public List<KafkaConnectorRequest> selectConnectorRequests(
}

public String getRegistrationId(String userId) {
List<RegisterUserInfo> registerInfoList =
registerInfoRepo.findAllByUsernameAndStatus(userId, "STAGING");
List<RegisterUserInfo> registerInfoList1 =
registerInfoRepo.findAllByUsernameAndStatus(userId, "PENDING");
if (registerInfoList.size() > 0) {
return registerInfoList.get(0).getRegistrationId();
} else if (registerInfoList1.size() > 0) {
RegisterUserInfo registerInfoStaging =
registerInfoRepo.findFirstByUsernameAndStatus(userId, "STAGING");
if (registerInfoStaging != null) {
return registerInfoStaging.getRegistrationId();
}
boolean pendingArePresent =
registerInfoRepo.existsRegisterUserInfoByUsernameAndStatus(userId, "PENDING");
if (pendingArePresent) {
return "PENDING_ACTIVATION";
} else {
return null;
}
return null;
}

public RegisterUserInfo getRegistrationDetails(String registrationId, String status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public interface RegisterInfoRepo extends CrudRepository<RegisterUserInfo, Strin

List<RegisterUserInfo> findAllByRegistrationIdAndStatus(String registrationId, String status);

List<RegisterUserInfo> findAllByUsernameAndStatus(String userId, String status);
RegisterUserInfo findFirstByUsernameAndStatus(String userId, String status);

boolean existsRegisterUserInfoByUsernameAndStatus(String userId, String status);

List<RegisterUserInfo> findAllByRegistrationId(String registrationId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,18 +923,19 @@ public ApiResponse registerUser(RegisterUserInfoModel newUser, boolean isExterna
}

// get the user details from db
List<RegisterUserInfo> stagingRegisterUsersInfo =
manageDatabase.getHandleDbRequests().getAllStagingRegisterUsersInfo(newUser.getUsername());
RegisterUserInfo stagingRegisterUserInfo =
manageDatabase
.getHandleDbRequests()
.getFirstStagingRegisterUsersInfo(newUser.getUsername());

// enrich user info
if (!stagingRegisterUsersInfo.isEmpty()) {
RegisterUserInfo registerUserInfo = stagingRegisterUsersInfo.get(0);
newUser.setTeamId(registerUserInfo.getTeamId());
if (stagingRegisterUserInfo != null) {
newUser.setTeamId(stagingRegisterUserInfo.getTeamId());
newUser.setTeam(
manageDatabase.getTeamNameFromTeamId(
registerUserInfo.getTenantId(), registerUserInfo.getTeamId()));
newUser.setRole(registerUserInfo.getRole());
newUser.setTenantId(registerUserInfo.getTenantId());
stagingRegisterUserInfo.getTenantId(), stagingRegisterUserInfo.getTeamId()));
newUser.setRole(stagingRegisterUserInfo.getRole());
newUser.setTenantId(stagingRegisterUserInfo.getTenantId());
}

try {
Expand Down

0 comments on commit f71c290

Please sign in to comment.