Open
Conversation
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
karthik-tarento
suggested changes
Jan 19, 2023
| 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))); |
| 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); |
There was a problem hiding this comment.
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); | ||
| } |
There was a problem hiding this comment.
Do format these lines properly
| } else { | ||
| UUID effectiveDateUUID = ProjectUtil.getUUIDFromTimeStamp(effectiveDate); | ||
| if (effectiveDateUUID == null) { | ||
| Timestamp effectiveDate1 = Timestamp.valueOf(effectiveDate); |
There was a problem hiding this comment.
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))) { |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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"; | ||
|
|
Author
There was a problem hiding this comment.
Can i name table as user_passbookV2?
For now i have created table named as user_passbook_v2 in stage and in prod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migration, Adding and reading passbook working code
Final changes