Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
20f9ec0
BENCH-57 WIP
AudriusPutys Oct 21, 2022
92c0ad0
BENCH-57 Added boilerplate tests for the order controller.
martintaylor1635 Oct 24, 2022
60ac966
Bench 42 checkstyle3 (#8)
MohammadIqbalAD Oct 25, 2022
8c710e9
Merge branch 'main' of https://github.com/AnswerConsulting/AnswerKing…
Oct 26, 2022
8c907d9
Merge branch 'main' of https://github.com/AnswerConsulting/AnswerKing…
Oct 26, 2022
64e2f77
BENCH-79 item controller and service layer tests added.
AudriusPutys Oct 26, 2022
587c277
BENCH-80 Added 100% unit test coverage for order service and refactor…
martintaylor1635 Oct 26, 2022
b503819
BENCH-57 WIP
AudriusPutys Oct 21, 2022
9aeaad4
BENCH-57 Added boilerplate tests for the order controller.
martintaylor1635 Oct 24, 2022
fcb66b2
BENCH-80 Added 100% unit test coverage for order service and refactor…
martintaylor1635 Oct 26, 2022
4b76273
Merge remote-tracking branch 'origin/BENCH-80' into BENCH-80
martintaylor1635 Oct 26, 2022
71fb934
BENCH-80 Refactored OrderServiceTest.java as per comments.
martintaylor1635 Oct 26, 2022
5c34fa5
BENCH-80 Refactored OrderServiceTest.java as per comments.
martintaylor1635 Oct 26, 2022
3ab9266
Delete CategoryControllerTest.java
martintaylor1635 Oct 26, 2022
5ebf96d
BENCH-79 code updated as per comments raised.
AudriusPutys Oct 26, 2022
1dfe567
Delete OrderControllerTest.java
martintaylor1635 Oct 26, 2022
c5c9936
Merge pull request #10 from AnswerConsulting/BENCH-80
martintaylor1635 Oct 26, 2022
b675dee
reverting the deleted changes (#11)
Oct 26, 2022
5951a25
checkstyle bug fix (#13)
Oct 26, 2022
081d8d9
BENCH-83 Changed application.yaml to disable open-in-view.
martintaylor1635 Oct 26, 2022
640576d
Merge pull request #9 from AnswerConsulting/BENCH-79
AudriusPutys Oct 27, 2022
3392e54
BENCH-46 Lombok Implemented and controller test updated to bypass sec…
AudriusPutys Oct 27, 2022
91fc02d
Bench 42 checkstyle4 (#16)
MohammadIqbalAD Oct 27, 2022
e92abb4
Merge pull request #14 from AnswerConsulting/BENCH-83
martintaylor1635 Oct 27, 2022
37fbad2
BENCH-63 Added MapStruct dependency into the POM
martintaylor1635 Oct 27, 2022
a32f258
BENCH-63 Added maven compiler plugin to add MapStruct support to POM
martintaylor1635 Oct 27, 2022
d3d6552
BENCH-63 Added CategoryMapper interface.
martintaylor1635 Oct 27, 2022
8d1425d
BENCH-63 Added ItemMapper interface.
martintaylor1635 Oct 27, 2022
131fbf3
BENCH-63 Added OrderMapper interface
martintaylor1635 Oct 27, 2022
5022e25
BENCH-63 Renamed AddOrderRequest.java to OrderRequest.java
martintaylor1635 Oct 27, 2022
e3cae02
BENCH-63 Integration of MapStruct into service layer.
martintaylor1635 Oct 27, 2022
e129cc6
BENCH-63 Added update order endpoint, fixed issue relating to get all…
martintaylor1635 Oct 27, 2022
ca9a5bf
BENCH-63 Fixed bug relating to get all orders by adding the fetch typ…
martintaylor1635 Oct 27, 2022
32a8ac8
BENCH-63 Added setters as these are required by the MapStruct library…
martintaylor1635 Oct 27, 2022
1141636
BENCH-63 Added unit test.
martintaylor1635 Oct 27, 2022
9e97387
BENCH-63 Removed star import to comply with check style
martintaylor1635 Oct 27, 2022
d6312ef
BENCH-63 Fixed validation bug, reverted back to parameter-level valid…
martintaylor1635 Oct 28, 2022
d18c520
BENCH-63 Improved readability
martintaylor1635 Oct 28, 2022
e32d0fc
Merge pull request #18 from AnswerConsulting/BENCH-63
martintaylor1635 Oct 28, 2022
d0715f9
BENCH-36 (WIP) - Refactoring in progress
martintaylor1635 Oct 20, 2022
b82060a
BENCH-81 added unit tests for Category
AndyFlintAnswerDigital Oct 26, 2022
a863480
BENCH-81 adding verification to Category service tests
AndyFlintAnswerDigital Oct 26, 2022
39fbdc0
BENCH-81 checkstyle fixes
AndyFlintAnswerDigital Oct 27, 2022
88c14d5
BENCH-81 fixing category tests
AndyFlintAnswerDigital Oct 27, 2022
55bea44
BENCH-81 updated category tests
AndyFlintAnswerDigital Oct 28, 2022
5b9acfe
BENCH-63 Improved readability
martintaylor1635 Oct 28, 2022
f63a6ef
BENCH-63 Added unit test to test update order.
martintaylor1635 Oct 28, 2022
c1d2f17
BENCH-63 Updated unit test.
martintaylor1635 Oct 28, 2022
d52efb2
BENCH-46 @Builder added to help with tests, also equal and hashcodes …
AudriusPutys Oct 28, 2022
2257d69
Merge pull request #19 from AnswerConsulting/BENCH-63
martintaylor1635 Oct 28, 2022
5f233c1
BENCH-85: adding logging to different classes (#17)
Oct 28, 2022
d384438
Merge branch 'main' into BENCH-81
AndyFlintAnswerDigital Oct 28, 2022
20a569f
Merge pull request #12 from AnswerConsulting/BENCH-81
AndyFlintAnswerDigital Oct 28, 2022
c5f4e62
Merge branch 'main' into BENCH-46
AudriusPutys Oct 28, 2022
e3c6588
BENCH-87 Updated Category and Item controller tests to reflect endpoi…
martintaylor1635 Oct 28, 2022
c7275bf
Renamed request mappings to plural
MohammadIqbalAD Oct 28, 2022
99118d9
BENCH-46 Conflicts resolved
AudriusPutys Oct 28, 2022
f6eac4f
BENCH-87 Updated Category and Item controller tests to reflect endpoi…
martintaylor1635 Oct 28, 2022
5e4acbd
Updated README to link to Amazon Correto 17
MohammadIqbalAD Oct 28, 2022
ce91d5c
Merge branch 'BENCH-87' of https://github.com/AnswerConsulting/Answer…
MohammadIqbalAD Oct 28, 2022
a5cfdaf
Bench 85 cleanup (#20)
Oct 28, 2022
76e696e
BENCH-87 Updated Category and Item controller tests to reflect endpoi…
martintaylor1635 Oct 28, 2022
4fa4160
Renamed request mappings to plural
MohammadIqbalAD Oct 28, 2022
383c89d
Updated README to link to Amazon Correto 17
MohammadIqbalAD Oct 28, 2022
d8fd01e
BENCH-87 Updated Category and Item controller tests to reflect endpoi…
martintaylor1635 Oct 28, 2022
42ddc64
Merge remote-tracking branch 'origin/BENCH-87' into BENCH-87
martintaylor1635 Oct 28, 2022
39e8796
BENCH-86 order total price added
AudriusPutys Oct 28, 2022
bb036bc
Merge branch 'main' into BENCH-46
AudriusPutys Oct 28, 2022
287ede6
BENCH-46 add and remove item functions added to category. also items …
AudriusPutys Oct 28, 2022
0e2eedd
BENCH-46 category equals updated to check name not id.
AudriusPutys Oct 28, 2022
14a8012
Merge pull request #21 from AnswerConsulting/BENCH-87
martintaylor1635 Oct 28, 2022
27d3685
Merge pull request #15 from AnswerConsulting/BENCH-46
AudriusPutys Oct 28, 2022
982364f
BENCH-86 Order total price included
AudriusPutys Oct 28, 2022
1b855aa
BENCH-86 OrderItem total price updated
AudriusPutys Oct 28, 2022
80387e0
BENCH-86 imports optimized
AudriusPutys Oct 28, 2022
549bb5b
Merge pull request #22 from AnswerConsulting/BENCH-86
AudriusPutys Oct 28, 2022
3f72c7b
BENCH-81: fixing rest endpoint issue (#23)
Oct 31, 2022
c026905
fixing order adding issue (#24)
Nov 2, 2022
98ea629
BENCH-NONE Added start-answerking.sh script for docker
AndyFlintAnswerDigital Nov 2, 2022
b117209
fixing persistance loading issues (#25)
Nov 3, 2022
afd08d3
adding jacoco (#26)
Nov 7, 2022
7c4b6bc
BENCH-69: build workflow (#27)
Nov 7, 2022
3056e9f
BENCH-58 Refactored package names, also changed package names from pl…
martintaylor1635 Nov 7, 2022
4de27e0
BENCH-58 Fixed PR comment, renamed AnswerkingApplication to AnswerKin…
martintaylor1635 Nov 8, 2022
f2cec8f
Merge pull request #28 from AnswerConsulting/BENCH-58
martintaylor1635 Nov 8, 2022
dc8f2a7
BENCH-58-FIX Temporarily removed redundant test agreed with Oleksii, …
martintaylor1635 Nov 9, 2022
63154a7
BENCH-58-FIX Removed OrderControllerIT.java as it was empty and serve…
martintaylor1635 Nov 9, 2022
0e5d190
BENCH-58-FIX Temporarily removed redundant test agreed with Oleksii, …
martintaylor1635 Nov 9, 2022
5a381a1
BENCH-58-FIX Removed OrderControllerIT.java as it was empty and serve…
martintaylor1635 Nov 9, 2022
2c34a3e
Merge remote-tracking branch 'origin/BENCH-58-FIX' into BENCH-58-FIX
martintaylor1635 Nov 9, 2022
907f83e
Merge pull request #30 from AnswerConsulting/BENCH-58-FIX
martintaylor1635 Nov 9, 2022
9782182
adding docker build pipeline (#31)
Nov 9, 2022
adb3360
BENCH-108: Bench 108 push images (#32)
Nov 9, 2022
ef4beaf
docker image workflow (#33)
Nov 9, 2022
59988e0
adjusting repo name (#34)
Nov 9, 2022
612c9f1
BENCH-108: Bench 108 push images4 (#35)
Nov 9, 2022
80b3957
permission change (#37)
Nov 9, 2022
bc2ad2d
BENCH-108: Bench 108 push images6 (#38)
Nov 9, 2022
bac46f8
change log in (#39)
Nov 9, 2022
926217b
BENCH-108: Bench 108 push images8 (#40)
Nov 9, 2022
cfe4a50
BENCH-108: Bench 108 push images9 (#41)
Nov 9, 2022
487354d
adding repo name (#42)
Nov 9, 2022
d33b0e4
push changes (#43)
Nov 10, 2022
8095a00
docker push config (#45)
Nov 10, 2022
d51c0d6
BENCH-125 refactored error responses to RFC-7807 format
AndyFlintAnswerDigital Nov 8, 2022
dadfc23
BENCH-125 refactored handling for MethodArgumentNotValidException
AndyFlintAnswerDigital Nov 8, 2022
74e4d8a
BENCH-125 adding errors & traceId fields to RFC-7807 error responses
AndyFlintAnswerDigital Nov 10, 2022
8de92f2
adjusting github repo name (#46)
Nov 10, 2022
c468c8c
repo name update (#47)
Nov 10, 2022
eefd24b
tag image (#48)
Nov 10, 2022
f8b7606
BENCH-108-REFACTORING Refactored build_docker_package.yml as per requ…
martintaylor1635 Nov 10, 2022
9e83203
BENCH-96 Static code analysis added
AudriusPutys Nov 10, 2022
cd1b608
BENCH-96 Static code analysis property added
AudriusPutys Nov 10, 2022
59400ae
BENCH-96 java version specified
AudriusPutys Nov 10, 2022
bddcc45
Merge pull request #49 from AnswerConsulting/BENCH-96
AudriusPutys Nov 11, 2022
58088a1
BENCH-161 Refactored codebase
martintaylor1635 Nov 11, 2022
8c0d588
BENCH-161 Fixed README.md
martintaylor1635 Nov 11, 2022
294cc5a
BENCH-161 Updated CategoryServiceTest
martintaylor1635 Nov 11, 2022
54f662a
BENCH-161 Changes reflecting Andrews observations
martintaylor1635 Nov 11, 2022
a58b2d5
Merge pull request #55 from AnswerConsulting/BENCH-161
martintaylor1635 Nov 14, 2022
00d417a
BENCH-159: change to be compliant with the latest openapi version (#54)
Nov 14, 2022
09253b3
adding api tags (#56)
Nov 14, 2022
0c5f7df
BENCH-153 Updated SQL files to reflect new retired fields added in mo…
martintaylor1635 Nov 11, 2022
7fb67a5
BENCH-153 Created RetirementException to be thrown when dealing with …
martintaylor1635 Nov 11, 2022
6b71c86
BENCH-153 Added retired field to category
martintaylor1635 Nov 11, 2022
f6f4ee4
BENCH-153 Updated CategoryController to reflect changes
martintaylor1635 Nov 11, 2022
486d6e4
BENCH-153 Added logic to CategoryService and ItemService
martintaylor1635 Nov 11, 2022
0359f87
BENCH-153 Updated ItemController to reflect changes
martintaylor1635 Nov 11, 2022
85d4742
BENCH-153 Updated unit tests in accordance with the new features
martintaylor1635 Nov 11, 2022
dbea22e
BENCH-161 Test
martintaylor1635 Nov 11, 2022
d4d18da
BENCH-161 Test
martintaylor1635 Nov 11, 2022
83e6d42
BENCH-153 Removed available field from Item, and reflected it thoughout
martintaylor1635 Nov 11, 2022
a8e0f05
BENCH-153 Addressed PR comments from Andrew
martintaylor1635 Nov 11, 2022
f48da53
BENCH-153 Addressed PR comments from Andrew
martintaylor1635 Nov 12, 2022
d43ee30
BENCH-153 Updated RetirementException to reflect 404 not found rather…
martintaylor1635 Nov 14, 2022
469dff5
BENCH-153 Refactored RetirementException returning 410 GONE status
martintaylor1635 Nov 14, 2022
18109e1
BENCH-153 Refactored Product model, added retired field to constructor
martintaylor1635 Nov 14, 2022
7aacd05
BENCH-153 Explicitly configured the ProductMapper to default the reti…
martintaylor1635 Nov 14, 2022
b2c6839
BENCH-153 Addressed Andrews PR Comment: relocated constructor in Cate…
martintaylor1635 Nov 14, 2022
fb1c70b
BENCH-153 Addressed Andrews PR Comment: renamed local variable name w…
martintaylor1635 Nov 14, 2022
36c4496
BENCH-153 Addressed Andrews PR Comment: I would also suggest searchin…
martintaylor1635 Nov 14, 2022
38f2c01
BENCH-153 Addressed Andrews PR Comment: Was this a mistake with the r…
martintaylor1635 Nov 14, 2022
fc7ee32
Merge pull request #52 from AnswerConsulting/BENCH-153
martintaylor1635 Nov 14, 2022
d2885d7
BENCH-56 v2 academy package removed.
AudriusPutys Nov 14, 2022
cb798d9
Merge pull request #57 from AnswerConsulting/BENCH-56_v2
AudriusPutys Nov 14, 2022
cf507dd
BENCH-108-REFACTORING Refactored build_docker_package.yml as per requ…
martintaylor1635 Nov 10, 2022
48a9abd
Merge branch 'BENCH-108-REFACTORING' of https://github.com/AnswerCons…
martintaylor1635 Nov 15, 2022
380dafe
BENCH-108-REFACTORING Added the develop branc
martintaylor1635 Nov 15, 2022
53ef6e4
BENCH-108-REFACTORING Added the master branch
martintaylor1635 Nov 15, 2022
e901633
BENCH-108-REFACTORING Added develop branch to the build_integration_a…
martintaylor1635 Nov 15, 2022
6a3a2e8
Dependabot Yaml Set Up
MohammadIqbalAD Nov 14, 2022
bae7ea2
Automatically approve dependabot pull requests
MohammadIqbalAD Nov 15, 2022
9b90742
Updated package-ecosystem to Maven
MohammadIqbalAD Nov 15, 2022
8eaa127
Bump springdoc-openapi-maven-plugin from 0.2 to 1.4
dependabot[bot] Nov 15, 2022
8bbe77a
Added github-actions ecosystem to dependabot.yml
MohammadIqbalAD Nov 15, 2022
716ed10
Bump dependabot/fetch-metadata from 1.1.1 to 1.3.5
dependabot[bot] Nov 15, 2022
b9b9fd3
Bump actions/cache from 1 to 3
dependabot[bot] Nov 15, 2022
746b74a
BENCH-108-REFACTORING Refactored build_docker_package.yml as per requ…
martintaylor1635 Nov 10, 2022
ba57c34
BENCH-108-REFACTORING Added the develop branc
martintaylor1635 Nov 15, 2022
2e89b6b
BENCH-108-REFACTORING Added the master branch
martintaylor1635 Nov 15, 2022
2a6b104
BENCH-108-REFACTORING Added develop branch to the build_integration_a…
martintaylor1635 Nov 15, 2022
398106f
Merge branch 'BENCH-108-REFACTORING' of https://github.com/AnswerCons…
martintaylor1635 Nov 15, 2022
00a9dc8
Bump maven-wrapper-plugin from 3.1.0 to 3.1.1 (#60)
dependabot[bot] Nov 15, 2022
bf26a2a
BENCH-108-REFACTORING Refactored build_docker_package.yml as per requ…
martintaylor1635 Nov 10, 2022
978dd62
BENCH-108-REFACTORING Added the develop branc
martintaylor1635 Nov 15, 2022
5884710
BENCH-108-REFACTORING Added the master branch
martintaylor1635 Nov 15, 2022
d69bc7c
BENCH-108-REFACTORING Added develop branch to the build_integration_a…
martintaylor1635 Nov 15, 2022
bec1396
Merge branch 'BENCH-108-REFACTORING' of https://github.com/AnswerCons…
martintaylor1635 Nov 15, 2022
a57a1e8
Merge pull request #62 from AnswerConsulting/BENCH-108-REFACTORING
martintaylor1635 Nov 15, 2022
04b259a
Added github.actor check to dependabot workflow
MohammadIqbalAD Nov 15, 2022
4df2266
sonar key update to project name.
AudriusPutys Nov 15, 2022
0005ca6
Merge pull request #67 from AnswerConsulting/sonar_update
AudriusPutys Nov 15, 2022
8760ffc
github action checkout updated to v3
AudriusPutys Nov 15, 2022
1b211cd
Merge pull request #68 from AnswerConsulting/github_action_v3
AudriusPutys Nov 15, 2022
54256cf
Merge pull request #61 from AnswerConsulting/dependabot/maven/main/or…
AudriusPutys Nov 15, 2022
c4b4523
Merge pull request #65 from AnswerConsulting/dependabot/github_action…
AudriusPutys Nov 15, 2022
7ca3aa9
Merge pull request #63 from AnswerConsulting/dependabot/github_action…
AudriusPutys Nov 15, 2022
d048e54
Updated dependabot.yml pull request limit + prefix
MohammadIqbalAD Nov 15, 2022
9c34708
BENCH-174 Added get category by ID endpoint
martintaylor1635 Nov 15, 2022
32e1f97
BENCH-172 Created NameUnavailableException and ProductAlreadyPresentE…
martintaylor1635 Nov 15, 2022
5ba1a0c
BENCH-172 Updated services to reflect changes
martintaylor1635 Nov 15, 2022
1358269
BENCH-172 Updated tests to reflect changes
martintaylor1635 Nov 15, 2022
86b5254
BENCH-148 Refactored SecurityConfig and added dependency for Snake YAML
martintaylor1635 Nov 15, 2022
1576757
BENCH-148 Fixed checkstyle complaints
martintaylor1635 Nov 15, 2022
902d488
BENCH-148 Added scope to POM dependency
martintaylor1635 Nov 15, 2022
af70d4c
Merge pull request #72 from AnswerConsulting/BENCH-148
martintaylor1635 Nov 16, 2022
6b68f91
Merge pull request #71 from AnswerConsulting/BENCH-172
martintaylor1635 Nov 16, 2022
5b14b8e
Merge pull request #69 from AnswerConsulting/BENCH-174
martintaylor1635 Nov 16, 2022
bde7af1
Replaced primitive longs with Wrapper Class Longs
MohammadIqbalAD Nov 16, 2022
9c64cfb
BENCH-179 Updated the MySQL dependency within the POM
martintaylor1635 Nov 16, 2022
b11a118
Merge pull request #74 from AnswerConsulting/BENCH-179
martintaylor1635 Nov 16, 2022
6db74f4
BENCH-180 Refactored Spring Security Config and resolved warnings
martintaylor1635 Nov 16, 2022
099ccb9
BENCH-180 Addressed checkstyle warnings
martintaylor1635 Nov 16, 2022
cafb426
Merge pull request #75 from AnswerConsulting/BENCH-180
martintaylor1635 Nov 16, 2022
afaf273
BENCH-184 getting order 500 error fixed on all endpoints.
AudriusPutys Nov 16, 2022
0e92f92
Merge pull request #76 from AnswerConsulting/BENCH-184
AudriusPutys Nov 16, 2022
0d292bb
BENCH-162 Updated status codes for create product and category
martintaylor1635 Nov 16, 2022
c333fe8
BENCH-162 Reflected changes within tests
martintaylor1635 Nov 16, 2022
f16d0c9
Merge pull request #78 from AnswerConsulting/BENCH-162
martintaylor1635 Nov 16, 2022
054fae0
BENCH-185 Refactored Dockerfile, removed maintainer reference and swi…
martintaylor1635 Nov 16, 2022
9432594
BENCH-185 Created a batch script from Windows users to initialise Docker
martintaylor1635 Nov 16, 2022
41bc520
BENCH-185 Updated bash script to initialise Docker
martintaylor1635 Nov 16, 2022
46c776e
BENCH-185 Updated bash and batch script
martintaylor1635 Nov 16, 2022
fb35bd3
BENCH-185 Updated bash script, changed operations order
martintaylor1635 Nov 16, 2022
1e295cf
BENCH-185 Overridden the banner for startup
martintaylor1635 Nov 16, 2022
3c7a878
Merge pull request #79 from AnswerConsulting/BENCH-185
martintaylor1635 Nov 16, 2022
566b741
adding more swagger docs (#80)
Nov 17, 2022
8aa98a1
BENCH-184 made removing item from basket transactional
AndyFlintAnswerDigital Nov 18, 2022
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
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
COMPOSE_PROJECT_NAME=answer-king-rest-api
MYSQLDB_ROOT_PASSWORD=
MYSQLDB_DATABASE=answer_king
MYSQLDB_USER=test_user
MYSQLDB_PASSWORD=
34 changes: 34 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
target-branch: "main"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Europe/London"
open-pull-requests-limit: 10
labels:
- "Dependabot"
commit-message:
prefix: "(fix) update"

- package-ecosystem: "github-actions"
directory: "/"
target-branch: "main"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Europe/London"
open-pull-requests-limit: 10
labels:
- "Dependabot"
commit-message:
prefix: "(fix) update"
27 changes: 27 additions & 0 deletions .github/workflows/approve_dependabot_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

name: Approve dependabot pr
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.3.5
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve pr
run: gh pr review --approve "$PR_URL"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
64 changes: 64 additions & 0 deletions .github/workflows/build_docker_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Docker Image Pipeline
on:
workflow_run:
workflows: ["Integration and code analysis"]
branches:
- main
- master
- develop
types:
- completed

env:
REGISTRY: ghcr.io/answerconsulting/answerking-java
IMAGE_NAME: answer-king-rest-api_app #${{ github.repository }}

jobs:
on-success:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
cache: 'maven'

- name: Build with Maven
run: mvn install -DskipTests

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build using docker-compose template
run: docker-compose build

- name: List Docker images
run: docker images

# - name: Push images
# run: docker-compose push #--ignore-push-failures

- name: Tag docker image
run: docker tag answer-king-rest-api_app ghcr.io/answerconsulting/answerking-java/answer-king-rest-api_app:latest

- name: Push images
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
80 changes: 80 additions & 0 deletions .github/workflows/build_integration_and_code_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Integration and code analysis
on:
workflow_dispatch: null
push:
branches:
- main
- master
- develop
pull_request:
types: [opened, synchronize, reopened]
schedule:
- cron: '* 5 * * *'
jobs:
Sonar-Cloud:
name: Static Code Analysis - Sonar Cloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: '17'
distribution: 'corretto'
cache: 'maven'
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=answer-king-rest-api

Build-Test:
name: Integration Test
runs-on: ubuntu-latest
permissions:
checks: write

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
cache: 'maven'

- name: Build with Maven
run: mvn install -DskipTests

- name: Run tests with Maven
run: mvn test

- name: Run code coverage report
run: mvn jacoco:report

- name: Run code coverage check
run: mvn clean verify

- name: Publish test coverage results
id: jacoco_reporter
uses: PavanMudigonda/jacoco-reporter@v4.6
with:
coverage_results_path: 'target/site/jacoco/jacoco.xml'
coverage_report_title: 'Test coverage results'
coverage_report_name: 'Test coverage results'
github_token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM openjdk:17-jdk-alpine
MAINTAINER benjamin.hession@answerdigital.com
FROM amazoncorretto:17
COPY target/answer-king-rest-api-0.0.1.jar answerking-0.0.1.jar
ADD ./src/main/resources/application.yaml application.yaml
ENTRYPOINT ["java","-D--spring.config.location=classpath:file:/application-yaml","-jar","/answerking-0.0.1.jar"]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Answer King REST API

The Answer King REST API is the backend for a fast food business. It allows items and categories to be created and
orders to be placed. An item can be included in multiple categories.
The Answer King REST API is the backend for a fast food business. It allows products and categories to be created and
orders to be placed. A product can be included in multiple categories.

## Docker

Expand All @@ -26,7 +26,7 @@ and execute the following commands:

[Docker Compose](https://docs.docker.com/compose/install/)

[JDK 17](https://adoptium.net/)
[AMAZON CORRETTO 17](https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html)

## Maven

Expand All @@ -52,7 +52,7 @@ If Maven isn't installed on your system, the Maven Wrapper can be used by using

### Prerequisites

[JDK 17](https://adoptium.net/)
[AMAZON CORRETTO 17](https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html)

## MySQL

Expand Down
38 changes: 38 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,43 @@
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<module name="TreeWalker">
<module name="AvoidStarImport"/>
<module name="ConstantName"/>
<module name="EmptyBlock"/>
<module name="FinalClass"/>
<module name="MutableException"/>
<module name="FinalLocalVariable"/>
<module name="NoFinalizer"/>
<module name="FinalParameters" />
<module name="IllegalImport"/>
<module name="UnusedImports"/>
<module name="ConstantName"/>
<module name="EmptyBlock"/>
<module name="EmptyCatchBlock"/>
<module name="EmptyLineSeparator">
<property name="allowMultipleEmptyLines" value="false"/>
<property name="allowNoEmptyLineBetweenFields" value="false"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
</module>
<module name="EmptyStatement"/>
<module name="Indentation"/>
<module name="TodoComment"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="MethodName"/>
<module name="ConstantName"/>
<module name="LeftCurly"/>
</module>
<module name="FileLength">
<property name="max" value="1000"/>
</module>
<module name="LineLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="130"/>
<property name="ignorePattern"
value="^( *\* *([^ ]+|\{@code .*|&lt;a href=&quot;[^&quot;]+&quot;&gt;)|(package|import) .*)$"/>
</module>
<module name="NewlineAtEndOfFile"/>

</module>
6 changes: 5 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.8'
services:
mysqldb:
container_name: mysqldb
image: mysql:5.7
image: mysql:8.0.31
restart: unless-stopped
env_file: ./.env
environment:
Expand All @@ -18,14 +18,18 @@ services:

app:
container_name: rest-api
image: answer-king-rest-api_app
env_file: ./.env
depends_on:
- mysqldb
build: ./.
restart: unless-stopped
ports:
- "8080:8080"
- "5005:5005"
environment:
- "SPRING_PROFILES_ACTIVE=docker"
- "JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
volumes:
- .m2:/root/.m2
volumes:
Expand Down
29 changes: 14 additions & 15 deletions init_scripts/schema.sql
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
CREATE TABLE IF NOT EXISTS item (
CREATE TABLE IF NOT EXISTS product (
id BIGINT NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
description VARCHAR(255) NOT NULL,
available BIT(1) NOT NULL,
retired BIT(1) NOT NULL,
price DECIMAL(12,2) NOT NULL,

PRIMARY KEY (id)
);
);

CREATE TABLE IF NOT EXISTS category (
id BIGINT NOT NULL AUTO_INCREMENT,
name VARCHAR(255),
description VARCHAR(255) NOT NULL,
retired BIT(1) NOT NULL,

PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS item_category (
CREATE TABLE IF NOT EXISTS product_category (
id BIGINT NOT NULL AUTO_INCREMENT,
item_id INT NOT NULL,
category_id INT NOT NULL,
product_id BIGINT NOT NULL,
category_id BIGINT NOT NULL,

PRIMARY KEY (Id),
FOREIGN KEY (item_id) REFERENCES item(id),
PRIMARY KEY (id),
FOREIGN KEY (product_id) REFERENCES product(id),
FOREIGN KEY (category_id) REFERENCES category(id)
);

Expand All @@ -34,15 +35,13 @@ CREATE TABLE IF NOT EXISTS `order` (
PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS order_item (
CREATE TABLE IF NOT EXISTS order_product (
id BIGINT NOT NULL AUTO_INCREMENT,
order_id INT NOT NULL,
item_id INT NOT NULL,
order_id BIGINT NOT NULL,
product_id BIGINT NOT NULL,
quantity INT NOT NULL,
PRIMARY KEY (ID),

PRIMARY KEY (id),
FOREIGN KEY (order_id) REFERENCES `order`(id),
FOREIGN KEY (item_id) REFERENCES item(id)
FOREIGN KEY (product_id) REFERENCES product(id)
);


Loading