Skip to content

Commit

Permalink
Merge pull request #959 from Chia-Network/develop
Browse files Browse the repository at this point in the history
Release 1.7
  • Loading branch information
TheLastCicada authored Nov 16, 2023
2 parents 6a83573 + 70bc36c commit 263ed87
Show file tree
Hide file tree
Showing 51 changed files with 2,606 additions and 1,015 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: true

permissions:
id-token: write
contents: write

jobs:
build:
name: Build Binaries
Expand Down Expand Up @@ -298,7 +302,10 @@ jobs:
cadt-linux-x64-deb/*.deb
cadt-linux-arm64-deb/*.deb
- name: Gets JWT Token from GitHub
uses: Chia-Network/actions/github/jwt@main

- name: Trigger apt repo update
run: |
curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"cadt_repo":"cadt","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/cadt/${{ github.sha }}/start
curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"cadt_repo":"cadt","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/cadt/${{ github.sha }}/success/deploy
curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"cadt_repo":"cadt","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/cadt/${{ github.sha }}/start
curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"cadt_repo":"cadt","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/cadt/${{ github.sha }}/success/deploy
2,268 changes: 1,543 additions & 725 deletions package-lock.json

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cadt",
"version": "1.6.15",
"version": "1.7",
"_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 @@ -31,51 +31,51 @@
"assets": "package.json"
},
"dependencies": {
"@babel/eslint-parser": "^7.22.9",
"@babel/eslint-parser": "^7.22.15",
"async-mutex": "^0.4.0",
"body-parser": "^1.20.2",
"cli-spinner": "^0.2.10",
"cors": "^2.8.5",
"csvtojson": "^2.0.10",
"dotenv": "^16.0.3",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"express-joi-validation": "^5.0.1",
"joi": "^17.5.0",
"joi": "^17.11.0",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"log-update": "^4.0.0",
"multer": "*",
"multer": "^1.4.5-lts.1",
"mysql2": "^2.3.3",
"node-xlsx": "^0.23.0",
"regenerator-runtime": "^0.13.9",
"regenerator-runtime": "^0.13.11",
"rxjs": "^7.8.1",
"sequelize": "^6.32.0",
"socket.io": "^4.6.1",
"sequelize": "^6.33.0",
"socket.io": "^4.7.2",
"sqlite3": "^5.1.6",
"superagent": "^8.0.9",
"toad-scheduler": "^1.6.0",
"uuidv4": "^6",
"winston": "^3.7.2",
"winston-daily-rotate-file": "^4.6.1"
"superagent": "^8.1.2",
"toad-scheduler": "^3.0.0",
"uuidv4": "^6.2.13",
"winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1"
},
"devDependencies": {
"@babel/cli": "^7.23.0",
"@babel/core": "^7.23.0",
"@babel/core": "^7.23.2",
"@babel/plugin-syntax-import-attributes": "^7.22.5",
"@babel/preset-env": "^7.22.20",
"@babel/preset-env": "^7.23.2",
"@babel/register": "^7.22.15",
"@commitlint/cli": "^17.7.2",
"@commitlint/config-conventional": "^17.7.0",
"@commitlint/cli": "^18.0.0",
"@commitlint/config-conventional": "^18.0.0",
"babel-plugin-module-resolver": "^5.0.0",
"chai": "^4.3.10",
"chai-http": "^4.4.0",
"eslint": "^8.50.0",
"eslint": "^8.52.0",
"eslint-plugin-es": "^4.1.0",
"eslint-plugin-mocha": "^10.2.0",
"husky": "^8.0.3",

"mocha": "^10.2.0",
"semver": "^7.5.4",
"sinon": "^16.1.0",
"sinon": "^17.0.0",
"socket.io-client": "^4.7.2",
"standard-version": "^9.5.0",
"supertest": "^6.3.3"
Expand Down
3 changes: 3 additions & 0 deletions src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export default {
dialect: 'sqlite',
storage: `${persistanceFolder}/data.sqlite3`,
logging: false,
dialectOptions: {
busyTimeout: 10000,
},
},
simulator: {
dialect: 'sqlite',
Expand Down
7 changes: 7 additions & 0 deletions src/controllers/governance.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ export const isCreated = async (req, res) => {
if (results) {
return res.json({
created: true,
success: true,
});
} else {
return res.json({
created: false,
success: true,
});
}
} catch (error) {
Expand Down Expand Up @@ -116,6 +118,7 @@ export const createGoveranceBody = async (req, res) => {
return res.json({
message:
'Setting up new Governance Body on this node, this can take a few mins',
success: true,
});
} catch (error) {
res.status(400).json({
Expand All @@ -141,6 +144,7 @@ export const setDefaultOrgList = async (req, res) => {

return res.json({
message: 'Committed this new organization list to the datalayer',
success: true,
});
} catch (error) {
console.trace(error);
Expand All @@ -167,6 +171,7 @@ export const setPickList = async (req, res) => {

return res.json({
message: 'Committed this pick list to the datalayer',
success: true,
});
} catch (error) {
res.status(400).json({
Expand All @@ -191,6 +196,7 @@ export const setGlossary = async (req, res) => {

return res.json({
message: 'Committed glossary to the datalayer',
success: true,
});
} catch (error) {
res.status(400).json({
Expand All @@ -206,6 +212,7 @@ export const sync = async (req, res) => {
Governance.sync();
return res.json({
message: 'Syncing Governance Body',
success: true,
});
} catch (error) {
res.status(400).json({
Expand Down
2 changes: 2 additions & 0 deletions src/controllers/offer.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export const importOfferFile = async (req, res) => {

res.json({
message: 'Offer has been imported for review.',
success: true,
});
} catch (error) {
console.trace(error);
Expand Down Expand Up @@ -132,6 +133,7 @@ export const commitImportedOfferFile = async (req, res) => {
res.json({
message: 'Offer Accepted.',
tradeId: response.trade_id,
success: true,
});

await Meta.destroy({
Expand Down
21 changes: 20 additions & 1 deletion src/controllers/organization.controller.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Sequelize } from 'sequelize';
import { sequelize } from '../database';
import { Organization } from '../models/organizations';

Expand Down Expand Up @@ -62,6 +63,7 @@ export const createV2 = async (req, res) => {
return res.json({
message: 'Your organization already exists.',
orgId: myOrganization.orgUid,
success: false,
});
} else {
const { name } = req.body;
Expand All @@ -81,6 +83,7 @@ export const createV2 = async (req, res) => {
return res.json({
message:
'New organization is currently being created. It can take up to 30 mins. Please do not interrupt this process.',
success: true,
});
}
} catch (error) {
Expand All @@ -104,13 +107,15 @@ export const create = async (req, res) => {
return res.json({
message: 'Your organization already exists.',
orgId: myOrganization.orgUid,
success: false,
});
} else {
const { name, icon } = req.body;
const dataModelVersion = getDataModelVersion();

return res.json({
message: 'New organization created successfully.',
success: true,
orgId: await Organization.createHomeOrganization(
name,
icon,
Expand All @@ -135,13 +140,18 @@ export const resetHomeOrg = async (req, res) => {
await Promise.all([
Organization.destroy({ where: { isHome: true } }),
Staging.destroy({
where: {},
where: {
id: {
[Sequelize.Op.ne]: null,
},
},
truncate: true,
}),
]);

res.json({
message: 'Your home organization was reset, please create a new one.',
success: true,
});
} catch (error) {
res.status(400).json({
Expand All @@ -162,6 +172,7 @@ export const importOrg = async (req, res) => {
res.json({
message:
'Importing and subscribing organization this can take a few mins.',
success: true,
});

return Organization.importOrganization(orgUid);
Expand All @@ -186,6 +197,7 @@ export const importHomeOrg = async (req, res) => {

res.json({
message: 'Importing home organization.',
success: true,
});
} catch (error) {
console.trace(error);
Expand All @@ -207,6 +219,7 @@ export const subscribeToOrganization = async (req, res) => {

return res.json({
message: 'Subscribed to organization',
success: true,
});
} catch (error) {
res.status(400).json({
Expand Down Expand Up @@ -242,6 +255,7 @@ export const deleteImportedOrg = async (req, res) => {
return res.json({
message:
'UnSubscribed to organization, you will no longer receive updates.',
success: true,
});
} catch (error) {
res.status(400).json({
Expand Down Expand Up @@ -282,6 +296,7 @@ export const unsubscribeToOrganization = async (req, res) => {
return res.json({
message:
'UnSubscribed to organization, you will no longer receive updates.',
success: true,
});
} catch (error) {
res.status(400).json({
Expand Down Expand Up @@ -322,6 +337,7 @@ export const resyncOrganization = async (req, res) => {

return res.json({
message: 'Resyncing organization completed',
success: true,
});
} catch (error) {
res.status(400).json({
Expand Down Expand Up @@ -367,6 +383,7 @@ export const addMirror = async (req, res) => {
await Organization.addMirror(req.body.storeId, req.body.url);
return res.json({
message: `Mirror added for ${req.body.storeId}.`,
success: true,
});
} catch (error) {
res.status(400).json({
Expand Down Expand Up @@ -412,6 +429,7 @@ export const removeMirror = async (req, res) => {
await Organization.removeMirror(req.body.storeId, req.body.coinId);
return res.json({
message: `Mirror removed for ${req.body.storeId}.`,
success: true,
});
} catch (error) {
res.status(400).json({
Expand All @@ -426,6 +444,7 @@ export const sync = async (req, res) => {
Organization.syncOrganizationMeta();
return res.json({
message: 'Syncing All Organizations Metadata',
success: true,
});
} catch (error) {
res.status(400).json({
Expand Down
5 changes: 5 additions & 0 deletions src/controllers/project.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export const create = async (req, res) => {
res.json({
message: 'Project staged successfully',
uuid,
success: true,
});
} catch (err) {
res.status(400).json({
Expand Down Expand Up @@ -304,6 +305,7 @@ export const updateFromXLS = async (req, res) => {

res.json({
message: 'Updates from xlsx added to staging',
success: true,
});
} catch (error) {
console.trace(error);
Expand Down Expand Up @@ -418,6 +420,7 @@ const update = async (req, res, isTransfer = false) => {

res.json({
message: 'Project update added to staging',
success: true,
});
} catch (err) {
res.status(400).json({
Expand Down Expand Up @@ -452,6 +455,7 @@ export const destroy = async (req, res) => {

res.json({
message: 'Project deleted successfully',
success: true,
});
} catch (err) {
res.status(400).json({
Expand All @@ -474,6 +478,7 @@ export const batchUpload = async (req, res) => {
res.json({
message:
'CSV processing complete, your records have been added to the staging table.',
success: true,
});
} catch (error) {
logger.error('Batch Upload Failed.', error);
Expand Down
Loading

0 comments on commit 263ed87

Please sign in to comment.