Skip to content
Open
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: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NODE_ENV=development
PORT=5400
100 changes: 50 additions & 50 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,55 +43,55 @@ jobs:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# env:
# CI: true
e2eTest:
name: (develop) E2E - Checkout infrastructure, install mocha and run tests (docker-compose up, mocha tests and docker-compose down)
needs: buildTest
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
with:
repository: governify/bluejay-infrastructure
ref: refs/heads/develop
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Add host.docker.internal association to 172.17.0.1
run: sudo echo "172.17.0.1 host.docker.internal" | sudo tee -a /etc/hosts
- name: Run tests
run: npm run test
env:
CI: true
e2eMain:
name: (main) E2E - Checkout infrastructure, install mocha and run tests (docker-compose up, mocha tests and docker-compose down)
if: ${{ github.ref == 'refs/heads/main' }}
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
with:
repository: governify/bluejay-infrastructure
ref: refs/heads/develop
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Add host.docker.internal association to 172.17.0.1
run: sudo echo "172.17.0.1 host.docker.internal" | sudo tee -a /etc/hosts
- name: Run tests
run: npm run test
env:
CI: true
# e2eTest:
# name: (develop) E2E - Checkout infrastructure, install mocha and run tests (docker-compose up, mocha tests and docker-compose down)
# needs: buildTest
# runs-on: ubuntu-latest
# strategy:
# matrix:
# node-version: [14.x]
# steps:
# - uses: actions/checkout@v2
# with:
# repository: governify/bluejay-infrastructure
# ref: refs/heads/develop
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
# - name: Install dependencies
# run: npm ci
# - name: Add host.docker.internal association to 172.17.0.1
# run: sudo echo "172.17.0.1 host.docker.internal" | sudo tee -a /etc/hosts
# - name: Run tests
# run: npm run test
# env:
# CI: true
# e2eMain:
# name: (main) E2E - Checkout infrastructure, install mocha and run tests (docker-compose up, mocha tests and docker-compose down)
# if: ${{ github.ref == 'refs/heads/main' }}
# needs: test
# runs-on: ubuntu-latest
# strategy:
# matrix:
# node-version: [14.x]
# steps:
# - uses: actions/checkout@v2
# with:
# repository: governify/bluejay-infrastructure
# ref: refs/heads/develop
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
# - name: Install dependencies
# run: npm ci
# - name: Add host.docker.internal association to 172.17.0.1
# run: sudo echo "172.17.0.1 host.docker.internal" | sudo tee -a /etc/hosts
# - name: Run tests
# run: npm run test
# env:
# CI: true
buildTest:
name: Build and push to dockerhub using develop tag
if: ${{ github.ref == 'refs/heads/develop' && github.event_name == 'push' }}
Expand All @@ -118,7 +118,7 @@ jobs:
buildProdAndRelease:
name: Release, build and push to dockerhub using tag version
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push'}}
needs: e2eMain
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# [3.9.0](https://github.com/governify/registry/compare/v3.8.0...v3.9.0) (2025-10-16)


### Bug Fixes

* update job dependency from e2eMain to test in nodejs.yml ([c5bc184](https://github.com/governify/registry/commit/c5bc184dcc3679e6b721d6dc746a8198d761c45e))


### Features

* put agreements ([37464b5](https://github.com/governify/registry/commit/37464b5652be9cd322d01b1e8637984e123661de))



# [3.8.0](https://github.com/governify/registry/compare/v3.7.0...v3.8.0) (2024-01-22)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "governify-registry",
"buildOn": "2018-04-18",
"version": "3.8.0",
"version": "3.9.0",
"description": "Central repository for agreements",
"homepage": "https://github.com/isa-group/governify-registry",
"main": "index.js",
Expand Down
25 changes: 25 additions & 0 deletions src/api/swaggerV6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,31 @@ paths:
schema:
$ref: '#/definitions/error_model'
x-swagger-router-controller: AgreementRegistry
put:
tags:
- agreement-registry
description: Update an existing agreement
operationId: agreementsAgreementPUT
parameters:
- name: agreement
in: path
description: XXX
required: true
type: string
- name: agreementBody
in: body
description: XXX
required: true
schema:
$ref: '#/definitions/agreement'
responses:
'200':
description: Success
'400':
description: Bad request
schema:
$ref: '#/definitions/error_model'
x-swagger-router-controller: AgreementRegistry
/states:
get:
tags:
Expand Down
5 changes: 5 additions & 0 deletions src/controllers/v6/AgreementRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports = {

agreementsAgreementGET: _agreementsAgreementGET,
agreementsAgreementDELETE: _agreementsAgreementDELETE,
agreementsAgreementPUT: _agreementsAgreementPUT,

agreementsAgreementTermsGuaranteesGET: _agreementsAgreementTermsGuaranteesGET,
agreementsAgreementTermsGuaranteesGuaranteeGET: _agreementsAgreementTermsGuaranteesGuaranteeGET
Expand Down Expand Up @@ -92,6 +93,10 @@ function _agreementsAgreementGET (req, res, next) {
agreements.agreementIdGET(req.swagger.params, res, next);
}

function _agreementsAgreementPUT (req, res, next) {
agreements.agreementsAgreementPUT(req.swagger.params, res, next);
}

/**
* agreementsGET.
* @param {Object} req request
Expand Down
37 changes: 37 additions & 0 deletions src/controllers/v6/agreements/agreements.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module.exports = {
agreementsGET: _agreementsGET,
agreementIdGET: _agreementIdGET,
agreementIdDELETE: _agreementIdDELETE,
agreementsAgreementPUT: _agreementsAgreementPUT,
agreementsAgreementTermsGuaranteesGET: _agreementsAgreementTermsGuaranteesGET,
agreementsAgreementTermsGuaranteesGuaranteeGET: _agreementsAgreementTermsGuaranteesGuaranteeGET
};
Expand Down Expand Up @@ -204,6 +205,42 @@ function _agreementIdDELETE (args, res) {
}
}

function _agreementsAgreementPUT (args, res) {
logger.info('New request to UPDATE agreement');
// Use correct parameter names from Swagger
const agreementId = args.agreement?.value;
// Accept both 'agreementBody' and fallback to 'body' for backward compatibility
const agreementBody = args.agreementBody?.value || args.body?.value;
if (agreementId && agreementBody) {
$RefParser.dereference(agreementBody, function (err, schema) {
if (err) {
logger.error(err.toString());
res.status(500).json(new ErrorModel(500, err));
} else {
const AgreementModel = db.models.AgreementModel;
AgreementModel.findOneAndUpdate({
id: agreementId
}, schema, { new: true }, function (err, agreement) {
if (err) {
logger.error('Mongo error updating agreement: ' + err.toString());
res.status(500).json(new ErrorModel(500, err));
} else {
if (!agreement) {
logger.warn('There is no agreement with id: ' + agreementId);
return res.status(404).json(new ErrorModel(404, 'There is no agreement with id: ' + agreementId));
}
logger.info('Agreement updated successfully!');
res.status(200).json(agreement);
}
});
}
});
} else {
res.sendStatus(400);
logger.warn("Can't update agreement: missing id or body");
}
}

/**
* Get all agreement terms.
* @param {Object} args {}
Expand Down
Loading