Skip to content

Commit

Permalink
feat(4): openmaps (#217)
Browse files Browse the repository at this point in the history
* chore: updating pom

updating pom file to add build and properties

* chore: adding commons-lang3

adding apache commons lang 3 as a dependency

* chore: code cleanup

refactoring a small portion of the code to:

- comply with checkstyle guideline
- use records when possible
- removed interfaces for services

* chore: removing dependencies

removed a few dependencies as they are not required:

- jakarta.inject-api
- commons-collections
- jettison
- spring-context-indexer

Fix #188

* chore: removing component from entity

Entity classes are supposed to be session-bounded. By annotating a class with @component you're flagging it for spring to instantiate it as a managed bean, keeping it as a singleton.

As an entity is supposed to be just a data holder for the database, it makes no sense to use it as a component.

The scope controls the component scope or in simple words, marks how spring will control this singleton lifecycle. You can set a scope per user session (meaning that a bean will exist for each user session) or more global.

Fix #188

* chore: removing ScopeConstant.java

Fix #188

* chore: removing component from entity

Entity classes are supposed to be session-bounded. By annotating a class with @component you're flagging it for spring to instantiate it as a managed bean, keeping it as a singleton.

As an entity is supposed to be just a data holder for the database, it makes no sense to use it as a component.

The scope controls the component scope or in simple words, marks how spring will control this singleton lifecycle. You can set a scope per user session (meaning that a bean will exist for each user session) or more global.

Fix #188

* chore: removing ScopeConstant.java

Fix #188

* chore: adding lombok and refactoring

adding lombok as a dependency and refactoring the code to make use of it. Lombok reduces the boilerplate code by annotating classes that will generate the actual content during build time.

removed `Serializable` interface from entities. Even being a best practice to mark entities as serializable, you only need to mark it if you need to transfer them over-the-wire (serialize them to some other representation), store them in http session (which is in turn serialized to hard disk by the servlet container), or even persist it as a binary content.
as stated on JPA specification:
    If an entity instance is to be passed by value as a detached object (e.g., through a remote interface), the entity class must implement the Serializable interface.

in our case, hibernate will pass it as a reference, and update the fields on the database even if we do not set it as `Serializable`

Fix #188

* Frontend(deps-dev): Bump @types/node in /frontend (#191)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.11.12 to 18.11.15.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Derek Roberts <derek.roberts@gmail.com>
Co-authored-by: MCatherine <Mcatherine1994@gmail.com>

* Frontend(deps-dev): Bump @typescript-eslint/eslint-plugin in /frontend (#186)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.46.0 to 5.46.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.46.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Merge to main close #190: add checking duplicate api to frontend (#192)

* feat/frontend: added check duplicate api to frontend, refs: #190

* feat/frontend: reinstalled node packages, refs: #190

* feat/pipeline: adjust memory request for deployment yaml file

* feat/frontend: added example for generate form based on json schema, refs: #50

* Exclude example dir from SonarCloud

* Comment out placeholder file

Co-authored-by: Derek Roberts <derek.roberts@gmail.com>

* chore: code cleanup

refactoring a small portion of the code to:

- comply with checkstyle guideline
- use records when possible
- removed interfaces for services

* chore: removing dependencies

removed a few dependencies as they are not required:

- jakarta.inject-api
- commons-collections
- jettison
- spring-context-indexer

Fix #188

* chore: adding lombok and refactoring

adding lombok as a dependency and refactoring the code to make use of it. Lombok reduces the boilerplate code by annotating classes that will generate the actual content during build time.

removed `Serializable` interface from entities. Even being a best practice to mark entities as serializable, you only need to mark it if you need to transfer them over-the-wire (serialize them to some other representation), store them in http session (which is in turn serialized to hard disk by the servlet container), or even persist it as a binary content.
as stated on JPA specification:
    If an entity instance is to be passed by value as a detached object (e.g., through a remote interface), the entity class must implement the Serializable interface.

in our case, hibernate will pass it as a reference, and update the fields on the database even if we do not set it as `Serializable`

Fix #188

* chore: adding lombok and refactoring

adding lombok as a dependency and refactoring the code to make use of it. Lombok reduces the boilerplate code by annotating classes that will generate the actual content during build time.

removed `Serializable` interface from entities. Even being a best practice to mark entities as serializable, you only need to mark it if you need to transfer them over-the-wire (serialize them to some other representation), store them in http session (which is in turn serialized to hard disk by the servlet container), or even persist it as a binary content.
as stated on JPA specification:
    If an entity instance is to be passed by value as a detached object (e.g., through a remote interface), the entity class must implement the Serializable interface.

in our case, hibernate will pass it as a reference, and update the fields on the database even if we do not set it as `Serializable`

Fix #188

* chore: removing mapping

Fix #188

* chore: code cleanup

* chore: updating gititnore

* chore: cleaning up repository

* chore: cleaning up repository

* chore: updating gitignore

* chore: updating dependencies and cleanup

removing SwaggerConfiguration.java as it is not required anymore.

updating OraclePersistenceConfiguration and PostgresPersistenceConfiguration for better maintainability.

moved configurations to reside inside YML file and reused properties file for build purpose.

added documentation folder with initial compose file.

* ci: updating workflow and labels

* ci: adding codechange detection

* ci: fixing ci for frontend

* ci: limiting ci per folder

* ci: removing changes

* ci: adding backend ci

* chore: moving packages out of core

we will be reworking the folder/package structure

* feat: added functional routes

added base classes and code for functional routing. this will be the skeleton/starting point for the functional routing

* chore: removing old common service package

removed old code to give some space for the new implementation

* feat: adding common service functional api

- added the functional api endpoint for the common service.
- moved the old dto classes to new record dto.
- added new dto to align with api specification.
- added new exceptions to handle error cases
- moved service to use mono and webclient

* ci: fixing backend ci

* ci: changing mvn wrapper exec mode

* ci: updating ci configuration

* ci(docker): updating dockerfile

* ci(docker): updating dockerfile

* feat!: removing oracle data.

oracle data will be moved to nr-forest-client-api.

* chore: commenting out class for now

those classes will be reworked on next feat branches

* feat: reworking commons host email

- reworked the code to include error handling from ches.
- added exception classes
- added support for testcontainers (for future tests)
- added tests for common host email endpoint

* chore: updating yml configurations

* test: adding more test cases

* ci: updating backend ci

* feat: updating functional routing

- updated functional routing to enable other routes
- moved parameters away from abstract router
- updated ches route

* chore: removing old orgbook code

* feat: adding orgbook endpoint

* chore: code cleanup

- removed SwaggerUtils
- updated underlying code to not rely on SwaggerUtils
- updated CoreUtil to be a POJO Singleton

* chore: commenting out postgres code

* feat: updating to boot 3.0.1

* test: adding tests to orgbook endpoint

* chore: updating configuration and npe

- preventing possible npe
- updating coverage

* chore: removing fsa postgres client data

* chore: updating orgbook route swagger

* chore: removing old postgres code

* feat: fsa client implementation from postgres

* feat: moving to r2dbc and flyway

- moving from jpa to r2dbc
- added flyway to manage sql scripts
- added repeatable sql script to test

* test: adding fsa client test

* ci(docker): updating dockerfile

- changed dockerfile to use jre instead of jdk
- removed oracle part of the process
- updated ci to build image before release

* ci(mvnw): updating ci

* ci(mvnw): updating ci

* ci(mvnw): updating ci

* ci(docker): testing out release

* chore: updated path to nrs

- changed groupid to include nrs
- changed yml files to include nrs

* chore: moved webclient to config

- moved webclient instantiation to config class as beans
- changed services to inject webclient

* chore: updated routing

- changed route parent part to the RouteConfiguration class
- updated route classes

note: I choose to move the api to the RouteConfiguration class instead of setting as a basepath on the yml file to allow for paths without the API to exist, specially the actuator paths.

* ci: updating test command parameter

* ci: removing sonar parameter

* ci: changing parameters for sonar

- moving most of the parameters to within pom file

* chore: removing unused constants

* ci: updating deployment

- removed oracle information from deployment
- removed oracle information from workflow
- added common service parameter to yml

* chore: code smell cleanup

* chore: code smell cleanup

* fix: fixing app parameter naming

* chore: changing parameter from URI to String

this is to prevent conversion errors

* ci(openshift): fixing health probe

- fixed the health probe address to be /health
- changed port back to 3000

* ci(openshift): updating health probe

* chore: renaming fsa package to client

* ci: updating deploy action version

* ci: updating deploy health endpoint

* chore: moving date to be a parameter on client

* chore: updating compose file

removing compose file inside docs and updating the one at root

* ci: removing be-tests workflow

* chore: re-adding db init script

* chore: updating client query

* chore: code cleanup

* chore: updating gitignore

* chore: fixing naming convention

* chore: removing old openmaps code

* feat(openmaps): adding openmaps feature

- moved dtos to correct package
- moved service to correct package
- changed service to be reactive
- added a route and handler to expose openmaps
- added configuration to read openmaps props
- added test to openmaps route
- changed coverage to match sonar

* chore: fixing code smell and style

* doc: updating readme file

* chore: fixing naming convention

* fix: fixing rebase issues

* chore: changing dtos to match naming convention

* docs: updating .gitignore

* docs: updating readme

* docs: updating readme

* chore(deps): removing json conflict

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Paulo Gomes da Cruz Junior <pcruz@daitan.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Derek Roberts <derek.roberts@gmail.com>
Co-authored-by: MCatherine <Mcatherine1994@gmail.com>
Co-authored-by: Maria Martinez <77364706+mamartinezmejia@users.noreply.github.com>
  • Loading branch information
6 people authored Jan 6, 2023
1 parent 586b9b3 commit 080c514
Show file tree
Hide file tree
Showing 160 changed files with 5,962 additions and 4,049 deletions.
63 changes: 63 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
github_actions:
- .github/*

tests:
- backend/src/test/**/*.java
- frontend/cypress/**/*
- frontend/src/tests/**/*.spec.ts

source:
- backend/src/main/**/*.java
- frontend/src/**/*.ts

docker:
- any: ['Dockerfile','dockerfile-entrypoint.sh']

controller:
- backend/src/main/**/controller/*.java

dto:
- backend/src/main/**/dto/*.java

entity:
- backend/src/main/**/entity/*.java

repository:
- backend/src/main/**/repository/*.java

configuration:
- backend/src/main/**/configuration/*.java
- backend/src/main/resources/**/*
- backend/config/**/*
- frontend/tsconfig*
- frontend/vite*
- frontend/*.json

service:
- backend/src/main/**/service/*.java

frontend:
- frontend/**/*

backend:
- backend/**/*

database:
- database/**/*

dependencies:
- any: ['backend/pom.xml','frontend/package.json','package-lock.json']

documentation:
- backend/docs/**/*
- frontend/docs/**/*
- docs/**/*

java:
- backend/**/*

javascript:
- frontend/**/*

openshift:
- '**/openshift.*.yml'
67 changes: 61 additions & 6 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,63 @@ concurrency:
cancel-in-progress: true

jobs:
pr-validation:
name: Pull Request Validation
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3

- name: Pull request size and stability labels
uses: actions/labeler@v4
continue-on-error: true
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Conventional Label
uses: bcoe/conventional-release-labels@v1
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
ignored_types: '["chore","pr"]'
type_labels: '{"feat": "feature", "fix": "fix", "bug": "fix", "doc": "documentation", "ci": "ci", "chore": "chore", "breaking": "breaking", "BREAKING CHANGE": "breaking"}'

- name: Checkout branch
uses: actions/checkout@v3
with:
ref: refs/heads/${{ github.head_ref }}

- name: Conventional Changelog Update
continue-on-error: true
uses: TriPSs/conventional-changelog-action@v3
id: changelog
with:
github-token: ${{ github.token }}
output-file: 'CHANGELOG.md'
skip-version-file: 'true'
skip-commit: 'true'
git-push: 'false'
git-branch: refs/heads/${{ github.head_ref }}

- name: Checkout pr
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Comment PR
continue-on-error: true
uses: thollander/actions-comment-pull-request@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
message: |
# Current changelog
${{ steps.changelog.outputs.clean_changelog }}
comment_includes: '# Current changelog'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pr-greeting:
name: PR Greeting
env:
Expand All @@ -32,6 +89,7 @@ jobs:
Once merged, code will be promoted and handed off to following workflow run.
[Main Merge Workflow](https://github.com/${{ github.repository }}/actions/workflows/merge-main.yml)
builds:
name: Builds
runs-on: ubuntu-22.04
Expand All @@ -49,6 +107,7 @@ jobs:
triggers: ('frontend/')
steps:
- uses: actions/checkout@v3

- uses: bcgov-nr/action-builder-ghcr@v0.0.2
with:
package: ${{ matrix.package }}
Expand Down Expand Up @@ -101,13 +160,14 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Deploys
uses: bcgov-nr/action-deployer-openshift@v0.1.0
uses: bcgov-nr/action-deployer-openshift@v0.2.0-rc1
with:
file: backend/openshift.deploy.yml
oc_namespace: ${{ secrets.OC_NAMESPACE }}
oc_server: ${{ secrets.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: true
health_url: health
parameters:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/backend:${{ github.event.number }}
Expand All @@ -118,11 +178,6 @@ jobs:
-p CHES_CLIENT_SECRET=${{ secrets.CHES_CLIENT_SECRET }}
-p CHES_TOKEN_URL='https://dev.loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token'
-p CHES_API_URL='https://ches-dev.api.gov.bc.ca/api/v1'
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USER }}
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }}
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }}
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }}
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }}

deploy-frontend:
name: Deploy Frontend
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ jobs:
- uses: bcgov-nr/action-test-and-analyse-java@v0.1.0
with:
commands: |
./mvnw test
mvn -B verify -P all-tests checkstyle:checkstyle -Dcheckstyle.skip=false --file pom.xml
dir: backend
java-cache: maven
java-distribution: temurin
java-version: "17"
sonar_args: >
-Dsonar.exclusions=**/coverage/**
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=forest-client-backend
sonar_project_token: ${{ secrets.SONAR_TOKEN_BACKEND }}
Expand Down
Loading

0 comments on commit 080c514

Please sign in to comment.