Skip to content

Commit

Permalink
Merge branch 'dev' of ssh://git.lidonation.com:45132/voltaire/govtool…
Browse files Browse the repository at this point in the history
…-outcomes-pillar into dev
  • Loading branch information
Emmanuel-Tyty committed Feb 21, 2025
2 parents c42a5a0 + 89a786d commit 7aff23e
Show file tree
Hide file tree
Showing 32 changed files with 2,437 additions and 1,787 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/gitlab-tags-releases-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Sync tags and releases to GitLab

on:
release:
types: [published, edited, deleted]
push:
tags:
- "*"
delete:

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
# Add GitLab remote
- name: Add GitLab remote
run: |
git remote add gitlab "https://oauth2:${GITLAB_TOKEN}@gitlab.lidonation.com/voltaire/govtool-outcomes-pillar.git"
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}

# Sync tags including deletions
- name: Sync tags
run: |
if [[ "${{ github.event_name }}" == "delete" && "${{ github.event.ref_type }}" == "tag" ]]; then
# Delete tag from GitLab
git push gitlab :refs/tags/${{ github.event.ref }}
else
# Push all tags
git fetch origin --tags
git push gitlab --tags --force
fi
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}

# Sync releases using GitLab API
- name: Sync releases
if: github.event_name == 'release'
run: |
if [[ "${{ github.event.action }}" == "published" || "${{ github.event.action }}" == "edited" ]]; then
# Get release info from GitHub
RELEASE_TAG="${{ github.event.release.tag_name }}"
RELEASE_NAME="${{ github.event.release.name }}"
RELEASE_DESC="${{ github.event.release.body }}"
# Create/Update release in GitLab using API
curl --request POST "https://gitlab.lidonation.com/api/v4/projects/${GITLAB_PROJECT_ID}/releases" \
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
--header "Content-Type: application/json" \
--data "{
\"tag_name\": \"${RELEASE_TAG}\",
\"name\": \"${RELEASE_NAME}\",
\"description\": \"${RELEASE_DESC}\"
}"
elif [[ "${{ github.event.action }}" == "deleted" ]]; then
# Delete release in GitLab
curl --request DELETE "https://gitlab.lidonation.com/api/v4/projects/${GITLAB_PROJECT_ID}/releases/${{ github.event.release.tag_name }}" \
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}"
fi
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }}
12 changes: 6 additions & 6 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DATABASE_HOST=34.200.162.26
DATABASE_PORT=5432
DATABASE_NAME=cexplorer
DATABASE_USER=preview_read
DATABASE_PASSWORD=read_preview
IPFS_GATEWAY=https://dweb.link/ipfs
DATABASE_HOST=""
DATABASE_PORT=""
DATABASE_NAME=""
DATABASE_USER=""
DATABASE_PASSWORD=""
IPFS_GATEWAY=""
54 changes: 27 additions & 27 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,41 @@
},
"dependencies": {
"@nestjs/axios": "^4.0.0",
"@nestjs/common": "^9.0.0",
"@nestjs/common": "^11.0.10",
"@nestjs/config": "^4.0.0",
"@nestjs/core": "^9.0.0",
"@nestjs/core": "^11.0.10",
"@nestjs/mapped-types": "*",
"@nestjs/platform-express": "^9.0.0",
"@nestjs/platform-express": "^11.0.10",
"@nestjs/typeorm": "^11.0.0",
"axios": "^1.7.9",
"pg": "^8.13.1",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"pg": "^8.13.3",
"reflect-metadata": "^0.2.2",
"rimraf": "^6.0.1",
"rxjs": "^7.8.1",
"typeorm": "^0.3.20"
},
"devDependencies": {
"@nestjs/cli": "^9.0.0",
"@nestjs/schematics": "^9.0.0",
"@nestjs/testing": "^9.0.0",
"@types/express": "^4.17.13",
"@types/jest": "28.1.8",
"@types/node": "^16.0.0",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "28.1.3",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "28.0.8",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "4.1.0",
"typescript": "^4.7.4"
"@nestjs/cli": "^11.0.4",
"@nestjs/schematics": "^11.0.1",
"@nestjs/testing": "^11.0.10",
"@types/express": "^5.0.0",
"@types/jest": "29.5.14",
"@types/node": "^22.13.4",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^8.24.1",
"@typescript-eslint/parser": "^8.24.1",
"eslint": "^9.20.1",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-prettier": "^5.2.3",
"jest": "29.7.0",
"prettier": "^3.5.1",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "29.2.5",
"ts-loader": "^9.5.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "4.2.0",
"typescript": "^5.7.3"
},
"jest": {
"moduleFileExtensions": [
Expand Down
29 changes: 2 additions & 27 deletions backend/src/governance-actions/governance-actions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ export class GovernanceActionsService {
filters: string[],
sort: string,
page: number = 1,
limit: number = 10
limit: number = 12
) {
const searchTerm = search ? search.trim() : "";
const filterArray = filters?.length > 0 ? filters : null;
const sortOption = sort || "newestFirst";
const offset = (page - 1) * limit;


return this.cexplorerService.manager.query(getGovernanceActions, [
searchTerm,
filterArray,
Expand Down Expand Up @@ -72,36 +71,12 @@ export class GovernanceActionsService {
};
}),
catchError((error) => {
if (error.response) {
if (url.startsWith("ipfs://") && error.response.status === 504) {
throw new HttpException(
"IPFS gateway timeout: Content might be unavailable",
504
);
}
throw new HttpException(
`Server error: ${error.response.status}`,
error.response.status
);
} else if (error.request) {
throw new HttpException(
"Network error: Unable to reach the server",
503
);
} else {
throw new Error(`Error: ${error.message}`);
}
throw new Error(`Error: ${error.message}`);
})
);

return await lastValueFrom(response$);
} catch (error) {
if (url.startsWith("ipfs://") && error instanceof HttpException) {
throw new HttpException(
`IPFS Error: ${error.message}`,
error.getStatus()
);
}
throw error;
}
}
Expand Down
22 changes: 0 additions & 22 deletions backend/src/queries/governanceActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,28 +291,6 @@ AND (
END
)
ORDER BY
CASE WHEN $3 = 'soonToExpire' THEN
CASE
WHEN gov_action_proposal.ratified_epoch IS NULL
AND gov_action_proposal.enacted_epoch IS NULL
AND gov_action_proposal.dropped_epoch IS NULL
AND gov_action_proposal.expired_epoch IS NULL
THEN 0
ELSE 1
END
ELSE 0 END ASC,
CASE WHEN $3 = 'soonToExpire' THEN
CASE
WHEN gov_action_proposal.ratified_epoch IS NULL
AND gov_action_proposal.enacted_epoch IS NULL
AND gov_action_proposal.dropped_epoch IS NULL
AND gov_action_proposal.expired_epoch IS NULL
THEN gov_action_proposal.expiration - latest_epoch.no
ELSE NULL
END
END ASC,
CASE WHEN $3 = 'oldestFirst' THEN
creator_block.epoch_no
END ASC,
Expand Down
Loading

0 comments on commit 7aff23e

Please sign in to comment.