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

test: #171, #181, #109, #180, #225, #97, #28, #80, #90, #156, #113, #194, #203 #230

Merged
merged 88 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
a024fba
[92] add optional filter to proposal/list endpoint
jankun4 Feb 2, 2024
395d8a8
delete 2x choose wallet modal render
Sworzen1 Feb 2, 2024
d88567d
add loading state everywhere is wallet triggering
Sworzen1 Feb 2, 2024
95f94b7
chore: update code owners of placek & MSzalowski
MSzalowski Feb 2, 2024
335a78c
move render modal from provider to app
Sworzen1 Feb 5, 2024
fcef196
Merge branch 'develop' of https://github.com/IntersectMBO/govtool int…
Sworzen1 Feb 5, 2024
582d254
[#81] configure unit tests with vitest
MSzalowski Feb 5, 2024
d43dcb3
docs: add MSzalowski as project code owner
MSzalowski Feb 6, 2024
faea5da
Update CODEOWNERS
kickloop Feb 7, 2024
3ce6c8d
unify drepid / refactor / add drepid into getProposals
Sworzen1 Feb 5, 2024
f41573d
add comment
Sworzen1 Feb 6, 2024
0e2b4e8
[#80] implement i18next
MSzalowski Feb 7, 2024
3ce9ea8
change import name
Sworzen1 Feb 8, 2024
f1bf28a
add CSP headers to govtool frontend service
adgud Feb 9, 2024
a060fd3
[#97] Update README to reflect new naming conventions
placek Feb 1, 2024
32a6bfb
[#97] Update backend and frontend READMEs for naming conventions
placek Feb 1, 2024
f726580
[#97] Update deployment documentation to align with new naming standards
placek Feb 1, 2024
f672841
[#97] Update docker compose build contexts for backend and frontend
placek Feb 1, 2024
d244304
[#97] Rename backend configuration files to align with new standards
placek Feb 1, 2024
af250c2
[#97] Rename container services in docker and grafana configurations
placek Feb 1, 2024
8869b35
[#97] Update traefik configuration labels for backend and frontend se…
placek Feb 1, 2024
bff314c
[#97] Update FakeDB database schema volumes in docker compose
placek Feb 1, 2024
c78331b
[#97] Update local domain names for backend and frontend services in …
placek Feb 1, 2024
aa0547f
[#97] Rename docker compose project
placek Feb 1, 2024
c6aaa5f
[#97] Rename FakeDB database name to 'govtool'
placek Feb 1, 2024
54a1ddd
[#97] Add note about possible backend executable rebranding in README
placek Feb 2, 2024
1df55d9
Add SSH connection helper to GovTool Makefile
placek Feb 5, 2024
8f60b3e
[#97] Rename grafana dashboard file for GovTool stack
placek Feb 5, 2024
f3534db
[#97] Update Traefik admin email in GitHub workflows
placek Feb 5, 2024
990c068
[#97] Update prometheus configuration for GovTool
placek Feb 5, 2024
42e4ff0
[#97] Update AWS profile name in .env.example for rebranding
placek Feb 5, 2024
86ffade
Enhance .env.example with more comprehensive examples
placek Feb 5, 2024
9d39ff4
[#97] Rename S3 bucket for Terraform state in AWS setup
placek Feb 5, 2024
c3e6524
[#97] Update Terraform lock table name in AWS configuration
placek Feb 5, 2024
c0bad10
[#97] Rename application components in infrastructure configuration
placek Feb 5, 2024
45c04c2
[#97] Rename and update backend tests for GovTool rebranding
placek Feb 6, 2024
7cb7a82
[#97] Rename and update integration tests for GovTool frontend
placek Feb 6, 2024
6aa5393
[#97] Update infrastructure tests to reflect GovTool rebranding
placek Feb 6, 2024
0766be0
[#97] Update metrics tests to reflect GovTool rebranding
placek Feb 6, 2024
bba0004
[#97] Rebrand load tests to align with GovTool project
placek Feb 6, 2024
3143257
[#97] Update lighthouse workflow for GovTool project
placek Feb 6, 2024
f13dd91
[#97] Update Sonar Scan workflow for GovTool frontend
placek Feb 6, 2024
238818c
Use commit hash for build version naming
placek Feb 8, 2024
8f2310f
Enhance flexibility with arbitrary docker compose commands
placek Feb 8, 2024
36b5360
Introduce Nix shell for enhanced development environment
placek Feb 8, 2024
5be6013
[#97] Revert S3 and DynamoDB names for legacy infrastructure access
placek Feb 8, 2024
0baf005
[#97] Introduce migration strategy for Terraform resource renaming
placek Feb 12, 2024
2d58c54
Update Cardano Node for SanchoNet environment
placek Feb 13, 2024
56cb7fb
Merge pull request #157 from IntersectMBO/chore/97-rebrand-applicatio…
placek Feb 13, 2024
b4b0a34
change input atom
Sworzen1 Feb 9, 2024
0e28ed1
create input field as molecule
Sworzen1 Feb 9, 2024
412c6ff
export Field from molecules
Sworzen1 Feb 9, 2024
6b10ad9
create ControlledField who includes Input/ export it
Sworzen1 Feb 9, 2024
fd3dfd0
create types
Sworzen1 Feb 9, 2024
dbc3af8
create Spacer atom
Sworzen1 Feb 9, 2024
96b6cce
refactor types
Sworzen1 Feb 9, 2024
46cb0f9
replace Input with ControlledField.Input
Sworzen1 Feb 9, 2024
0e213b0
update Input story
Sworzen1 Feb 12, 2024
c52c7cf
delete unnecesary snackbar
Sworzen1 Feb 12, 2024
cb346bc
[#171] Remove Nginx config post-deployment to prevent configuration r…
placek Feb 14, 2024
1298853
Merge pull request #172 from IntersectMBO/171-enhance-deployment-scri…
placek Feb 14, 2024
7a86e9e
chore: bump node version to 8.8
Ryun1 Feb 9, 2024
31d0cb9
chore: bump DBsync sancho version
Ryun1 Feb 14, 2024
26abc7c
chore: fix cardano node versions
Ryun1 Feb 14, 2024
d41d3bd
fix placeholder for metadata hash at url
Sworzen1 Feb 14, 2024
fceedfc
[#181] Implement hotfix for SanchoNet Cardano DB Sync configuration i…
placek Feb 15, 2024
f634078
chore: bump DBSync version to use fixed image
Ryun1 Feb 15, 2024
45f6890
Revert "[#181] Implement hotfix for SanchoNet Cardano DB Sync configu…
placek Feb 16, 2024
150bf62
create checkbox atom
Sworzen1 Feb 14, 2024
d875e41
create FormErrorMessage atom and export from atoms
Sworzen1 Feb 14, 2024
47ee5bc
add types for errorMessage and Checkbox
Sworzen1 Feb 14, 2024
c3ab38c
expand field molecule with Checkbox
Sworzen1 Feb 14, 2024
f7caa58
add types for molecules
Sworzen1 Feb 14, 2024
7a54780
use FormErrorMessage in Input component/ change typo style on styles
Sworzen1 Feb 14, 2024
dec39f5
create story for Checkbox component
Sworzen1 Feb 14, 2024
eb42981
delete unecessary code
Sworzen1 Feb 14, 2024
f586356
add Checkbox controlledField with types
Sworzen1 Feb 14, 2024
a5a6f55
improve checkbox
Sworzen1 Feb 14, 2024
69a4258
improvement
Sworzen1 Feb 15, 2024
5135a6a
add to Changelog
Sworzen1 Feb 15, 2024
8cceb53
change maintenance page text
Sworzen1 Feb 15, 2024
b82b1e7
add to changelog
Sworzen1 Feb 15, 2024
1796968
update CSL to .16
Sworzen1 Feb 12, 2024
9541604
add info to changelog
Sworzen1 Feb 14, 2024
077af03
Configure the notify make target to use Grafana's Slack configuration…
adgud Feb 18, 2024
7a1b9ad
fix build of frontend package
MSzalowski Feb 16, 2024
56cd329
[#203] Update Changelog for recent infrastructure updates
placek Feb 19, 2024
c2a6f59
[#225] Add Docker Compose configuration for Cardano Node and DBSync s…
placek Feb 20, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"fakedbsyncconfig" : {
"host" : "localhost",
"dbname" : "vva",
"dbname" : "govtool",
"user" : "postgres",
"password" : "MTnk8lsuMM41RgAh1y2WTAUdObsb",
"port" : 5432
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ jobs:
DBSYNC_POSTGRES_DB: "cexplorer"
DBSYNC_POSTGRES_USER: "postgres"
DBSYNC_POSTGRES_PASSWORD: "pSa8JCpQOACMUdGb"
FAKEDBSYNC_POSTGRES_DB: "vva"
FAKEDBSYNC_POSTGRES_DB: "govtool"
FAKEDBSYNC_POSTGRES_USER: "test"
FAKEDBSYNC_POSTGRES_PASSWORD: "test"
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }}
GRAFANA_SLACK_RECIPIENT: ${{ secrets.GRAFANA_SLACK_RECIPIENT }}
GRAFANA_SLACK_OAUTH_TOKEN: ${{ secrets.GRAFANA_SLACK_OAUTH_TOKEN }}
NGINX_BASIC_AUTH: ${{ secrets.NGINX_BASIC_AUTH }}
SENTRY_DSN_BACKEND: ${{ secrets.SENTRY_DSN_BACKEND }}
TRAEFIK_LE_EMAIL: "admin+vva@binarapps.com"
TRAEFIK_LE_EMAIL: "admin+govtool@binarapps.com"
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -191,15 +191,15 @@ jobs:
DBSYNC_POSTGRES_DB: "cexplorer"
DBSYNC_POSTGRES_USER: "postgres"
DBSYNC_POSTGRES_PASSWORD: "pSa8JCpQOACMUdGb"
FAKEDBSYNC_POSTGRES_DB: "vva"
FAKEDBSYNC_POSTGRES_DB: "govtool"
FAKEDBSYNC_POSTGRES_USER: "test"
FAKEDBSYNC_POSTGRES_PASSWORD: "test"
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }}
GRAFANA_SLACK_RECIPIENT: ${{ secrets.GRAFANA_SLACK_RECIPIENT }}
GRAFANA_SLACK_OAUTH_TOKEN: ${{ secrets.GRAFANA_SLACK_OAUTH_TOKEN }}
NGINX_BASIC_AUTH: ${{ secrets.NGINX_BASIC_AUTH }}
SENTRY_DSN_BACKEND: ${{ secrets.SENTRY_DSN_BACKEND }}
TRAEFIK_LE_EMAIL: "admin+vva@binarapps.com"
TRAEFIK_LE_EMAIL: "admin+govtool@binarapps.com"
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -246,8 +246,6 @@ jobs:
curl -X POST -u "admin:$GRAFANA_ADMIN_PASSWORD" https://$DOMAIN/grafana/api/admin/provisioning/dashboards/reload
curl -X POST -u "admin:$GRAFANA_ADMIN_PASSWORD" https://$DOMAIN/grafana/api/admin/provisioning/notifications/reload
- name: Notify on Slack
env:
SLACK_WEBHOOK_URL: ${{ secrets.DEPLOY_NOTIFY_SLACK_WEBHOOK_URL }}
run: |
if [[ "${{ inputs.environment }}" == "staging" ]]; then export DOMAIN=staging.govtool.byron.network; fi;
if [[ "${{ inputs.environment }}" == "beta" ]]; then export DOMAIN=sanchogov.tools; fi;
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/frontend_sonar_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
execute_sonar_scanner:
name: Execute sonar-scanner on vva-fe
name: Execute sonar-scanner on govtool frontend
runs-on: ubuntu-latest
permissions: read-all
steps:
Expand All @@ -26,4 +26,4 @@ jobs:
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
7 changes: 3 additions & 4 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Install dependencies
run: npm install
working-directory: ./govtool/frontend
Expand All @@ -27,7 +27,7 @@ jobs:
with:
path: |
~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('govtool/frontend/package-lock.json', 'tests/vva-fe/package-lock.json') }}
key: ${{ runner.os }}-npm-${{ hashFiles('govtool/frontend/package-lock.json', 'tests/govtool-frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-

Expand All @@ -45,7 +45,6 @@ jobs:
run: |
lhci assert --preset "lighthouse:recommended"


- name: Publish reports
working-directory: ./govtool/frontend
if: github.repository_owner == 'IntersectMBO'
Expand All @@ -56,4 +55,4 @@ jobs:
-d "@./lighthouseci/$(ls ./.lighthouseci |grep 'lhr.*\.json' | head -n 1)" \
-H "commit-hash: $(git rev-parse HEAD)" \
-H "secret-token: ${{ secrets.METRICS_SERVER_SECRET_TOKEN }}" \
-H 'Content-Type: application/json' || echo "Metric Upload error ignored ..."
-H 'Content-Type: application/json' || echo "Metric Upload error ignored ..."
10 changes: 5 additions & 5 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
push:
paths:
- .github/workflows/test_backend.yml
# - src/vva-be
# - tests/vva-be
# - govtool/backend
# - tests/govtool-backend

schedule:
- cron: '0 0 * * *'
Expand All @@ -18,23 +18,23 @@ on:
options:
- "sanchogov.tools/api"
- "staging.govtool.byron.network/api"
- "vva-sanchonet.cardanoapi.io/api"
- "govtool-sanchonet.cardanoapi.io/api"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11.4
cache: 'pip'

- name: Run Backend Test
working-directory: tests/vva-be
working-directory: tests/govtool-backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/test_integration_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ on:
options:
- "sanchogov.tools"
- "staging.govtool.byron.network"
- "vva-sanchonet.cardanoapi.io"
- "govtool-sanchonet.cardanoapi.io"

jobs:
cypress-tests:
defaults:
run:
working-directory: ./tests/vva-fe
working-directory: ./tests/govtool-frontend
runs-on: ubuntu-latest
env:
NODE_OPTIONS: --max_old_space_size=4096
Expand All @@ -50,15 +50,15 @@ jobs:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
key:
${{ runner.os }}-yarn-${{hashFiles('tests/vva-fe/yarn.lock') }}
${{ runner.os }}-yarn-${{hashFiles('tests/govtool-frontend/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Cypress run
uses: cypress-io/github-action@v6
with:
record: true
working-directory: ./tests/vva-fe
working-directory: ./tests/govtool-frontend
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
Expand All @@ -69,4 +69,3 @@ jobs:
CYPRESS_kuberApiKey: ${{secrets.KUBER_API_KEY}}
CYPRESS_faucetApiUrl: https://faucet.${{inputs.network || 'sanchonet'}}.world.dev.cardano.org
CYPRESS_faucetApiKey: ${{ secrets.FAUCET_API_KEY }}

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,8 @@ infra/terraform/.terraform*
# local env files
.env
.envrc

# local docker-compose files
scripts/govtool/dev-postgres_db
scripts/govtool/dev-postgres_user
scripts/govtool/dev-postgres_password
29 changes: 11 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,28 @@ As a minor extension, we also keep a semantic version for the `UNRELEASED`
changes.

## [Unreleased]

### Added
-
- Create Checkbox component. Improve Field and ControlledField [Issue 177](https://github.com/IntersectMBO/govtool/pull/177)
- Vitest unit tests added for utils functions [Issue 81](https://github.com/IntersectMBO/govtool/issues/81)
- i18next library added to FE [Issue 80](https://github.com/IntersectMBO/govtool/issues/80)

### Fixed
- Fix copy for maintenance page [Issue 180](https://github.com/IntersectMBO/govtool/issues/180)
- Fix misleading metadata hash text [Issue 90](https://github.com/IntersectMBO/govtool/issues/90)
- Fixed vote calculation problems related to NoConfidence DRep [Issue 59](https://github.com/IntersectMBO/govtool/issues/59)
- Fixed ada-holder/get-current-delegation error when delegated to NoConfidence or AlwaysAbstain dreps. [Issue 82](https://github.com/IntersectMBO/govtool/issues/82)
- Fixed deployment scripts to address [Issue 171](https://github.com/IntersectMBO/govtool/issues/171).

### Changed
- Update Cardano-Serialization-Lib to 12.0.0-alpha.16 [Issue 156](https://github.com/IntersectMBO/govtool/issues/156)
- Changed and improved working conventions docs, PR template and codeowners file, addressing [Issue 88](https://github.com/IntersectMBO/govtool/issues/88).

### Removed
-

## [sancho-v1.0.1](https://github.com/IntersectMBO/govtool/releases/tag/sancho-v1.0.1) 2023-12-XX

### Added
-

### Fixed
-

### Changed
- Changed Node version from 8.7.1-pre to 8.7.2 and Db-sync version from sancho-2-3-0 to sancho-3-0-0.
- Changed Node version from 8.7.1-pre to 8.8.0-pre and DbSync version from sancho-2-3-0 to sancho-4-0-0-fix-config, addressing also [Issue 181](https://github.com/IntersectMBO/govtool/issues/181).
- Reorganized repository to fit new conventions [Issue 85](https://github.com/IntersectMBO/govtool/issues/85).
- Renamed project from VVA to GovTool [Issue 97](https://github.com/IntersectMBO/govtool/issues/97).
- (`docs/update-working-conventions`) Addressing [Issue 25](https://github.com/IntersectMBO/govtool/issues/25) changed working conventions documentation to improve intended flows.

### Removed
-

## [sancho-v1.0.0](https://github.com/IntersectMBO/govtool/releases/tag/sancho-v1.0.0) 2023-12-17

- Import code to new repository
- Import code to new repository
18 changes: 9 additions & 9 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# GovTool Project Codeowners

# These owners will be the default owners for everything in the repository.
* @Ryun1 @kickloop
* @kickloop @MSzalowski

# Frontend assets templates
govtool/frontend/* @Sworzen1 @JanJaroszczak @kickloop
*.tsx @Sworzen1 @JanJaroszczak @kickloop
*.ts @Sworzen1 @JanJaroszczak @kickloop
*.css @Sworzen1 @JanJaroszczak @kickloop
govtool/frontend/* @MSzalowski @Sworzen1 @JanJaroszczak @kickloop
*.tsx @MSzalowski @Sworzen1 @JanJaroszczak @kickloop
*.ts @MSzalowski @Sworzen1 @JanJaroszczak @kickloop
*.css @MSzalowski @Sworzen1 @JanJaroszczak @kickloop

# Backend
govtool/backend/* @jankun4 @kickloop
govtool/backend/* @MSzalowski @jankun4 @kickloop

# DevOps
.github/workflows/* @adgud @kickloop
config/govtool/* @adgud @kickloop
infra/terraform/* @adgud @kickloop
.github/workflows/* @placek @adgud @kickloop
config/govtool/* @placek @adgud @kickloop
infra/terraform/* @placek @adgud @kickloop

# Testing
gov-action-loader/* @IntersectMBO/govtool-test @kickloop
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ The SanchoNet GovTool is currently open for beta testing and can be accessed at
Learn more; [docs.sanchogov.tools](https://docs.sanchogov.tools/).

## 📍 Navigation
- [GovTool Backend](./src/vva-be/README.md)
- [GovTool Frontend](./src/vva-fe/README.md)
- [GovTool Backend](./govtool/backend/README.md)
- [GovTool Frontend](./govtool/frontend/README.md)
- [Documentation](./docs/)
- [Tests](./tests/)

Expand All @@ -45,4 +45,4 @@ Frontend is able to connect to Cardano wallets over the [CIP-30](https://github.

## 🤝 Contributing
Thanks for considering contributing and helping us on creating GovTool! 😎
Please checkout our [Contributing Documentation](./CONTRIBUTING.md).
Please checkout our [Contributing Documentation](./CONTRIBUTING.md).
20 changes: 18 additions & 2 deletions docs/operations/DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AWS is configured with Terraform, but the account needs to be bootstrapped befor
This has to be done only once per AWS account.

1. Configure AWS CLI with `aws configure` (if you are using a configuration profile, use `aws --profile MYPROFILE configure` and then `export AWS_PROFILE=MYPROFILE`).
1. Execute `./src/terraform/bootstrap-aws-account.sh` script.
1. Execute `./infra/terraform/bootstrap-aws-account.sh` script.

### Infrastructure setup

Expand All @@ -29,7 +29,7 @@ This has to be done only once per AWS account.
1. Run `terraform plan` to view changes that would be performed to infrastructure.
1. Take note of the outputs - they contain ECR repo URLs and app domains.

Note: the Terraform code configures the EC2 instance using `src/terraform/modules/vva-ec2/user_data.sh`. This script is only executed on instance creation.
Note: the Terraform code configures the EC2 instance using `infra/terraform/modules/govtool-ec2/user_data.sh`. This script is only executed on instance creation.

## Application deployment

Expand All @@ -52,3 +52,19 @@ Alternatively you can type `make all instance=$INSTANCE cardano_network=$CARDANO

View the app at `https://${ENVIRONMENT}-${INSTANCE}.govtool.byron.network`.
Keep in mind that after initial deployment on a new environment, it will take some time for the Cardano node to get in sync.

## Aftermatch

After performing a deploy from a local machine, it is crucial to carefully track
the application's accessibility and functionality to ensure no unintended
changes, such as the accidental activation of BasicAuth[^1], have occurred.

Additionally, verifying that all configuration files and environment variables,
particularly those related to environment-specific settings like database
connections or external service endpoints, are correctly generated and applied
is essential for maintaining the intended behavior of the application across
different environments. This includes a thorough check of environment variables
to confirm they are correctly set and aligned with the specific needs of the
deployed environment.

[^1]: https://github.com/IntersectMBO/govtool/discussions/174
8 changes: 5 additions & 3 deletions govtool/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is a backend application of GovTool project.

## Prerequisites
In order to run `vva-be` your host machine will need access to the `cardano-db-sync` postgres database. To have this database running locally you'll need:
In order to run `backend` your host machine will need access to the `cardano-db-sync` postgres database. To have this database running locally you'll need:
* `cardano-node`
* `cardano-db-sync`
* PostgreSQL database
Expand All @@ -24,10 +24,10 @@ Due to problems with openapi3 package it's hard to build this project with plain

1. Get [Nix](https://nixos.org/download).

2. Enter `src/vva-be` directory:
2. Enter `govtool/backend` directory:

```sh
cd src/vva-be
cd govtool/backend
```

3. Allow broken nix packages
Expand All @@ -54,3 +54,5 @@ Due to problems with openapi3 package it's hard to build this project with plain
```sh
cabal run vva-be -- --config <YOUR CONFIG FILE> start-app
```
> [!WARNING]
> In the context of our ongoing project enhancements, it is assumed that the executable previously known as 'vva-be' should be now officially renamed to 'govtool-backend'. This change is necessary for aligning with the updated branding and functional scope of the application and it has to be implemented in the near future as a chore and refactoring ticket. Make sure that the documentation matches the actual name of the executable.
16 changes: 15 additions & 1 deletion govtool/backend/src/VVA/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type VVAApi =
:> QueryParam "sort" GovernanceActionSortMode
:> QueryParam "page" Natural
:> QueryParam "pageSize" Natural
:> QueryParam "drepId" HexText
:> Get '[JSON] ListProposalsResponse
:<|> "proposal" :> "get" :> Capture "proposalId" GovActionId :> QueryParam "drepId" HexText :> Get '[JSON] GetProposalResponse
:<|> "epoch" :> "params" :> Get '[JSON] GetCurrentEpochParamsResponse
Expand Down Expand Up @@ -175,13 +176,26 @@ listProposals
-> Maybe GovernanceActionSortMode
-> Maybe Natural
-> Maybe Natural
-> Maybe HexText
-> m ListProposalsResponse
listProposals selectedTypes sortMode mPage mPageSize = do
listProposals selectedTypes sortMode mPage mPageSize mDrepRaw = do
let page = (fromIntegral $ fromMaybe 0 mPage) :: Int
pageSize = (fromIntegral $ fromMaybe 10 mPageSize) :: Int

-- proposals that the provided Drep has already voted on should be filtered out
proposalsToRemove <- case mDrepRaw of
Nothing -> return []
Just drepId ->
map (voteParamsProposalId . voteResponseVote)
<$> getVotes drepId [] Nothing

CacheEnv {proposalListCache} <- asks vvaCache
mappedAndSortedProposals <-
filter
( \ProposalResponse {proposalResponseId} ->
proposalResponseId `notElem` proposalsToRemove
)
<$>
mapSortAndFilterProposals selectedTypes sortMode
<$> cacheRequest proposalListCache () Proposal.listProposals

Expand Down
Loading