Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INJICERT-607] Mock postgres plugin implementation for brazil-usecases #81

Closed
wants to merge 6 commits into from

Conversation

Piyush7034
Copy link
Contributor

No description provided.

for(int i=1;i<mockData.length;i++) {
jsonRes.put(includeFields.get(i), mockData[i]);
}
jsonRes.put("id", "https://piyush7034.github.io/statement.json#StatementCredential");
Copy link
Member

Choose a reason for hiding this comment

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

remove the id field from plugin, we have a workaround from certify side to get this done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed id field from plugin

@Override
public JSONObject fetchData(Map<String, Object> identityDetails) throws DataProviderExchangeException {
try {
String individualId = (String) identityDetails.get("sub");
Copy link
Member

@vharsh vharsh Nov 25, 2024

Choose a reason for hiding this comment

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

try to get scope and fetch the SQL table name based on this via config

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the scope-query mapping configuration to get fields and query for returning specific identity data

if (individualId != null) {
Object[] mockData = mockDataRepository.getIdentityDataFromIndividualId(individualId);
JSONObject jsonRes = new JSONObject();
for(int i=1;i<mockData.length;i++) {
Copy link
Member

Choose a reason for hiding this comment

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

why is the index starting from 1 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Index changed to 0

import org.springframework.stereotype.Repository;

@Repository
@ConditionalOnProperty(value = "mosip.certify.postgres.credential.name", havingValue = "StatementData")
Copy link
Member

Choose a reason for hiding this comment

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

Merge the two interface implementations into one and create a mapping between the scope and the query required to fetch the VC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the common interface implementation for the repository and the scope-query mapping

@Piyush7034 Piyush7034 marked this pull request as ready for review November 26, 2024 09:06
mock-postgres-dataprovider-plugin/pom.xml Outdated Show resolved Hide resolved
@Override
public Object[] getIdentityDataFromIndividualId(String id, String queryString) {
Query query = entityManager.createNativeQuery(queryString);
query.setParameter("id", id);
Copy link
Member

Choose a reason for hiding this comment

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

why is the id field hardcoded ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This "id" field is the identifier in raw query. So adding it as "id" in the query parameter

.github/workflows/push-trigger.yml Show resolved Hide resolved
@Piyush7034 Piyush7034 closed this Nov 26, 2024
@Piyush7034 Piyush7034 deleted the brazil-usecase branch November 26, 2024 14:16
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