{"id":21417522,"url":"https://github.com/davidgfolch/spring-mongo-reactive","last_synced_at":"2025-03-16T19:19:54.864Z","repository":{"id":233860869,"uuid":"210607770","full_name":"davidgfolch/spring-mongo-reactive","owner":"davidgfolch","description":null,"archived":false,"fork":false,"pushed_at":"2020-03-28T06:42:25.000Z","size":96,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-23T05:45:37.341Z","etag":null,"topics":["functional-programming","reactor","rest-api","spring-reactive-mongodb","spring-webflux"],"latest_commit_sha":null,"homepage":null,"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/davidgfolch.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}},"created_at":"2019-09-24T13:18:15.000Z","updated_at":"2020-03-28T06:42:27.000Z","dependencies_parsed_at":"2024-04-17T14:29:29.494Z","dependency_job_id":"20093c9b-11c9-438f-a604-564cd422e306","html_url":"https://github.com/davidgfolch/spring-mongo-reactive","commit_stats":null,"previous_names":["davidgfolch/spring-mongo-reactive"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgfolch%2Fspring-mongo-reactive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgfolch%2Fspring-mongo-reactive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgfolch%2Fspring-mongo-reactive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgfolch%2Fspring-mongo-reactive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidgfolch","download_url":"https://codeload.github.com/davidgfolch/spring-mongo-reactive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918629,"owners_count":20368745,"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":["functional-programming","reactor","rest-api","spring-reactive-mongodb","spring-webflux"],"created_at":"2024-11-22T19:16:09.002Z","updated_at":"2025-03-16T19:19:54.836Z","avatar_url":"https://github.com/davidgfolch.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Getting Started\n\n## Description\n\nFully reactive Rental film REST API.\nAlso see Kotlin version (in Kotlin branch).\n\n### Prerequisites\n- Enable annotation processors (in your IDE for lombok)\n\n### Architecture\n- Reactive Layers architecture (spring-framework reactor).\n- Java non-blocking functional programming: reactor+streams.\n- REST API's with Spring-WebFlux.\n    - Using [Functional Programming Model](https://docs.spring.io/spring-framework/docs/5.0.0.BUILD-SNAPSHOT/spring-framework-reference/html/web-reactive.html#_functional_programming_model)\n- Persistence with reactive MongoDb.\n\nNotes:\n- No security implementation at all.\n- No persistence transaction implementation (https://spring.io/blog/2019/05/16/reactive-transactions-with-spring).\n- You'll find some reactive junit tests.\n- Sonar gradle plugin (you can run sonarqube gradle task if you have sonar installed on localhost:9000)\n  \n### Business logic\nI've changed the requirement \"renting for x days\".\n\nIn my implementation, when renting, you are always paying for 1 day.\n\nWhen you return films you pay for surcharges if applies.\n\n#### Details\n\nRent \u0026 Return films:\n\n- In both cases:\n    - Non-existent `userId` throws UserNotFoundException.\n    - duplicated `filmId`'s are ignored, just processing one.\n      \n- Rent films\n    - Non-existent `filmId`'s or not available stock, are ignored and not returned in result list.\n    - With all available films found:\n        - decreases stock\n        - calculates rent for 1 day.\n        - get saved in `Customer.films` (including date in each film).\n- Return films\n    - Non-existent films in `Customer.films` are ignored and not returned in result list.\n    - From all matching films in `Customer.films`, gets the older one (a filmId could be repeated with different rent date)\n        - calculate surcharges (after x days).\n        - remove from customer \u0026 save.\n        - increase film stock.\n\n### Try it\n- Run App as a spring-boot app:\n    - command line: `gradlew :bootRun`\n    - intellij: right button on `App.java` \u0026 Run...\n\nEvery time app starts, customer and films are created automatically with harcoded ids for ease of use.\n\nAlso, generated json for each user+films is printed in log console, so we can copy/paste in RestApi POST bodies.\n\n- Use `postman_collection.json` (importing the json file in Postman client):\n    - `rentFilms`: to rent\n    - `customerGet`: to see customer rented films \u0026 bonusPoints\n    - `returnFilms`: to return (after x days as path param)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidgfolch%2Fspring-mongo-reactive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidgfolch%2Fspring-mongo-reactive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidgfolch%2Fspring-mongo-reactive/lists"}