{"id":20398331,"url":"https://github.com/elvisoliveira/literate-train","last_synced_at":"2026-04-12T10:33:58.594Z","repository":{"id":79424600,"uuid":"210642468","full_name":"elvisoliveira/literate-train","owner":"elvisoliveira","description":"A programming challange in Java SpringBoot. Restful service that implements a cache based user manager.","archived":false,"fork":false,"pushed_at":"2019-09-24T16:10:27.000Z","size":101,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T01:15:54.766Z","etag":null,"topics":["jquery","junit","maven","mockito","postman","spring-boot","swagger"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"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/elvisoliveira.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":"2019-09-24T15:56:36.000Z","updated_at":"2019-09-24T21:10:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"f835a2b8-7ac2-40ff-bc63-b8bdc772e30a","html_url":"https://github.com/elvisoliveira/literate-train","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/elvisoliveira/literate-train","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvisoliveira%2Fliterate-train","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvisoliveira%2Fliterate-train/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvisoliveira%2Fliterate-train/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvisoliveira%2Fliterate-train/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elvisoliveira","download_url":"https://codeload.github.com/elvisoliveira/literate-train/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvisoliveira%2Fliterate-train/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270065445,"owners_count":24520946,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["jquery","junit","maven","mockito","postman","spring-boot","swagger"],"created_at":"2024-11-15T04:20:32.447Z","updated_at":"2025-12-30T21:47:30.025Z","avatar_url":"https://github.com/elvisoliveira.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Literate Train\nThe name for this project was automatically generated by **Github**. Follow me: [@elvisoliveira](https://github.com/elvisoliveira)\n\n## How to execute?\n```bash\nmvn spring-boot:run\n```\n\n## How to test the code?\n```bash\nmvn test\n```\n\n## How to test the app?\n```bash\nnewman run ./postman_collection.json --environment ./postman_environment.json --iteration-data ./postman_data.json\n```\n\n## Example\n![Screenshot](https://i.imgur.com/uYLuuTY.gif)\n\n## How to run the UI?\nThere is a simple UI running on the root (/) controller. Since the default port is **1337**, if you are running the app locally you can have access to it on `http://127.0.0.1:1337/`\n\nWhen the app starts a keypair is generated and delivered the file `postman_data.json`, you may use the info on it.\n\n## The Challange: *Single Digit*\nA single digit is defined following this rules: Given an integer, we need to find the single digit of it.\n\n- If **x** has only one digit, then its single digit is **x**.\n- Otherwise, the single digit of **x** equals the single digit of the sum of the digits of **x**.\n\nFor instance, the single digit of **9875** will be calculated as:\n\n|Parameter|Calc|Return|\n|---|---|---|\n|9875|9 + 8 + 7 + 5|29|\n|29|2 + 9|11|\n|11|1 + 1|2|\n|2|2|2|\n|2|2|2|\n\nGiven two numbers **n** and **k**, **P** must be defined as an string concatenation of **n * k**.\n\nExample:\n- *n* = 9875\n- *k* = 4\n- *p* = 9875 9875 9875 9875\n\n```java\nsingleDigit = singleDigit(9875987598759875)\n// 5 + 7 + 8 + 9 + 5 + 7 + 8 + 9 + 5 + 7 + 8 + 9 + 5 + 7 + 8 + 9 = 116\nsingleDigit = singleDigit(116)\n// 1 + 1 + 6 = 8\nsingleDigit = singleDigit(8)\n```\n\nThe singleDigit function must have the following parameters:\n\n1. **n**: A string representing an integer `1 \u003c= n \u003c= 10ˆ10000002`\n2. **k**: An integer representing the number of concatenation times `1 \u003c= k \u003c= 10ˆ53`\n3. The single digit function shall return an integer\n\n### User CRUD\n- A CRUD must be created for users\n- A user has a name, email, address and a list of single digit results already calculated\n- Each result list object must contain which parameters were inputted and the result of it\n\n### CACHE\n- A memory cache must be created to store the last 10 calculations performed by the single digit function, this cache is user independent, that is, if a calculation has already been performed and it is on the cache, it must not be performed again. Using caching frameworks is **not** allowed\n\n### Encryption\n- User name and email information must be encrypted with an asymmetric key `RSA` of size **2048**. Each user may have a separated encryption key. The information will be encrypted with the public key and the client will decrypt using their private key\n\n### API'S\n- Endpoints must be made available for the users CRUD\n- An endpoint must be available for single digit calculation, this can be optionally associated with a user\n- An endpoint that retrieves all calculations for a given user must be created\n- An endpoint to send the user public key `that will be used for encryption` must be created. This API should receive as string that will contain the key\n\n### Building the app\n- The application must contain an in-memory database\n- *Maven* should be used to build, run tests and start the application\n- *Unit* tests must be created\n- *Postman* integrated tests must be created and it's collection must be at the root of the repository\n- This collection should be called \"postman_collection.json\"\n- An Open API *Swagger* file should be created with API specification\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felvisoliveira%2Fliterate-train","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felvisoliveira%2Fliterate-train","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felvisoliveira%2Fliterate-train/lists"}