Skip to content

Commit

Permalink
feat(be:FSADT1-660): adding province list api (#323)
Browse files Browse the repository at this point in the history
* feat(be:FSADT1-660): adding province list api

* chore: aligning similar code

* chore: fixing code smell

* doc: updating gitignore

* doc: updating gitignore

* fix: removing code duplication

* ci: fixing deploy path for legacy

* chore(deps): bump aquasecurity/trivy-action from 0.9.0 to 0.9.1
Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.9.0 to 0.9.1.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](aquasecurity/trivy-action@0.9.0...0.9.1)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
  • Loading branch information
Paulo Gomes da Cruz Junior authored Feb 10, 2023
1 parent aa7f90f commit 0bd5c8a
Show file tree
Hide file tree
Showing 19 changed files with 688 additions and 95 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ jobs:
-p CHES_API_URL='https://ches.api.gov.bc.ca/api/v1'

prod-legacy:
name: PROD Backend
name: PROD Legacy
needs:
- prod-init
env:
Expand Down Expand Up @@ -313,7 +313,7 @@ jobs:
- name: Deploys
uses: bcgov-nr/action-deployer-openshift@v1.0.1
with:
file: backend/openshift.deploy.yml
file: legacy/openshift.deploy.yml
oc_namespace: ${{ secrets.OC_NAMESPACE }}
oc_server: ${{ secrets.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
uses: actions/checkout@v3

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@0.9.0
uses: aquasecurity/trivy-action@0.9.1
with:
scan-type: "fs"
format: "sarif"
Expand Down
196 changes: 196 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,199 @@ backend/config/application-dev-*.yml
.checkstyle
backend/.checkstyle
backend/src/main/resources/application-dev-mariamar.properties


# Created by https://www.toptal.com/developers/gitignore/api/vue,vuejs,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=vue,vuejs,visualstudiocode

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

frontend/.vscode/*
!frontend/.vscode/settings.json
!frontend/.vscode/tasks.json
!frontend/.vscode/launch.json
!frontend/.vscode/extensions.json
!frontend/.vscode/*.code-snippets


# Local History for Visual Studio Code
.history/
frontend/.history/

# Built Visual Studio Code Extensions
*.vsix
frontend/*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
frontend/.history
.ionide
frontend/.ionide

node_modules/
frontend/node_modules/
dist/
frontend/dist/
npm-debug.log
frontend/npm-debug.log
yarn-error.log
frontend/yarn-error.log

# End of https://www.toptal.com/developers/gitignore/api/vue,vuejs,visualstudiocode

# Created by https://www.toptal.com/developers/gitignore/api/vue,vuejs,node
# Edit at https://www.toptal.com/developers/gitignore?templates=vue,vuejs,node

### Node ###
# Logs
frontend/logs
frontend/*.log
frontend/npm-debug.log*
frontend/yarn-debug.log*
frontend/yarn-error.log*
frontend/lerna-debug.log*
frontend/.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
frontend/report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
frontend/pids
frontend/*.pid
frontend/*.seed
frontend/*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
frontend/lib-cov

# Coverage directory used by tools like istanbul
frontend/coverage
frontend/*.lcov

# nyc test coverage
frontend/.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
frontend/.grunt

# Bower dependency directory (https://bower.io/)
frontend/bower_components

# node-waf configuration
frontend/.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
frontend/build/Release

# Dependency directories
frontend/node_modules/
frontend/jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
frontend/web_modules/

# TypeScript cache
frontend/*.tsbuildinfo

# Optional npm cache directory
frontend/.npm

# Optional eslint cache
frontend/.eslintcache

# Optional stylelint cache
frontend/.stylelintcache

# Microbundle cache
frontend/.rpt2_cache/
frontend/.rts2_cache_cjs/
frontend/.rts2_cache_es/
frontend/.rts2_cache_umd/

# Optional REPL history
frontend/.node_repl_history

# Output of 'npm pack'
frontend/*.tgz

# Yarn Integrity file
frontend/.yarn-integrity

# dotenv environment variable files
frontend/.env
frontend/.env.development.local
frontend/.env.test.local
frontend/.env.production.local
frontend/.env.local

# parcel-bundler cache (https://parceljs.org/)
frontend/.cache
frontend/.parcel-cache

# Next.js build output
frontend/.next
frontend/out

# Nuxt.js build / generate output
frontend/.nuxt
frontend/dist

# Gatsby files
frontend/.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
frontend/.vuepress/dist

# vuepress v2.x temp and cache directory
frontend/.temp

# Docusaurus cache and generated files
frontend/.docusaurus

# Serverless directories
frontend/.serverless/

# FuseBox cache
frontend/.fusebox/

# DynamoDB Local files
frontend/.dynamodb/

# TernJS port file
frontend/.tern-port

# Stores VSCode versions used for testing VSCode extensions
frontend/.vscode-test

# yarn v2
frontend/.yarn/cache
frontend/.yarn/unplugged
frontend/.yarn/build-state.yml
frontend/.yarn/install-state.gz
frontend/.pnp.*

### Node Patch ###
# Serverless Webpack directories
frontend/.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
frontend/.svelte-kit


frontend/dist/
frontend/npm-debug.log
frontend/yarn-error.log

# End of https://www.toptal.com/developers/gitignore/api/vue,vuejs,node
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

@Configuration
@Slf4j
/**
* <p><b>Global Service Configuration</b></p>
* This class is responsible for configuring basic beans to be used by the services.
* It creates and holds the external API webclients and the cors filter.
*/
public class GlobalServiceConfiguration {

@Bean
Expand All @@ -35,6 +40,13 @@ public WebClient openMapsApi(ForestClientConfiguration configuration) {
}

@Bean
/**
* <p><b>CORS Filter</b></p>
* Creates the CORS (Cross-Origin Resource Sharing) filter to enable external requests from
* the frontend application.
* It consumes from the configuration file, AKA <b>application.yml</b> file and add as a default
* filter when receiving a CORS request.
*/
public WebFilter corsFilter(ForestClientConfiguration configuration) {
return (ServerWebExchange ctx, WebFilterChain chain) -> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import ca.bc.gov.app.routes.BaseRouter;
import io.swagger.v3.oas.models.examples.Example;
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.parameters.HeaderParameter;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.tags.Tag;
import java.util.List;
Expand All @@ -21,6 +20,11 @@

@Configuration
@Slf4j
/**
* <p><b>Base Router Class</b></p>
* This configuration class is responsible for configuring the routing for webflux.
* It also configures the OpenAPI part of the code with some default data.
*/
public class RouteConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package ca.bc.gov.app.dto.client;

public record ClientNameCodeDto(String code, String name) {
}

This file was deleted.

38 changes: 38 additions & 0 deletions backend/src/main/java/ca/bc/gov/app/entity/client/BaseEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package ca.bc.gov.app.entity.client;

import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.relational.core.mapping.Column;

@Data
@NoArgsConstructor
@AllArgsConstructor
public abstract class BaseEntity {

@NotNull
protected String description;

@NotNull
@Column("effective_date")
protected LocalDate effectiveAt;

@NotNull
@Column("expiry_date")
protected LocalDate expiredAt;

@Column("create_timestamp")
protected LocalDateTime createdAt;

@Column("update_timestamp")
protected LocalDateTime updatedAt;

@Column("create_user")
private String createdBy;

@Column("update_user")
protected String updatedBy;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package ca.bc.gov.app.entity.client;

import ca.bc.gov.app.ApplicationConstant;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.With;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Column;
Expand All @@ -16,38 +15,16 @@

@Table(name = "client_type_code", schema = ApplicationConstant.POSTGRES_ATTRIBUTE_SCHEMA)
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@With
public class ClientTypeCodeEntity {
public class ClientTypeCodeEntity extends BaseEntity {

@Id
@Column("client_type_code")
private String code;

@NotNull
@Column("description")
private String description;

@NotNull
@Column("effective_date")
private LocalDate effectiveAt;

@NotNull
@Column("expiry_date")
private LocalDate expiredAt;

@Column("create_timestamp")
private LocalDateTime createdAt;

@Column("update_timestamp")
private LocalDateTime updatedAt;

@Column("create_user")
private String createdBy;

@Column("update_user")
private String updatedBy;

}
Loading

0 comments on commit 0bd5c8a

Please sign in to comment.