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

Update deveop with latest released code #1092

Closed
wants to merge 10 commits into from
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## [1.7.15](https://github.com/Chia-Network/cadt/compare/1.7.14...1.7.15) (2024-05-13)
## [1.7.15](https://github.com/Chia-Network/cadt/compare/1.7.14...1.7.15) (2024-05-15)


### Bug Fixes
Expand All @@ -8,6 +8,7 @@
* empty sync ([1a19a04](https://github.com/Chia-Network/cadt/commit/1a19a04907c11bd22f6b54b4d9c812df3a18d065))
* missing function ([4cf1159](https://github.com/Chia-Network/cadt/commit/4cf11598d008601bf248d39c31a522eeefcd1f13))
* missing function ([35230b9](https://github.com/Chia-Network/cadt/commit/35230b9d86c628487637009db0e975f3f97d2bf9))
* null fix during sync ([2a28d13](https://github.com/Chia-Network/cadt/commit/2a28d138f3bd3956f57c4936159a52250148a972))
* registry id on sync status ([3678a9b](https://github.com/Chia-Network/cadt/commit/3678a9b161da6c9ffcb8d69feffc685f58beb9a2))
* sync status export ([61271c0](https://github.com/Chia-Network/cadt/commit/61271c00fb0ff8cdda4ec8223fe52e526aeac999))
* truncate staging only once ([2ff211d](https://github.com/Chia-Network/cadt/commit/2ff211dd98119f77fbc64494693315e9a558f470))
Expand Down
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