{"id":15129855,"url":"https://github.com/leonel-h29/codechallenge-tibo","last_synced_at":"2026-01-20T10:32:53.845Z","repository":{"id":256465512,"uuid":"854734942","full_name":"Leonel-H29/CodeChallenge-Tibo","owner":"Leonel-H29","description":"This project is a REST API built with NestJS, designed to manage transactions within a current account. It allows for the creation of current accounts, depositing funds, and making payments. Each deposit or payment transaction is recorded in a separate entity to maintain a clear transaction flow.","archived":false,"fork":false,"pushed_at":"2024-09-11T22:25:17.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-11T17:14:00.025Z","etag":null,"topics":["docker","docker-compose","mysql","nestjs","swagger"],"latest_commit_sha":null,"homepage":"https://app.tiboapp.com","language":"TypeScript","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/Leonel-H29.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":"2024-09-09T17:30:30.000Z","updated_at":"2024-10-10T22:42:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a0e5215-fc5b-460e-839b-1707de13d726","html_url":"https://github.com/Leonel-H29/CodeChallenge-Tibo","commit_stats":null,"previous_names":["leonel-h29/codechallenge-tibo"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leonel-H29%2FCodeChallenge-Tibo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leonel-H29%2FCodeChallenge-Tibo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leonel-H29%2FCodeChallenge-Tibo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leonel-H29%2FCodeChallenge-Tibo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Leonel-H29","download_url":"https://codeload.github.com/Leonel-H29/CodeChallenge-Tibo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386942,"owners_count":20930740,"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":["docker","docker-compose","mysql","nestjs","swagger"],"created_at":"2024-09-26T02:21:52.099Z","updated_at":"2026-01-20T10:32:53.808Z","avatar_url":"https://github.com/Leonel-H29.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodeChallenge-Tibo\n\n## Project Description\n\nThis project is a REST API built with NestJS, designed to manage transactions within a current account. It allows for the creation of current accounts, depositing funds, and making payments. Each deposit or payment transaction is recorded in a separate entity to maintain a clear transaction flow.\n\n## Project Requirements\n\n- A new NestJS module for managing current accounts has been created.\n- The module includes a controller, a service, and two entities: `CurrentAccount` and `Flows`.\n- `CurrentAccount` entity fields:\n  - Balance (integer)\n  - Owner (string)\n  - CreatedAt (date/time)\n  - UpdatedAt (date/time)\n  - Type (USD or ARS, enum)\n- `Flows` entity fields:\n  - Amount (integer): Positive for deposits, negative for payments.\n  - CreatedAt (date/time)\n  - UpdatedAt (date/time)\n  - CurrentAccountId (int, FK): Associated current account ID.\n\n## Implemented Endpoints\n\n1. `POST /current-account`: Create a new current account.\n\n   - Parameters:\n     - `owner` (string): The name of the account owner. Only letters and spaces are allowed.\n     - `type` (enum): The type of current account, either USD or ARS.\n\n2. `POST /current-account/deposit`: Deposit funds into a current account.\n\n   - Parameters:\n     - `currentAccountId` (number): The ID of the current account.\n     - `amount` (number): The amount of funds to deposit. Must be a positive number.\n\n3. `POST /current-account/payment`: Make a payment from a current account.\n   - Parameters:\n     - `currentAccountId` (number): The ID of the current account.\n     - `amount` (number): The amount of the payment. Must be a positive number indicating the amount to be deducted.\n\n## Features\n\n- Input data validation for each endpoint with proper error handling.\n- Payments are not permitted if the current account lacks sufficient funds.\n- DTOs (Data Transfer Objects) are created for each entity and endpoint.\n- Deposits and payments are recorded in the `Flows` entity.\n- One-to-many relationship between `CurrentAccount` and `Flows`.\n- MySQL is used as the database.\n\n## Getting Started\n\nTo get the project up and running, you can use the following commands from `package.json`:\n\n- `npm run start`: Start the application.\n- `npm run start:dev`: Start the application in watch mode.\n- `npm run start:debug`: Start the application in debug mode.\n- `npm run start:prod`: Start the application using the compiled files in the `dist` directory.\n- `npm run test`: Run the tests.\n- `npm run test:watch`: Run the tests in watch mode.\n- `npm run test:cov`: Run the tests with coverage.\n- `npm run test:e2e`: Run the end-to-end tests.\n- `npm run lint`: Run the linter.\n- `npm run build`: Build the application.\n- `npm run format`: Format the code using Prettier.\n\n## Setting Up MySQL with Docker\n\nTo set up the MySQL container, use the `docker-compose.yml` file with the following command:\n\n```bash\ndocker-compose -f \"docker-compose.yml\" up -d --build\n```\n\nThis will start a MySQL instance on port `3307`. The necessary environment variables are specified in the `.env` file and include:\n\n- `MYSQL_URL`: Connection URL for the MySQL database.\n- `MYSQL_HOST`: Host for the MySQL database.\n- `MYSQL_DATABASE`: Database name.\n- `MYSQL_USER`: Username for the database.\n- `MYSQL_PASSWORD`: Password for the database user.\n- `MYSQL_ROOT_PASSWORD`: Password for the root user.\n- `MYSQL_PORT`: Port on which MySQL is exposed.\n\n## Accessing Swagger Documentation\n\nThe Swagger documentation for the API can be accessed by navigating to `http://localhost:3000/api-docs` after starting the application. This is set up in `src/main.ts` where the Swagger module is configured and served on the `/api-docs` endpoint.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonel-h29%2Fcodechallenge-tibo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonel-h29%2Fcodechallenge-tibo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonel-h29%2Fcodechallenge-tibo/lists"}