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

Revert "Revert "Release 1.7.15"" #1077

Merged
merged 8 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/cadt_rpc_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ POST Options:

```json
// Request
curl --location -g --request POST 'localhost:31310/v1/organizations/' \
curl --location -g --request POST 'localhost:31310/v1/organizations/create' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Sample Org",
Expand Down
629 changes: 325 additions & 304 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cadt",
"version": "1.7.14",
"version": "1.7.15",
"_comment": "DONT CHANGE MAJOR UNLESS DATAMODEL CHANGES: The major version corresponds to the datamodel version your using, so 2.0.0 means it'll use datamodel v2",
"private": true,
"bin": "build/server.js",
Expand Down Expand Up @@ -45,7 +45,7 @@
"lodash": "^4.17.21",
"log-update": "^4.0.0",
"multer": "^1.4.5-lts.1",
"mysql2": "^3.9.3",
"mysql2": "^3.9.7",
"node-xlsx": "^0.23.0",
"regenerator-runtime": "^0.13.11",
"rxjs": "^7.8.1",
Expand Down
4 changes: 4 additions & 0 deletions src/controllers/organization.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ export const homeOrgSyncStatus = async (req, res) => {
where: { commited: true },
});

const { sync_status } = await datalayer.getSyncStatus(homeOrg.orgUid);

return res.json({
ready:
walletSynced && Boolean(homeOrg?.synced) && pendingCommitsCount === 0,
status: {
wallet_synced: walletSynced,
home_org_synced: Boolean(homeOrg?.synced),
pending_commits: pendingCommitsCount,
home_org_profile_synced:
sync_status.target_root_hash === homeOrg.orgHash,
},
success: true,
});
Expand Down
29 changes: 29 additions & 0 deletions src/datalayer/persistance.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,34 @@ const cancelOffer = async (tradeId) => {
}
};

const getSyncStatus = async (storeId) => {
const url = `${CONFIG.DATALAYER_URL}/get_sync_status`;
const { cert, key, timeout } = getBaseOptions();

try {
const response = await superagent
.post(url)
.key(key)
.cert(cert)
.timeout(timeout)
.send({
id: storeId,
});

const data = response.body;

// We just care that we got some response, not what the response is
if (Object.keys(data).includes('success')) {
return data;
}

return false;
} catch (error) {
logger.error(error);
return false;
}
};

export {
addMirror,
makeOffer,
Expand All @@ -737,4 +765,5 @@ export {
takeOffer,
clearPendingRoots,
getValue,
getSyncStatus,
};
Loading
Loading