{"id":15801492,"url":"https://github.com/laurosilveira/appzara","last_synced_at":"2026-05-10T16:07:42.000Z","repository":{"id":192455589,"uuid":"686755002","full_name":"LauroSilveira/appzara","owner":"LauroSilveira","description":"A REST API with H2 database memory, unit test with Junit and Jacoco report","archived":false,"fork":false,"pushed_at":"2024-03-18T10:34:01.000Z","size":2287,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-06T01:22:51.175Z","etag":null,"topics":["h2-database","jacoco-report","junit5","rest-api","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LauroSilveira.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-03T20:42:17.000Z","updated_at":"2023-10-21T18:19:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"3653df60-69b5-4a88-963f-12686d5db4f9","html_url":"https://github.com/LauroSilveira/appzara","commit_stats":null,"previous_names":["laurosilveira/appzara"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LauroSilveira%2Fappzara","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LauroSilveira%2Fappzara/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LauroSilveira%2Fappzara/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LauroSilveira%2Fappzara/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LauroSilveira","download_url":"https://codeload.github.com/LauroSilveira/appzara/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246544719,"owners_count":20794555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["h2-database","jacoco-report","junit5","rest-api","spring-boot"],"created_at":"2024-10-05T01:22:56.730Z","updated_at":"2026-05-10T16:07:36.964Z","avatar_url":"https://github.com/LauroSilveira.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rest API APPZARA\n\n\u003cp\u003eThis is a microservice rest for ZARA recruitment.\u003c/p\u003e\n\n## About this project\n* [About](#about)\n* [Architecture](#architecture)\n* [Technologies](#technologies)\n* [How to run](#how-to-run)\n* [How to run tests](#how-to-run-tests)\n* [Contributors](#contributors)\n\n# About\n**Business rules**\n\u003cp\u003e Given a day and time, a database search is carried out to bring up the price with the tariff to be applied.\nIf more than one element is found, some rules will apply:\u003c/p\u003e\n\u003cul\u003e \n    \u003cli\u003eIf the result finds two rates that coincide, the one with the highest value will apply.\u003c/li\u003e \n\u003c/ul\u003e\n\n# Architecture\n![Architecture-hexagonal.png](data/Architecture-hexagonal.png)\n\n#### APPLICATION\nLayer that implements the UseCase and contains the business rule\n\n\n#### BOOTSTRAP\nThis module is responsible for instantiating the other modules of the application.\nAs the name suggests, it is the bootstrap.\n\n#### DOMAIN\nModule containing the application entities.\n\n#### INFRASTRUCTURE\nInfrastructure layer that connects to database and other services.\n\n# Technologies\n- Java 21\n- Spring boot 3.2.3\n- Spring Data\n- Database H2 Memory\n- Mapstruct\n- Junit\n- Mockito\n- Jacoco Reporter\n\n\n# How to Run\n\u003cp\u003e\nClone the repository:\n\n```\ngit clone clone https://github.com/LauroSilveira/appzara.git\n```\n\nGet in the appzara folder:\n``` \ncd appzara/appzara\n```\nhow to execute the Spring context put following command in your prompt:\n```\nmvn spring-boot:run\n```\n\nAnd how to stop:\n```\nctrl c\n```\n\nIn the Infrastructure module there is a PriceController with a GET endpoint with the following parameters:\n\n- startDate (mandatory): date **must be int the format yyyy-MM-dd-HH.mm.ss** e.g. 2020-06-16-21.00.00\n- productId (mandatory): id of product e.g. 35455\n- brandId (mandatory): id of brand e.g: 1 (ZARA)\n\u003c/p\u003e\n\n\u003cp\u003eLets see some examples of request\u003c/p\u003e\n\u003cp\u003eRequest to day 14 of 2020 at 10:00 hrs\u003c/p\u003e\n\n```\ncurl --location 'http://localhost:8080/price/startDate/2020-06-14-10.00.00/productId/35455/brandId/1'\n```\n\n\u003cp\u003eThe response will be:\u003c/p\u003e\n\n```json lines\n{\n  \"brandId\": 1,\n  \"productId\": \"35455\",\n  \"priority\": 1,\n  \"rate\": 4,\n  \"startDate\": \"2020-06-15T16:00:00\",\n  \"endDate\": \"2020-12-31T23:59:59\",\n  \"amount\": 38.95\n}\n```\n\n\u003cp\u003eRequest to day 14 of 2020 at 16:00 hrs\u003c/p\u003e\n\n```\ncurl --location 'http://localhost:8080/price/startDate/2020-06-14-16.00.00/productId/35455/brandId/1'\n```\n\n\u003cp\u003eThe response will be:\u003c/p\u003e\n\n```json lines\n{\n  \"brandId\": 1,\n  \"productId\": \"35455\",\n  \"priority\": 1,\n  \"rate\": 4,\n  \"startDate\": \"2020-06-15T16:00:00\",\n  \"endDate\": \"2020-12-31T23:59:59\",\n  \"amount\": 38.95\n}\n```\n\n\u003cp\u003eRequest to day 14 of 2020 at 21:00 hrs\u003c/p\u003e\n\n```\ncurl --location 'http://localhost:8080/price/startDate/2020-06-14-21.00.00/productId/35455/brandId/1'\n```\n\u003cp\u003eThe response will be:\u003c/p\u003e\n\n```json lines\n{\n    \"brandId\": 1,\n    \"productId\": \"35455\",\n    \"priority\": 1,\n    \"rate\": 4,\n    \"startDate\": \"2020-06-15T16:00:00\",\n    \"endDate\": \"2020-12-31T23:59:59\",\n    \"amount\": 38.95\n}\n```\n\n\u003cp\u003eRequest to day 15 of 2020 at 21:00 hrs\u003c/p\u003e\n\n```\ncurl --location 'http://localhost:8080/price/startDate/2020-06-15-21.00.00/productId/35455/brandId/1'\n```\n\u003cp\u003eThe response will be:\u003c/p\u003e\n\n```json lines\n{\n  \"brandId\": 1,\n  \"productId\": \"35455\",\n  \"priority\": 1,\n  \"rate\": 3,\n  \"startDate\": \"2020-06-15T00:00:00\",\n  \"endDate\": \"2020-06-15T11:00:00\",\n  \"amount\": 30.50\n}\n```\n\u003cp\u003eRequest to day 16 of 2020 at 21:00 hrs\u003c/p\u003e\n\n```\ncurl --location 'http://localhost:8080/price/startDate/2020-06-16-21.00.00/productId/35455/brandId/1'\n```\n\u003cp\u003eThe response will be:\u003c/p\u003e\n\n```json lines\n{\n    \"brandId\": 1,\n    \"productId\": \"35455\",\n    \"priority\": 1,\n    \"rate\": 3,\n    \"startDate\": \"2020-06-15T00:00:00\",\n    \"endDate\": \"2020-06-15T11:00:00\",\n    \"amount\": 30.50\n}\n```\n\n# How to run Tests\n\n\u003cp\u003e This project has jacoco-report with we are able to see coverage after execute tests.\nThere is unit tests and integration test.\nThe integration test has the annotation @ActiveProfile(\"test\") with you want to execute it.\nTo execute all test just run:\n\u003c/p\u003e\n\n```\nmvn test\n```\n\nAfter execute tests jacoco-report will generate an index.html file with coverage.\nThe directory of this file is `appzara/bootstrap/target/site/jacoco-aggregate/index.html`.\n\n![directory_index_jacoco.png](data/directory_index_jacoco.png)\n\n\u003cp\u003eOpen it in your default browser to see the coverage of each module\u003c/p\u003e\n\n![coverage-updated.png](data/coverage-updated.png)\n\n## Contributors\n[@LauroSilveira](https://github.com/LauroSilveira)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaurosilveira%2Fappzara","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaurosilveira%2Fappzara","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaurosilveira%2Fappzara/lists"}