Skip to content

Comments

Feature competency test#5

Open
radheshhathwarbh wants to merge 8 commits intofeature-competencyfrom
feature-competency-test
Open

Feature competency test#5
radheshhathwarbh wants to merge 8 commits intofeature-competencyfrom
feature-competency-test

Conversation

@radheshhathwarbh
Copy link

Migration, Adding and reading passbook working code
Final changes

Added code for Migrate data
Changed effectiveDate read and write datapoint
Added code for Migrate data
Changed effectiveDate read and write datapoint
Changes in Constant values
Commented unused methods
public void migrateData(){
List<Map<String, Object>> passbookList = cassandraOperation.getRecordsByProperties(Constants.DATABASE,
Constants.USER_PASSBOOK_TABLE_OLD, null, null);
passbookList.forEach(item -> item.forEach((k, v) -> System.out.println(k + ": " + v)));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this log

List<Map<String, Object>> passbookList = cassandraOperation.getRecordsByProperties(Constants.DATABASE,
Constants.USER_PASSBOOK_TABLE_OLD, null, null);
passbookList.forEach(item -> item.forEach((k, v) -> System.out.println(k + ": " + v)));
SBApiResponse response = ProjectUtil.createDefaultResponse(Constants.PASSBOOK_READ_API);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not passbook read API - do use proper API name

Comment on lines 219 to 223
for (Map<String, Object> requestMap : passbookList){
Timestamp time = ProjectUtil.getTimestampFromUUID((UUID) requestMap.get(Constants.EFFECTIVE_DATE));
requestMap.put(Constants.EFFECTIVE_DATE,time);
cassandraOperation.insertRecord(Constants.KEYSPACE_SUNBIRD,Constants.USER_PASSBOOK_TABLE,requestMap);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do format these lines properly

} else {
UUID effectiveDateUUID = ProjectUtil.getUUIDFromTimeStamp(effectiveDate);
if (effectiveDateUUID == null) {
Timestamp effectiveDate1 = Timestamp.valueOf(effectiveDate);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use proper variable names...
change "effectiveDate" to "strEffectiveDate"... and use "effectiveDate" instead of "effectiveDate1"

String effectiveDate = (String) acquiredDetailsMap.get(Constants.EFFECTIVE_DATE);
if (StringUtils.isBlank(effectiveDate)) {
competency.put(Constants.EFFECTIVE_DATE, UUIDs.timeBased());
if (StringUtils.isBlank(String.valueOf(effectiveDate))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

effectiveDate is already String... why we need String.valueOf again ?

Comment on lines 33 to 37
}

@PostMapping("/user/v1/migrateData")
public void migrateData() {
passbookService.migrateData();
}
@PostMapping("/user/v1/passbook")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do proper alignment.
Do return SBApiResponse object and update the migration operation is success or failure.

public static final String PASSBOOK_ADD_API = "user.passbook.add";
public static final String USER_PASSBOOK_TABLE = "user_passbook";
public static final String USER_PASSBOOK_TABLE = "user_passbook_v2";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary line space

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can i name table as user_passbookV2?
For now i have created table named as user_passbook_v2 in stage and in prod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants