[
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the bug**\nA clear and concise description of what the bug is.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n1. Go to '...'\n2. Click on '....'\n3. Scroll down to '....'\n4. See error\n\n**Expected behavior**\nA clear and concise description of what you expected to happen.\n\n**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n**Desktop (please complete the following information):**\n - OS: [e.g. iOS]\n - Browser [e.g. chrome, safari]\n - Version [e.g. 22]\n\n**Smartphone (please complete the following information):**\n - Device: [e.g. iPhone6]\n - OS: [e.g. iOS8.1]\n - Browser [e.g. stock browser, safari]\n - Version [e.g. 22]\n\n**Additional context**\nAdd any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".gitignore",
    "content": "HELP.md\ntarget/\nmvnw\nmvnw.cmd\n**/.mvn/wrapper/**\n### Ignore vim swp files\n*.swp\n### Ignore application-<enc>.yml properties\n**/application-dev.yml\n**/application-prod.yml\n**/application-qa.yml\nsrc/main/resources/application.yml\n*.db\nlib/\nbin/\n*.html\n./EmailsToTelegramService/src/main/resources/application-qa.yml\n./EmailsToTelegramService/src/main/resources/application-dev.yml\n*.yml\n./EmailsToTelegramService/src/main/resources/application.yml\n*.dat\n\n### STS ###\n.apt_generated\n.classpath\n.factorypath\n.project\n.settings\n.springBeans\n.sts4-cache\n.DS_Store/*\n\n### IntelliJ IDEA ###\n.idea\n*.iws\n*.iml\n*.ipr\n\n### NetBeans ###\n/nbproject/private/\n/nbbuild/\n/dist/\n/nbdist/\n/.nb-gradle/\nbuild/\n\n### VS Code ###\n.vscode/\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"TrashEmailFetchMail\"]\n\tpath = TrashEmailFetchMail\n\turl = https://github.com/TrashEmail/TrashEmailFetchMail.git\n\tbranch = master\n[submodule \"TrashEmailTelegramConnector\"]\n\tpath = TrashEmailTelegramConnector\n\turl = https://github.com/TrashEmail/TrashEmailTelegramConnector.git\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "Makefile",
    "content": "##################################################################\n#    Project Convenience Makefile Wrapper for Maven & Docker     #\n##################################################################\n\n# This makefile is just a convenience wrapper for the Maven\n# program and the docker build which is used to build packaged\n# microservices for entire functionality. The actual building\n# rules for this project may be found in the Maven \"pom.xml\"\n# */Dockerfile and file located in this folder.\n\n######################### DEFINITIONS ############################\n\n# Define the commandline invocation of Maven if necessary:\n# ifeq ($(MVN))\n#     MVN  := mvn\n# endif\n\nMVN = mvn\nDOCKER_COMPOSE=docker-compose\n\n######################## BUILD TARGETS ###########################\n\nclean:\n\tcd ./TrashEmailService && $(MVN) clean\n\tcd ./EmailsToTelegramService && $(MVN) clean\n\nbuild :\n\techo \"Building TrashEmailService ...\\n\"\n\tcd ./TrashEmailService && $(MVN) -Dmaven.test.skip=true install\n\techo \"Building EmailsToTelegramService ...\\n\"\n\tcd ./EmailsToTelegramService && $(MVN) -Dmaven.test.skip=true install\n\techo \"Building the docker-compose ...\\n\"\n\t$(DOCKER_COMPOSE) build\n\ncopy :\n\techo $(ENV)\n\tcp ./EmailsToTelegramServiceConfig-$(ENV).yml EmailsToTelegramService/src/main/resources/application-$(ENV).yml\n\tcp ./TrashEmailServiceConfig-$(ENV).yml TrashEmailService/src/main/resources/application-$(ENV).yml\n\nqa : export ENV:=qa\nqa : clean copy build\n\ndev : export ENV:=dev\ndev : clean copy build\n\nprod : export ENV:=prod\nprod : clean copy build\n"
  },
  {
    "path": "README.md",
    "content": "<p align=center>\n\t<img src=\"./TrashEmail.png\">\n</p>\n\n[![Build Status](https://travis-ci.org/TrashEmail/TrashEmail.svg?branch=master)](https://travis-ci.org/TrashEmail/TrashEmail)![Bot](https://img.shields.io/static/v1?label=BOT&message=Healthy%20|%20UP&color=green&style=flat)\n[![Gitter](https://badges.gitter.im/Trashemail/community.svg)](https://gitter.im/Trashemail/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)\n![GitHub language count](https://img.shields.io/github/languages/count/TrashEmail/TrashEmail)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/TrashEmail/TrashEmail)\n![GitHub issues](https://img.shields.io/github/issues/TrashEmail/TrashEmail)\n![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/TrashEmail/TrashEmail)\n![Twitter Follow](https://img.shields.io/twitter/follow/sec_r0?style=social)\n![GitHub followers](https://img.shields.io/github/followers/r0hi7?style=social)\n\n\n <a target=\"_blank\" href=\"https://twitter.com/intent/tweet?text=TrashEmail%20is%20open%20source%20extremely%20privacy%20focused%20disposable%2Fsemi-permanent%20email%20bot%20solution%20for%20telegram.%20By%20@sec_r0,%20%20Do%20check%20this%20out.&url=https%3A%2F%2Fgithub.com%2FTrashEmail%2FTrashEmail%2F&hashtags=privacy,osint,temp_mail,disposable_mail,telegram_bot\" title=\"Share on Twitter\"><img src=\"https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Share%20on%20Twitter\"></a>\n\n\n### tl;dr\nTrashEmail is hosted Telegram bot that can save your private email address by offering disposable email address. It can create, manage, disposable email address and link them with your telegram bot chat. \n- **Where is the bot?** - [@trashemail_bot](https://t.me/trashemail_bot)\n- **How can I create dispoable mail id?** - Decide a username & ask the bot :smile:\n- **How many email ids can I own at a time?** - Right now, the count is **8**.\n- **How can I access my emails?** - If there is an email for you, it will come to telegram :smile: Easy right.\n- **Do I need to setup and remember any password?** - No Sir, that's the trick.\n- **Why am I maintaining and hosting this?** - This is my first such tool for community :smile: I wanted to give something back to community. If you like the idea and wanted to contribute then you can [BuyMeACoffee](https://www.buymeacoffee.com/r0hi7)\n- **How many users are currently using it?** - The information about active registered users and latest version of this service can be found here: https://trashemail.in\n\n![Trashemail Dashboard](./trashemail-dashboard.png \"Trashemail Dashboard\")\n\n\n#### How can I use this hosted service:\n- Its super easy, just see the demo below.\n\n[![Video on How to use it](https://img.youtube.com/vi/DB1orBm9VCY/0.jpg)](https://www.youtube.com/watch?v=DB1orBm9VCY)\n\n\n### What is Disposable Temporary E-mail? And How am I different?\nForget about spam, advertising mailings, hacking and attacking robots. Keep your real mailbox clean and secure.Trashemail provides temporary(or permanent), secure, anonymous, free, disposable email address. Want to get one ? its here : [@trashemail_bot](https://t.me/trashemail_bot)\n\n**Disposable email** - is a service that allows to receive email at a temporary(Here in case, the temporary factor is upto you) address that self-destructed after a certain time elapses. It is also known by names like : tempmail, 10minutemail, throwaway email, fake-mail or trash-mail. Many forums, Wi-Fi owners, websites and blogs ask visitors to register before they can view content, post comments or download something. \n\n**Trashemail** is not most advanced throwaway email service but a reliable service that helps you avoid spam, stay safe and get emails delivered directly to your [@trashemail_bot](https://t.me/trashemail_bot) *Telegram bot*. And in case you are getting too many such mails, just delete the email Id :) with one click(oops command, since this is telegram bot).\n\nThere are websites that offers such sort of functionalities (like https://temp-mail.org/en/ etc) but the certain issues with such platforms:\n1. Your information is safe or not you can't audit.\n2. The domain keeps changing as soon as they are identified as temp-mail domains.\n3. Everytime you have to visit site to get one, you can't keep the same temporary mail for long.\n4. And, their business model which makes you see lot of ads in website.\n\nConsidering all of this, I decided to make a open source project out of my hobby and thought of offering it as a service to others :)\nHow my service is ~better~ than theirs:\n1. The entire source code is open for audit, I am not interested in your data at all.\n2. Right now I own a domain trashemail.in and you will get emailIds from this domain only. (Easy for you to remember).\n3. The temporary time for your emailId to be alive is on you, not on the server, you can keep it permanently as well, or as long as I am able to maintain the [@trashemail_bot](https://t.me/trashemail_bot).\n4. This project is out of passion, so I don't have motive of earning anything, so **No Ads**.(I am serious, I hate them too, like you)\n5. I am always open to suggestion, feedback & Issues to work on.\n \n\n### Let's talk about the [Source](https://github.com/r0hi7/Trashemail).\nTrashEmail is Java spring-boot microservice that anyone can build locally currently with few setting to tune in and then have the entire setup running locally.\n All you need to own is mail server(SMTP and IMAP), telegram bot token and `mvn` locally to build it.\n Few requirements with the mailserver:\n 1. SMTP host should allow **Alias** creation.\n 2. IMAP server should support **IDLE**.\n\nI have to update the config slightly, and will do it quickly. :)\n\nAll you need to do is clone the source, build and run, and just tell telegram that you are listening here.\n```shell script\ngit clone https://github.com/r0hi7/Trashemail.git\ncd Trashemail\n\n# Copy EmailsToTelegramServiceConfig-sample.yml and\n# TrashEmailServiceConfig-sample.yml files\n# according to your environemnt\n# Let's say you want to deploy it for dev env\n# Then copy these files like\n\ncp EmailsToTelegramServiceConfig-sample.yml EmailsToTelegramServiceConfig-dev.yml\ncp TrashEmailServiceConfig-sample.yml TrashEmailServiceConfig-dev.yml\n\n# Now modify the respective copied files with your configs\n# Similarly, it can be deployed be \"qa\", \"prod\" environments\n# Finally, run the script build-and-run.sh with env as an argument\n\nbash build-and-run.sh dev\n\n# If you dont want to deploy it in docker-compose, then\n# Use Makefile directly\n# It will create targets for EmailsToTelegramService and TrashEmailService respectively\n\nmake dev\n```\nDev configs may look like this:\n`EmailsToTelegramServiceConfig-dev.yml`\n```yaml\n# Email Server IMAP and SMTP configuration\n# SMTP server should support Alias creation and deletion\n# IMAP server should support IDLE\n\ntrashemail:\n  host: trash-email-service\n  port: 9090\n  path: /getChatId/\n\nimap-client-service:\n  telegram:\n    url: https://api.telegram.org/bot\n    bot-token: xxxxxxxxxxxxxxxxxxxxxx\n    size: 4096\n  imap:\n    host: trashemail.in\n    port: 993\n    email: demo@trashemail.in\n    password: changeme\n  emails:\n    hostPath: http://127.0.0.1:8000/\n    downloadPath: /opt/EmailsToTelegramService/mails/\n\n# main will specify springboot application to\n# no start any tomcat server, which is not even\n# required for emailservice.\nspring:\n  application:\n    name: EmailsToTelegramService\n  main:\n    web-application-type: none\n```\n\n`TrashEmailServiceConfig-dev.yml`\n```yaml\n# Tomcat server settings\nserver:\n  port: 9090\n\n#Email server configuration for SMTP alias creation\nemail-server:\n  hosts:\n    - trashemail.in\n    - thromail.com\n    - humblemail.com\n  admin-email: contact@trashemail.in\n  admin-password: sample\n  add-url: https://trashemail.in/admin/mail/aliases/add\n  remove-url: https://trashemail.in/admin/mail/aliases/remove\n  target-alias: demo@trashemail.in\n\n\n# Sample config for connecting with mysql-docker\nspring:\n  datasource:\n    url: jdbc:mysql://mysql:3306/trashemail\n    username: root\n    password: changeme\n    driver-class-name: com.mysql.jdbc.Driver\n  jpa:\n    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect\n    hibernate:\n      ddl-auto: update\n    show-sql: true\n  application:\n    name: Trashemail\n\n\n\n# Trashemail app server settings\ntrashemail:\n  max-emails-per-user: 4\n\n# Logger settings\nlogging:\n  level:\n    io:\n      github:\n        trashemail: debug\n```\n\n\n1. This code will spin up the service at `localhost:9090/telegram/new-message` endpoint.\n2. Now will have to expose this service to internet, and there are options like : `ngrok`, `dataplicity`, `localtunnel` etc.\n\t* Start `ngrok`with http on port 9090\n\t* Get the `ngrok` https url\n3. DB is taken care by `mysql`\n4. Get a bot for you from, [Telegram Bot Father](https://telegram.me/BotFather)\n5. The last step is important, tell telegram that where you are listening :).  Set up the `webhook`, this `webhook` will tell telegram where to send the bot incoming requests\n    ```shell script\n    curl -F \"url=https://<YOUR_DOMAIN>/telegram/new-message\" https://api.telegram.org/bot<BOT_TOKEN>/setWebhook\n    ```\n6. And you are done.\n\n### How It Works\n1. For this bot to work, you need existing SMTP, IMAP setup.\n    1. SMTP with Alias creation\n    2. IMAP with IDLE enabled\n3. As user, requests for creation,\n2. It fools the user, that it created an email Id rather it creates an alias to exiting ID.\n    1. Why Alais, as IMAP needs to poll right, for incoming mails? This is how it is engineered.\n3. Runs a background async service to poll IMAP server.\n4. As soon as mail is fetched, the target is identified and telegram message is sent.\n\nI have tried to engineer this service to be reliable, in case if you find any issues with the reliability(or with anything else), please feel free to drop in a PR. I would be happy to review and merge.\n\n### Sponsors\n1. Two domains [thromail.com](thromail.com) & [humblemail.com](humblemail.com) are proudly donated by [zlipa.com](https://zlipa.com/). [Zlipa](https://zlipa.com/) offers domains names for startups, bootstrapper etc with 10X lesser market price. Exciting right? Just checkout once. \n\n2. If you like the idea, then buy me a coffee, I will get caffine in my blood and to spend extra nights to make this product secure, up and running :smile:\n\n<a href=\"https://www.buymeacoffee.com/r0hi7\" target=\"_blank\"><img src=\"https://cdn.buymeacoffee.com/buttons/arial-blue.png\" alt=\"Buy Me A Coffee\" style=\"height: 25.5px !important;width: 72px !important;\" ></a>\n\n3. Or you can drop in a :star:, this motivates me.\n\n### Credits\n![TelegramAllTheThings](./telegram-bot-all-the-things.jpg)\n\n\n\n### Infrastructure model\n\n![Insfrastructure model](.infragenie/infrastructure_model.png)"
  },
  {
    "path": "TrashEmailService/.gitignore",
    "content": "HELP.md\ntarget/\nmvnw\nmvnw.cmd\n**/.mvn/wrapper/**\n### Ignore vim swp files\n*.swp\n### Ignore application-<enc>.yml properties\n**/application-dev.yml\n**/application-prod.yml\n**/application-qa.yml\nsrc/main/resources/application.yml\n*.db\nlib/\nbin/\n*.html\n./EmailsToTelegramService/src/main/resources/application-qa.yml\n*.yml\n./EmailsToTelegramService/src/main/resources/application.yml\n*.dat\n\n### STS ###\n.apt_generated\n.classpath\n.factorypath\n.project\n.settings\n.springBeans\n.sts4-cache\n.DS_Store/*\n\n### IntelliJ IDEA ###\n.idea\n*.iws\n*.iml\n*.ipr\n\n### NetBeans ###\n/nbproject/private/\n/nbbuild/\n/dist/\n/nbdist/\n/.nb-gradle/\nbuild/\n\n### VS Code ###\n.vscode/\n"
  },
  {
    "path": "TrashEmailService/Dockerfile",
    "content": "FROM openjdk:8-jre-alpine\n\nARG SPRING_PROFILES_ACTIVE\n\nRUN mkdir -p /opt/TrashEmailService/\n\nCOPY ./target/*.jar /opt/TrashEmailService/trashemailservice.jar  \nWORKDIR /opt/TrashEmailService/\n\n\nEXPOSE 9090  \nENTRYPOINT [\"java\",\"-jar\",\"trashemailservice.jar\"] \n"
  },
  {
    "path": "TrashEmailService/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\txsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd\">\n\t<modelVersion>4.0.0</modelVersion>\n\t<parent>\n\t\t<groupId>org.springframework.boot</groupId>\n\t\t<artifactId>spring-boot-starter-parent</artifactId>\n\t\t<version>2.2.7.RELEASE</version>\n\t\t<relativePath/> <!-- lookup parent from repository -->\n\t</parent>\n\t<groupId>io.github</groupId>\n\t<artifactId>TrashEmailService</artifactId>\n\t<version>3.0.0</version>\n\t<name>TrashEmailService</name>\n\t<description>Springboot miscroservice - heart of Telegram @trashemail_bot</description>\n\t<distributionManagement>\n\t<repository>\n\t\t<id>github</id>\n\t\t<name>GitHub Packages</name>\n\t\t<url>https://maven.pkg.github.com/r0hi7/Trashemail</url>\n\t\t</repository>\n\t</distributionManagement>\n\t<properties>\n\t\t<java.version>1.8</java.version>\n\t</properties>\n\n\t<dependencies>\n\t\t<dependency>\n\t\t\t<groupId>org.springframework.boot</groupId>\n\t\t\t<artifactId>spring-boot-starter-actuator</artifactId>\n\t\t</dependency>\n        <dependency>\n            <groupId>org.springframework.boot</groupId>\n            <artifactId>spring-boot-starter</artifactId>\n        </dependency>\n\t\t<dependency>\n\t\t\t<groupId>org.springframework.boot</groupId>\n\t\t\t<artifactId>spring-boot-starter-web</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.springframework.boot</groupId>\n\t\t\t<artifactId>spring-boot-starter-test</artifactId>\n\t\t\t<scope>test</scope>\n\t\t\t<exclusions>\n\t\t\t\t<exclusion>\n\t\t\t\t\t<groupId>org.junit.vintage</groupId>\n\t\t\t\t\t<artifactId>junit-vintage-engine</artifactId>\n\t\t\t\t</exclusion>\n\t\t\t</exclusions>\n\t\t</dependency>\n\t\t<dependency>\n\t\t    <groupId>org.springframework.boot</groupId>\n\t\t    <artifactId>spring-boot-starter-data-jpa</artifactId>\n\t\t    <version>2.4.0</version>\n\n\t\t</dependency>\n\n\t\t<!-- Spring boot Thymeleaf for serving HTML pages -->\n<!--\t\t<dependency>-->\n<!--\t\t\t<groupId>org.springframework.boot</groupId>-->\n<!--\t\t\t<artifactId>spring-boot-starter-thymeleaf</artifactId>-->\n<!--\t\t</dependency>-->\n\n\t\t<!-- Comment H2 \n\t\t<dependency>\n\t\t    <groupId>com.h2database</groupId>\n\t\t    <artifactId>h2</artifactId>\n\t\t    <scope>runtime</scope>\n\t\t    <version>1.4.199</version>\n\t\t</dependency>\n\t\t-->\n\n\t\t<dependency>\n\t\t\t<groupId>mysql</groupId>\n\t\t\t<artifactId>mysql-connector-java</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.projectlombok</groupId>\n\t\t\t<artifactId>lombok</artifactId>\n\t\t\t<version>1.18.16</version>\n\t\t</dependency>\n\t</dependencies>\n\n\n\n\n\t<build>\n\t\t<plugins>\n\t\t\t<plugin>\n\t\t\t\t<groupId>org.springframework.boot</groupId>\n\t\t\t\t<artifactId>spring-boot-maven-plugin</artifactId>\n\t\t\t</plugin>\n\t\t</plugins>\n\t</build>\n\n</project>\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/Configurations/EmailServerConfig.java",
    "content": "package io.github.trashemail.Configurations;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\nimport org.springframework.boot.context.properties.ConfigurationProperties;\nimport org.springframework.context.annotation.Configuration;\n\nimport java.util.List;\n\n@Configuration\n@ConfigurationProperties(prefix = \"email-server\")\n@Getter @Setter @NoArgsConstructor\npublic class EmailServerConfig {\n\n    private List<String> hosts;\n    private String adminEmail;\n    private String adminPassword;\n    private String addUrl;\n    private String removeUrl;\n    private List<String> targetAlias;\n\n    @Override public String toString() {\n        return \"EmailServerConfig{\" +\n                \"hosts=\" + hosts +\n                \", adminEmail='\" + adminEmail + '\\'' +\n                \", addUrl='\" + addUrl + '\\'' +\n                \", removeUrl='\" + removeUrl + '\\'' +\n                \", targetAlias='\" + targetAlias + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/Configurations/TrashEmailConfig.java",
    "content": "package io.github.trashemail.Configurations;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\nimport org.springframework.boot.context.properties.ConfigurationProperties;\nimport org.springframework.context.annotation.Configuration;\n\nimport java.util.List;\n\n@Getter\n@Setter\n@NoArgsConstructor\n@Configuration\n@ConfigurationProperties(prefix = \"trashemail\")\npublic class TrashEmailConfig {\n    private String version;\n    private List<String> connectorURLs;\n\n    @Override public String toString() {\n        return \"TrashEmailConfig{\" +\n                \"version='\" + version + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/DTO/ConnectorStats.java",
    "content": "package io.github.trashemail.DTO;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\n@Getter\n@Setter\n@NoArgsConstructor\npublic class ConnectorStats {\n    private String connectorName;\n\n    private Long activeUsers;\n    private Long totalNumberOfUsers;\n    private Long activeEmailIds;\n    private Long totalNumberOfEmailIds;\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/DTO/CreateEmailRequest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\n@Getter\n@Setter\n@NoArgsConstructor\npublic class CreateEmailRequest {\n    private String source;\n    private String destination;\n    private String destinationType;\n    private String emailId;\n    private Boolean isActive;\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/DTO/CreateEmailResponse.java",
    "content": "package io.github.trashemail.DTO;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\n@Getter\n@Setter\n@NoArgsConstructor\npublic class CreateEmailResponse {\n    private Boolean created;\n    private String message;\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/DTO/DeleteEmailRequest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\n@Getter\n@Setter\n@NoArgsConstructor\npublic class DeleteEmailRequest {\n    private String emailId;\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/DTO/DeleteEmailResponse.java",
    "content": "package io.github.trashemail.DTO;\n\nimport com.fasterxml.jackson.annotation.JsonInclude;\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\n@Getter\n@Setter\n@NoArgsConstructor\n@JsonInclude(JsonInclude.Include.NON_NULL)\npublic class DeleteEmailResponse {\n    private String emailId;\n    private Boolean isDeleted;\n    private String error;\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/DTO/Email.java",
    "content": "package io.github.trashemail.DTO;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\nimport java.util.Date;\nimport java.util.List;\n\n@Getter\n@Setter\n@NoArgsConstructor\npublic class Email {\n    private String emailId;\n    private String message;\n    private Date arrived;\n    private String emailURI;\n    private String emailDownloadPath;\n    private List<String> attachmentsPaths;\n\n    public Email(SendEmailRequest sendEmailRequest){\n        this.arrived = new Date();\n        this.emailId = sendEmailRequest.getEmailId();\n        this.message = sendEmailRequest.getMessage();\n        this.emailURI = sendEmailRequest.getEmailURI();\n        this.emailDownloadPath = sendEmailRequest.getEmailDownloadPath();\n        this.attachmentsPaths = sendEmailRequest.getAttachmentsPaths();\n    }\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/DTO/SendEmailRequest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\nimport java.util.List;\n\n@Getter\n@Setter\n@NoArgsConstructor\npublic class SendEmailRequest {\n    private String emailId;\n    private String message;\n    private String emailURI;\n    private String emailDownloadPath;\n    private List<String> attachmentsPaths;\n\n    @Override public String toString() {\n        return \"SendEmailRequest{\" +\n                \"emailId='\" + emailId + '\\'' +\n                \", message='\" + message + '\\'' +\n                \", emailURI='\" + emailURI + '\\'' +\n                \", emailDownloadPath='\" + emailDownloadPath + '\\'' +\n                \", attachmentsPaths=\" + attachmentsPaths +\n                '}';\n    }\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/DTO/TelegramConnectorStats.java",
    "content": "package io.github.trashemail.DTO;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\n@Getter\n@Setter\n@NoArgsConstructor\npublic class TelegramConnectorStats {\n    private Long activeUsers;\n    private Long totalNumberOfUsers;\n    private Long activeEmailIds;\n    private Long totalNumberOfEmailIds;\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/DTO/TrashEmailStats.java",
    "content": "package io.github.trashemail.DTO;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\nimport java.util.List;\nimport java.util.Map;\n\n@Getter\n@Setter\n@NoArgsConstructor\npublic class TrashEmailStats {\n    private Long numberOfUsers;\n    private Long numberOfEmailsRegistered;\n    private Map<String, Long> domainsToNumbers;\n    private Long emailIdsCreatedToday;\n    private List<Long> emailIdsCreatedInWeek;\n    private String version;\n    private Long numberOfEmailsProcessed;\n    private Long totalNumberOfUsers;\n\n    private List<ConnectorStats> connectorStats;\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/EmailServerInteraction.java",
    "content": "package io.github.trashemail;\n\nimport io.github.trashemail.Configurations.EmailServerConfig;\nimport io.github.trashemail.exceptions.EmailAliasNotCreatedExecption;\nimport io.github.trashemail.models.EmailAllocation;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.http.*;\nimport org.springframework.stereotype.Component;\nimport org.springframework.util.LinkedMultiValueMap;\nimport org.springframework.util.MultiValueMap;\nimport org.springframework.web.client.HttpClientErrorException;\nimport org.springframework.web.client.RestTemplate;\n\n\n@Component(\"EmailServerInteraction\")\npublic class EmailServerInteraction {\n\n\t@Autowired\n\tprivate EmailServerConfig emailServerConfig;\n\n\t@Autowired\n\tRestTemplate restTemplate;\n\n\tprivate static final Logger log = LoggerFactory.getLogger(\n\t\t\tEmailServerInteraction.class);\n\n\tpublic String createEmailId(EmailAllocation emailAllocation)\n\tthrows HttpClientErrorException, EmailAliasNotCreatedExecption {\n\t\t\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\theaders.setBasicAuth(\n\t\t\temailServerConfig.getAdminEmail(),\n\t\t\temailServerConfig.getAdminPassword()\n\t\t);\n\t\theaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);\n\n\t\tMultiValueMap<String, String> data = new LinkedMultiValueMap<String, String>();\n\t\t\n\t\tdata.add(\"address\", emailAllocation.getEmailId());\n\t\tdata.add(\"forwards_to\", emailAllocation.getForwardsTo());\n\t\t\n\t\tHttpEntity<MultiValueMap<String, String>> request =\n\t\t\t\tnew HttpEntity<MultiValueMap<String, String>>(data, headers);\n\n\t\tResponseEntity response = restTemplate.postForEntity(\n\t\t\temailServerConfig.getAddUrl(),\n\t\t\trequest, \n\t\t\tString.class);\n\n\t\tif(response.getStatusCode() == HttpStatus.OK){\n\t\t\treturn \"Email ID : *\"+emailAllocation.getEmailId()+\"* \"+\n\t\t\t\t\t\"successfully Created :)\";\n\t\t}\n\n\t\tlog.error(response.getStatusCode().toString() + response.getBody());\n\t\tthrow new EmailAliasNotCreatedExecption(response.getBody().toString());\n\t}\n\n\tpublic boolean deleteEmailId(EmailAllocation emailAllocation) {\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\theaders.setBasicAuth(\n\t\t\t\temailServerConfig.getAdminEmail(),\n\t\t\t\temailServerConfig.getAdminPassword()\n\t\t);\n\t\theaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);\n\n\t\tMultiValueMap<String, String> data = new LinkedMultiValueMap<String, String>();\n\n\t\tdata.add(\"address\", emailAllocation.getEmailId());\n\n\t\tHttpEntity<MultiValueMap<String, String>> request =\n\t\t\t\tnew HttpEntity<MultiValueMap<String, String>>(data, headers);\n\n//\t\tRestTemplate restTemplate = new RestTemplate();\n\t\tResponseEntity response = restTemplate.postForEntity(\n\t\t\t\temailServerConfig.getRemoveUrl(),\n\t\t\t\trequest,\n\t\t\t\tString.class);\n\n\t\tif(response.getStatusCode() == HttpStatus.OK){\n\t\t\treturn true;\n\t\t}\n\n\t\telse if(response.getStatusCode() == HttpStatus.BAD_REQUEST){\n\t\t\treturn false;\n\t\t}\n\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/Respositories/FreeUserIdRepository.java",
    "content": "package io.github.trashemail.Respositories;\n\nimport io.github.trashemail.models.FreeUserId;\nimport org.springframework.data.repository.CrudRepository;\n\npublic interface FreeUserIdRepository\n        extends CrudRepository<FreeUserId, Integer> {\n    public FreeUserId findTopByOrderByIdAsc();\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/Respositories/UsedUserIdRepository.java",
    "content": "package io.github.trashemail.Respositories;\n\nimport io.github.trashemail.models.UsedUserId;\nimport org.springframework.data.jpa.repository.Query;\nimport org.springframework.data.repository.CrudRepository;\n\nimport java.time.LocalDateTime;\nimport java.util.List;\n\npublic interface UsedUserIdRepository\n        extends CrudRepository<UsedUserId, Integer> {\n    public List<UsedUserId> findByChatIdAndIsActiveTrue(long chatId);\n    public UsedUserId findByUserId(String userId);\n\n    public List<UsedUserId> findAllByCreateDateTimeBetween(\n            LocalDateTime begin, LocalDateTime end);\n\n    @Query(value = \"SELECT * FROM used_user_ids \" +\n                    \"where create_date_time <= \" +\n                    \"NOW() - INTERVAL 10 MINUTE\", nativeQuery = true)\n    public List<UsedUserId> getUserIdsCreatedBeforeTenMinutes();\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/TrashEmailApplication.java",
    "content": "package io.github.trashemail;\n\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.boot.web.client.RestTemplateBuilder;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.scheduling.annotation.EnableAsync;\nimport org.springframework.web.client.RestTemplate;\n\n@SpringBootApplication\n@EnableAsync\npublic class TrashEmailApplication {\n\n    public static void main(String[] args) {\n        SpringApplication.run(TrashEmailApplication.class, args);\n    }\n\n    @Bean\n    public RestTemplate restTemplate(RestTemplateBuilder builder) {\n        return builder.build();\n    }\n\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/TrashEmailResource.java",
    "content": "package io.github.trashemail;\n\nimport io.github.trashemail.Configurations.EmailServerConfig;\nimport io.github.trashemail.Configurations.TrashEmailConfig;\nimport io.github.trashemail.DTO.*;\nimport io.github.trashemail.exceptions.EmailAlreadyExsitExecption;\nimport io.github.trashemail.exceptions.EmailNotFoundExecption;\nimport io.github.trashemail.models.EmailAllocation;\nimport io.github.trashemail.repositories.EmailAllocationRepository;\nimport io.github.trashemail.repositories.EmailCounterRepository;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.http.HttpStatus;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.PostMapping;\nimport org.springframework.web.bind.annotation.RequestBody;\nimport org.springframework.web.bind.annotation.RestController;\nimport org.springframework.web.client.RestTemplate;\n\nimport java.util.*;\n\n\n@RestController\npublic class TrashEmailResource {\n\n\n    @Autowired\n    EmailCounterRepository emailCounterRepository;\n\n    @Autowired\n    EmailAllocationRepository emailAllocationRepository;\n\n    @Autowired\n    EmailServerConfig emailServerConfig;\n\n    @Autowired\n    TrashEmailConfig trashemailConfig;\n\n    @Autowired\n    EmailServerInteraction emailServerInteraction;\n\n    @Autowired\n    RestTemplate restTemplate;\n\n    private static final Logger log = LoggerFactory.getLogger(\n            TrashEmailResource.class);\n\n    @PostMapping(value = \"/create\")\n    public ResponseEntity<CreateEmailResponse> createEmailId(@RequestBody CreateEmailRequest createEmailRequest){\n        CreateEmailResponse createEmailResponse = new CreateEmailResponse();\n        try{\n            EmailAllocation checkIfExist = emailAllocationRepository.findByEmailIdAndIsActiveTrue(\n                    createEmailRequest.getEmailId());\n            if(checkIfExist != null)\n                throw new EmailAlreadyExsitExecption();\n\n            EmailAllocation emailAllocation = new EmailAllocation(createEmailRequest);\n            EmailAllocation existOlder = emailAllocationRepository.findByEmailIdAndDestinationAndDestinationType(\n              emailAllocation.getEmailId(),\n              emailAllocation.getDestination(),\n              emailAllocation.getDestinationType()\n            );\n            if (existOlder != null)\n                emailAllocation = existOlder;\n            else {\n                Random random = new Random();\n                emailAllocation.setForwardsTo(\n                    emailServerConfig\n                        .getTargetAlias()\n                        .get(random.nextInt(emailServerConfig.getTargetAlias().size())));\n                }\n            emailAllocation.setIsActive(true);\n\n            emailServerInteraction.createEmailId(emailAllocation);\n\n            createEmailResponse.setCreated(true);\n            createEmailResponse.setMessage(\"Email Address created\");\n\n            emailAllocationRepository.save(emailAllocation);\n            return new ResponseEntity<>(createEmailResponse, HttpStatus.CREATED);\n\n        }catch(Exception exception){\n            createEmailResponse.setMessage(exception.getMessage());\n            createEmailResponse.setCreated(false);\n        }\n\n        return new ResponseEntity<>(createEmailResponse, HttpStatus.BAD_REQUEST);\n    }\n\n    @PostMapping(value = \"/delete\")\n    public ResponseEntity<DeleteEmailResponse> deleteEmailId(@RequestBody DeleteEmailRequest deleteEmailRequest){\n        EmailAllocation emailAllocation = emailAllocationRepository.findByEmailIdAndIsActiveTrue(\n                deleteEmailRequest.getEmailId());\n        DeleteEmailResponse deleteEmailResponse = new DeleteEmailResponse();\n        try{\n            if(emailAllocation == null)\n                throw new EmailNotFoundExecption();\n\n            emailServerInteraction.deleteEmailId(emailAllocation);\n            emailAllocation.setIsActive(false);\n            emailAllocationRepository.save(emailAllocation);\n\n            deleteEmailResponse.setEmailId(deleteEmailRequest.getEmailId());\n            deleteEmailResponse.setIsDeleted(true);\n            return new ResponseEntity<>(deleteEmailResponse, HttpStatus.OK);\n\n        }catch (Exception e){\n            deleteEmailResponse.setIsDeleted(false);\n            deleteEmailResponse.setError(e.getMessage());\n        }\n\n        return new ResponseEntity<>(deleteEmailResponse, HttpStatus.BAD_REQUEST);\n    }\n\n    @PostMapping(value = \"/sendMail\")\n    public String sendMail(@RequestBody SendEmailRequest sendEmailRequest){\n        emailCounterRepository.updateCount();\n\n        EmailAllocation emailAllocation = emailAllocationRepository.findByEmailIdAndIsActiveTrue(\n                sendEmailRequest.getEmailId());\n        if(emailAllocation == null){\n            return \"Mail target not active\";\n        }\n\n        String mailTargetType = emailAllocation.getDestinationType();\n\n        if(mailTargetType.equals(\"url\") || mailTargetType.equals(\"telegram\")){\n            /*\n            Create a post request\n            */\n            String targetURI = emailAllocation.getDestination();\n            Email email = new Email(sendEmailRequest);\n\n            ResponseEntity response = restTemplate.postForEntity(\n                    targetURI,\n                    email,\n                    String.class\n            );\n            return (String) response.getBody();\n\n        }\n        else if(mailTargetType.equals(\"email\")){\n            /*\n            Send Email\n            */\n        }\n\n        return \"Mail Sent.\";\n    }\n\n    @GetMapping(value = \"/stats\")\n    public TrashEmailStats presentDashBoard(){\n        TrashEmailStats trashemailStats = new TrashEmailStats();\n        trashemailStats.setVersion(trashemailConfig.getVersion());\n        List<ConnectorStats> connectorStats = new ArrayList<>();\n\n        /*\n        Get Stats from each connector\n        */\n        for(String connectorURL : trashemailConfig.getConnectorURLs()){\n            connectorStats.add(\n                    restTemplate.getForEntity(connectorURL + \"/stats/\", ConnectorStats.class).getBody()\n            );\n        }\n        trashemailStats.setConnectorStats(connectorStats);\n\n        Map<String, Long> domainCount = new HashMap<String, Long>();\n        for(String domain: emailServerConfig.getHosts()){\n            Long countForDomain = (\n                    (Integer) emailAllocationRepository.findByEmailIdEndsWith(domain).size()\n            ).longValue();\n\n            domainCount.put(domain, countForDomain);\n        }\n        trashemailStats.setDomainsToNumbers(domainCount);\n        trashemailStats.setEmailIdsCreatedToday(emailAllocationRepository.getEmailIdsCreatedTodayCount());\n\n        Calendar calendar = Calendar.getInstance();\n        Date today = calendar.getTime();\n        calendar.add(Calendar.DAY_OF_MONTH, -7);\n        Date sevenDaysBefore = calendar.getTime();\n\n        trashemailStats.setEmailIdsCreatedInWeek(\n                emailAllocationRepository.getEmailIdsCreatedInWeek(\n                        today,\n                        sevenDaysBefore\n                )\n        );\n\n        trashemailStats.setNumberOfEmailsProcessed(\n            emailCounterRepository.count()\n        );\n\n        return trashemailStats;\n    }\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/exceptions/EmailAliasNotCreatedExecption.java",
    "content": "package io.github.trashemail.exceptions;\n\npublic class EmailAliasNotCreatedExecption extends Exception {\n    public EmailAliasNotCreatedExecption(String message){\n        super(message);\n    }\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/exceptions/EmailAlreadyExsitExecption.java",
    "content": "package io.github.trashemail.exceptions;\n\npublic class EmailAlreadyExsitExecption extends Exception {\n    public EmailAlreadyExsitExecption(){\n        super(\"Email Address already taken\");\n    }\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/exceptions/EmailNotFoundExecption.java",
    "content": "package io.github.trashemail.exceptions;\n\npublic class EmailNotFoundExecption extends Exception {\n    public EmailNotFoundExecption(){\n        super(\"Email not allocated to anyone.\");\n    }\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/models/EmailAllocation.java",
    "content": "package io.github.trashemail.models;\n\nimport io.github.trashemail.DTO.CreateEmailRequest;\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\nimport org.hibernate.annotations.CreationTimestamp;\n\nimport javax.persistence.*;\nimport java.time.LocalDateTime;\n\n@Getter\n@Setter\n@NoArgsConstructor\n@Table(name=\"email_allocated\")\n@Entity\npublic class EmailAllocation {\n\n    @Id\n    @GeneratedValue(strategy = GenerationType.IDENTITY)\n    private Long id;\n\n    private String emailId;\n    private String forwardsTo;\n    private Boolean isActive;\n\n    private String source;\n    private String destination;\n    private String destinationType;\n\n    @CreationTimestamp\n    private LocalDateTime createDateTime;\n\n    public EmailAllocation(CreateEmailRequest emailRequest){\n        this.emailId = emailRequest.getEmailId();\n        this.isActive = true;\n        this.source = emailRequest.getSource();\n        this.destination = emailRequest.getDestination();\n        this.destinationType = emailRequest.getDestinationType();\n    }\n\n    @Override public String toString() {\n        return \"EmailAllocation{\" +\n                \"id=\" + id +\n                \", emailId='\" + emailId + '\\'' +\n                \", forwardsTo='\" + forwardsTo + '\\'' +\n                \", isActive=\" + isActive +\n                \", source='\" + source + '\\'' +\n                \", destination='\" + destination + '\\'' +\n                \", destinationType='\" + destinationType + '\\'' +\n                \", createDateTime=\" + createDateTime +\n                '}';\n    }\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/models/EmailCounter.java",
    "content": "package io.github.trashemail.models;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\nimport javax.persistence.Entity;\nimport javax.persistence.GeneratedValue;\nimport javax.persistence.Id;\nimport javax.persistence.Table;\n\n@Entity\n@Getter\n@Setter\n@NoArgsConstructor\n@Table(name = \"emailCounter\")\npublic class EmailCounter {\n    @Id\n    @GeneratedValue\n    private Integer id;\n    private Integer count;\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/models/FreeUserId.java",
    "content": "package io.github.trashemail.models;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\n\nimport javax.persistence.*;\n\n@Entity\n@Getter\n@Setter\n@NoArgsConstructor\n@Table(name = \"free_user_ids\")\npublic class FreeUserId {\n    @Id\n    @GeneratedValue(strategy= GenerationType.IDENTITY)\n    private Long id;\n\n    private String userId;\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/models/UsedUserId.java",
    "content": "package io.github.trashemail.models;\n\nimport lombok.Getter;\nimport lombok.NoArgsConstructor;\nimport lombok.Setter;\nimport org.hibernate.annotations.CreationTimestamp;\n\nimport javax.persistence.*;\nimport java.time.LocalDateTime;\n\n@Entity\n@Getter\n@Setter\n@NoArgsConstructor\n@Table(name = \"used_user_ids\")\npublic class UsedUserId {\n    @Id\n    @GeneratedValue(strategy = GenerationType.IDENTITY)\n    private Long id;\n\n    private Long chatId;\n    private Boolean isActive;\n    private String userId;\n\n    @CreationTimestamp\n    private LocalDateTime createDateTime;\n}\n\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/repositories/EmailAllocationRepository.java",
    "content": "package io.github.trashemail.repositories;\n\nimport io.github.trashemail.models.EmailAllocation;\nimport org.springframework.data.jpa.repository.Query;\nimport org.springframework.data.repository.CrudRepository;\nimport org.springframework.data.repository.query.Param;\n\nimport java.util.Date;\nimport java.util.List;\n\npublic interface EmailAllocationRepository\n        extends CrudRepository<EmailAllocation, Long> {\n    EmailAllocation findByEmailIdAndIsActiveTrue(String emailId);\n    EmailAllocation findByEmailIdAndDestinationAndDestinationType(String emailId,\n                                                                  String destination,\n                                                                  String destination_type);\n    List<EmailAllocation> findByEmailIdEndsWith(String domain);\n    @Query(\n            value = \"SELECT count(user.emailId) FROM EmailAllocation user \" +\n                    \"WHERE DATE (user.createDateTime) = CURDATE() \"\n    ) long getEmailIdsCreatedTodayCount();\n\n    /*\n    In JPA DB dialects for date manipulations are not good, so using java\n    based approach.\n    */\n    @Query(\n            value = \"SELECT count(user.emailId) FROM EmailAllocation user \" +\n                    \"WHERE DATE(user.createDateTime) >= :oneWeekOldDate and \" +\n                    \"DATE(user.createDateTime) <= :today \" +\n                    \"GROUP BY DATE(user.createDateTime) \" +\n                    \"ORDER BY DATE(user.createDateTime)\"\n    ) List<Long> getEmailIdsCreatedInWeek(\n            @Param(\"today\") Date currDate,\n            @Param(\"oneWeekOldDate\") Date oneWeekOldDate\n    );\n}\n"
  },
  {
    "path": "TrashEmailService/src/main/java/io/github/trashemail/repositories/EmailCounterRepository.java",
    "content": "package io.github.trashemail.repositories;\n\nimport io.github.trashemail.models.EmailCounter;\nimport org.springframework.data.jpa.repository.Modifying;\nimport org.springframework.data.jpa.repository.Query;\nimport org.springframework.data.repository.CrudRepository;\n\nimport javax.transaction.Transactional;\n\npublic interface EmailCounterRepository\n        extends CrudRepository<EmailCounter, Integer> {\n\n    @Transactional\n    @Modifying\n    @Query(value = \"UPDATE EmailCounter ec set ec.count = ec.count + 1 where \" +\n            \"ec.id = 1\")\n    public void updateCount();\n\n    @Query(value = \"select ec.count from EmailCounter ec where ec.id=1\")\n    public long count();\n}\n"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/DTO/ConnectorStatsTest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\npublic class ConnectorStatsTest {\n\tprivate ConnectorStats connectorStats;\n\n\t@BeforeEach\n\tpublic void setUp() {\n\t\tconnectorStats = new ConnectorStats();\n\t}\n\t\n\t@Test\n\tpublic void gettersNullTest() {\n\t\tassertNull(connectorStats.getConnectorName());\n\t\tassertNull(connectorStats.getActiveUsers());\n\t\tassertNull(connectorStats.getTotalNumberOfUsers());\n\t\tassertNull(connectorStats.getActiveEmailIds());\n\t\tassertNull(connectorStats.getTotalNumberOfEmailIds());\n\t}\n\t\n\t@Test\n\tpublic void settersTest() {\n\t\tString connectorName = \"Name\";\n\t\tconnectorStats.setConnectorName(connectorName);\n\t\tassertEquals(connectorName, connectorStats.getConnectorName());\n\t\t\n\t\tLong activeUsers = new Long(100);\n\t\tconnectorStats.setActiveUsers(activeUsers);\n\t\tassertEquals(activeUsers, connectorStats.getActiveUsers());\n\t\t\n\t    Long totalNumberOfUsers = new Long(54580);\n\t    connectorStats.setTotalNumberOfUsers(totalNumberOfUsers);\n\t\tassertEquals(totalNumberOfUsers, connectorStats.getTotalNumberOfUsers());\n\t\t\n\t    Long activeEmailIds = new Long(24);\n\t    connectorStats.setActiveEmailIds(activeEmailIds);\n\t\tassertEquals(activeEmailIds, connectorStats.getActiveEmailIds());\n\t\t\n\t    Long totalNumberOfEmailIds = new Long(22300);\n\t    connectorStats.setTotalNumberOfEmailIds(totalNumberOfEmailIds);\n\t\tassertEquals(totalNumberOfEmailIds, connectorStats.getTotalNumberOfEmailIds());\n\t}\n}"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/DTO/CreateEmailRequestTest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\npublic class CreateEmailRequestTest {\n\tprivate CreateEmailRequest createEmailRequest;\n\n\t@BeforeEach\n\tpublic void setUp() {\n\t\tcreateEmailRequest = new CreateEmailRequest();\n\t}\n\t\n\t@Test\n\tpublic void gettersNullTest() {\n\t\tassertNull(createEmailRequest.getSource());\n\t\tassertNull(createEmailRequest.getDestination());\n\t\tassertNull(createEmailRequest.getDestinationType());\n\t\tassertNull(createEmailRequest.getEmailId());\n\t\tassertNull(createEmailRequest.getIsActive());\n\t}\n\t\n\t@Test\n\tpublic void settersTest() {\n\t\tString source = \"source\";\n\t\tcreateEmailRequest.setSource(source);\n\t\tassertEquals(source, createEmailRequest.getSource());\n\t\t\n\t\tString destination = \"destination\";\n\t\tcreateEmailRequest.setDestination(destination);\n\t\tassertEquals(destination, createEmailRequest.getDestination());\n\t\t\n\t\tString destinationType = \"destinationType\";\n\t    createEmailRequest.setDestinationType(destinationType);\n\t\tassertEquals(destinationType, createEmailRequest.getDestinationType());\n\t\t\n\t\tString emailId = \"emailId\";\n\t    createEmailRequest.setEmailId(emailId);\n\t\tassertEquals(emailId, createEmailRequest.getEmailId());\n\t\t\n\t    boolean isActive = true;\n\t    createEmailRequest.setIsActive(isActive);\n\t\tassertEquals(isActive, createEmailRequest.getIsActive());\n\t}\n}"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/DTO/CreateEmailResponseTest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\npublic class CreateEmailResponseTest {\n\tprivate CreateEmailResponse createEmailResponse;\n\t\n\t@BeforeEach\n\tpublic void setUp() {\n\t\tcreateEmailResponse = new CreateEmailResponse();\n\t}\n\t\n\t@Test\n\tpublic void gettersNullTest() {\n\t\tassertNull(createEmailResponse.getCreated());\n\t\tassertNull(createEmailResponse.getMessage());\n\t}\n\t\n\t@Test\n\tpublic void settersTest() {\n\t\tboolean created = true;\n\t\tcreateEmailResponse.setCreated(created);\n\t\tassertEquals(created, createEmailResponse.getCreated());\n\t\t\n\t\tString message = \"message\";\n\t\tcreateEmailResponse.setMessage(message);\n\t\tassertEquals(message, createEmailResponse.getMessage());\n\t}\n}"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/DTO/DeleteEmailRequestTest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\npublic class DeleteEmailRequestTest {\n\tprivate DeleteEmailRequest deleteEmailRequest;\n\t\n\t@BeforeEach\n\tpublic void setUp() {\n\t\tdeleteEmailRequest = new DeleteEmailRequest();\n\t}\n\t\n\t@Test\n\tpublic void getterNullTest() {\n\t\tassertNull(deleteEmailRequest.getEmailId());\n\t}\n\t\n\t@Test\n\tpublic void setterTest() {\n\t\tString emailId = \"emailId\";\n\t\tdeleteEmailRequest.setEmailId(emailId);\n\t\tassertEquals(emailId, deleteEmailRequest.getEmailId());\n\t}\n}"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/DTO/DeleteEmailResponseTest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\npublic class DeleteEmailResponseTest {\n\tprivate DeleteEmailResponse deleteEmailResponse;\n\t\n\t@BeforeEach\n\tpublic void setUp() {\n\t\tdeleteEmailResponse = new DeleteEmailResponse();\n\t}\n\t\n\t@Test\n\tpublic void settersTest() {\n\t\tString emailId = \"emailId\";\n\t\tdeleteEmailResponse.setEmailId(emailId);\n\t\tassertEquals(emailId, deleteEmailResponse.getEmailId());\n\t\t\n\t    Boolean isDeleted = true;\n\t    deleteEmailResponse.setIsDeleted(isDeleted);\n\t    assertEquals(isDeleted, deleteEmailResponse.getIsDeleted());\n\t    \n\t    String error = \"error\";\n\t    deleteEmailResponse.setError(error);\n\t    assertEquals(error, deleteEmailResponse.getError());\n\t}\n}"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/DTO/EmailTest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\nimport static org.mockito.Mockito.*;\n\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Arrays;\n\npublic class EmailTest {\n\tprivate Email email;\n\tprivate SendEmailRequest sendEmailRequest;\n\n\t@BeforeEach\n\tpublic void setUp() {\n\t\tsendEmailRequest = mock(SendEmailRequest.class);\n\t\temail = new Email(sendEmailRequest);\n\t}\n\n\t@Test\n\tpublic void constructorTest() {\n\t\tassertNotNull(email.getArrived());\n\t\tassertEquals(email.getEmailId(), sendEmailRequest.getEmailId());\n\t\tassertEquals(email.getMessage(), sendEmailRequest.getMessage());\n\t\tassertEquals(email.getEmailURI(), sendEmailRequest.getEmailURI());\n\t\tassertEquals(email.getEmailDownloadPath(), sendEmailRequest.getEmailDownloadPath());\n\t\tassertEquals(email.getAttachmentsPaths(), sendEmailRequest.getAttachmentsPaths());\n\t}\n\t\n\t@Test\n\tpublic void settersTest() {\n\t\tDate date = mock(Date.class);\n\t\temail.setArrived(date);\n\t\tassertEquals(date, email.getArrived());\n\t\t\n\t\tString emailId = \"hola@gmail.com\";\n\t\temail.setEmailId(emailId);\n\t\tassertEquals(emailId, email.getEmailId());\n\t\t\n\t\tString message = \"hola\";\n\t\temail.setMessage(message);\n\t\tassertEquals(message, email.getMessage());\n\t\t\n\t\tString emailURI = \"hola@gmail.com\";\n\t\temail.setEmailURI(emailURI);\n\t\tassertEquals(emailURI, email.getEmailURI());\n\t\t\n\t\tString emailDownloadPath = \"www.direccion.com\";\n\t\temail.setEmailDownloadPath(emailDownloadPath);\n\t\tassertEquals(emailDownloadPath, email.getEmailDownloadPath());\n\t\t\n\t\tList<String> attachmentsPaths = Arrays.asList(\"at1\", \"at2\", \"at3\");\n\t\temail.setAttachmentsPaths(attachmentsPaths);\n\t\tassertEquals(attachmentsPaths, email.getAttachmentsPaths());\n\t}\n} "
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/DTO/SendEmailRequestTest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\npublic class SendEmailRequestTest {\n\tprivate SendEmailRequest sendEmailRequest;\n\t\n\t@BeforeEach\n\tpublic void setUp() {\n\t\tsendEmailRequest = new SendEmailRequest();\n\t}\n\t\n\t@Test\n\tpublic void gettersNullTest() {\n\t\tassertNull(sendEmailRequest.getEmailId());\n\t\tassertNull(sendEmailRequest.getMessage());\n\t\tassertNull(sendEmailRequest.getEmailURI());\n\t\tassertNull(sendEmailRequest.getEmailDownloadPath());\n\t\tassertNull(sendEmailRequest.getAttachmentsPaths());\n\t}\n\t\n\t@Test\n\tpublic void settersTest() {\n\t\tString emailId = \"emailId\";\n\t\tsendEmailRequest.setEmailId(emailId);\n\t\tassertEquals(emailId, sendEmailRequest.getEmailId());\n\t\t\n\t\tString message = \"message\";\n\t\tsendEmailRequest.setMessage(message);\n\t\tassertEquals(message, sendEmailRequest.getMessage());\n\t\t\n\t\tString emailURI = \"emailURI\";\n\t\tsendEmailRequest.setEmailURI(emailURI);\n\t\tassertEquals(emailURI, sendEmailRequest.getEmailURI());\n\t\t\n\t\tString emailDownloadPath = \"emailDownloadPath\";\n\t\tsendEmailRequest.setEmailDownloadPath(emailDownloadPath);\n\t\tassertEquals(emailDownloadPath, sendEmailRequest.getEmailDownloadPath());\n\t\t\n\t    List<String> attachmentsPaths = Arrays.asList(\"att1\", \"att2\");\n\t    sendEmailRequest.setAttachmentsPaths(attachmentsPaths);\n\t\tassertEquals(attachmentsPaths, sendEmailRequest.getAttachmentsPaths());\n\t}\n\t\n\t@Test\n\tpublic void toStringTest() {\n\t\t// Set up\n\t\tString emailId = \"emailId\";\n\t\tsendEmailRequest.setEmailId(emailId);\n\t\t\n\t\tString message = \"message\";\n\t\tsendEmailRequest.setMessage(message);\n\t\t\n\t\tString emailURI = \"emailURI\";\n\t\tsendEmailRequest.setEmailURI(emailURI);\n\t\t\n\t\tString emailDownloadPath = \"emailDownloadPath\";\n\t\tsendEmailRequest.setEmailDownloadPath(emailDownloadPath);\n\t\t\n\t\tList<String> attachmentsPaths = Arrays.asList(\"att1\", \"att2\");\n\t    sendEmailRequest.setAttachmentsPaths(attachmentsPaths);\n\t\t\n\t\tString texto = \"SendEmailRequest{\" +\n                \"emailId='\" + sendEmailRequest.getEmailId() + '\\'' +\n                \", message='\" + sendEmailRequest.getMessage() + '\\'' +\n                \", emailURI='\" + sendEmailRequest.getEmailURI() + '\\'' +\n                \", emailDownloadPath='\" + sendEmailRequest.getEmailDownloadPath()+ '\\'' +\n                \", attachmentsPaths=\" + sendEmailRequest.getAttachmentsPaths() +\n                '}';\n\t\t\n\t\tString resultado = sendEmailRequest.toString();\n\t\t\n\t\tassertEquals(texto, resultado);\n\t}\n}"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/DTO/TelegramConnectorStatsTest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\npublic class TelegramConnectorStatsTest {\n\tprivate TelegramConnectorStats telegramConnectorStats; \n\t\n\t@BeforeEach\n\tpublic void setUp() {\n\t\ttelegramConnectorStats = new TelegramConnectorStats();\n\t}\n\t\n\t@Test\n\tpublic void gettersNullTest() {\n\t\tassertNull(telegramConnectorStats.getActiveUsers());\n\t\tassertNull(telegramConnectorStats.getTotalNumberOfUsers());\n\t\tassertNull(telegramConnectorStats.getActiveEmailIds());\n\t\tassertNull(telegramConnectorStats.getTotalNumberOfEmailIds());\n\t}\n\t\n\t@Test\n\tpublic void settersTest() {\n\t\tLong activeUsers = new Long(20);\n\t\ttelegramConnectorStats.setActiveUsers(activeUsers);\n\t\tassertEquals(activeUsers, telegramConnectorStats.getActiveUsers());\n\t\t\n\t\tLong totalNumberOfUsers = new Long(150);\n\t\ttelegramConnectorStats.setTotalNumberOfUsers(totalNumberOfUsers);\n\t\tassertEquals(totalNumberOfUsers, telegramConnectorStats.getTotalNumberOfUsers());\n\t\t\n\t\tLong activeEmailIds = new Long(15);\n\t\ttelegramConnectorStats.setActiveEmailIds(activeEmailIds);\n\t\tassertEquals(activeEmailIds, telegramConnectorStats.getActiveEmailIds());\n\t\t\n\t\tLong totalNumberOfEmailIds = new Long(100);\n\t\ttelegramConnectorStats.setTotalNumberOfEmailIds(totalNumberOfEmailIds);\n\t\tassertEquals(totalNumberOfEmailIds, telegramConnectorStats.getTotalNumberOfEmailIds());\n\t}\n}"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/DTO/TrashEmailStatsTest.java",
    "content": "package io.github.trashemail.DTO;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\nimport static org.mockito.Mockito.*;\n\npublic class TrashEmailStatsTest {\n\tprivate TrashEmailStats trashEmailStats;\n\t\n\t@BeforeEach\n\tpublic void setUp() {\n\t\ttrashEmailStats = new TrashEmailStats();\n\t}\n\t\n\t@Test\n\tpublic void gettersNullTest() {\n\t\tassertNull(trashEmailStats.getNumberOfUsers());\n\t\tassertNull(trashEmailStats.getNumberOfEmailsRegistered());\n\t\tassertNull(trashEmailStats.getDomainsToNumbers());\n\t\tassertNull(trashEmailStats.getEmailIdsCreatedToday());\n\t\tassertNull(trashEmailStats.getEmailIdsCreatedInWeek());\n\t\tassertNull(trashEmailStats.getVersion());\n\t\tassertNull(trashEmailStats.getNumberOfEmailsProcessed());\n\t\tassertNull(trashEmailStats.getTotalNumberOfUsers());\n\t\tassertNull(trashEmailStats.getConnectorStats());\n\t}\n\t\n\t@Test\n\tpublic void settersTest() {\n\t\tLong numberOfUsers = 15l;\n\t\ttrashEmailStats.setNumberOfUsers(numberOfUsers);\n\t\tassertEquals(numberOfUsers, trashEmailStats.getNumberOfUsers());\n\t\t\n\t\tLong numberOfEmailsRegistered = 100l;\n\t\ttrashEmailStats.setNumberOfEmailsRegistered(numberOfEmailsRegistered);\n\t\tassertEquals(numberOfEmailsRegistered, trashEmailStats.getNumberOfEmailsRegistered());\n\t\t\n\t\t\n\t\tMap<String, Long> domainsToNumbers = new HashMap<String, Long>();\n\t\tdomainsToNumbers.put(\"domain1\", 15l);\n\t\tdomainsToNumbers.put(\"domain2\", 25l);\n\t\ttrashEmailStats.setDomainsToNumbers(domainsToNumbers);\n\t\tassertEquals(domainsToNumbers, trashEmailStats.getDomainsToNumbers());\n\t\t\n\t\tLong emailIdsCreatedToday = 4l;\n\t\ttrashEmailStats.setEmailIdsCreatedToday(emailIdsCreatedToday);;\n\t\tassertEquals(emailIdsCreatedToday, trashEmailStats.getEmailIdsCreatedToday());\n\t\t\n\t    List<Long> emailIdsCreatedInWeek = Arrays.asList(4l, 4l, 6l, 7l, 10l);\n\t    trashEmailStats.setEmailIdsCreatedInWeek(emailIdsCreatedInWeek);\n\t\tassertEquals(emailIdsCreatedInWeek, trashEmailStats.getEmailIdsCreatedInWeek());\n\t\t\n\t\tString version = \"version\";\n\t\ttrashEmailStats.setVersion(version);\n\t\tassertEquals(version, trashEmailStats.getVersion());\n\t\t\n\t\tLong numberOfEmailsProcessed = 70l;\n\t\ttrashEmailStats.setNumberOfEmailsProcessed(numberOfEmailsProcessed);\n\t\tassertEquals(numberOfEmailsProcessed, trashEmailStats.getNumberOfEmailsProcessed());\n\t\t\n\t\tLong totalNumberOfUsers = 1000l;\n\t\ttrashEmailStats.setTotalNumberOfUsers(totalNumberOfUsers);\n\t\tassertEquals(totalNumberOfUsers, trashEmailStats.getTotalNumberOfUsers());\n\t\t\n\t\tConnectorStats connectorStats1 = mock(ConnectorStats.class);\n\t\tConnectorStats connectorStats2 = mock(ConnectorStats.class);\n\t\tList<ConnectorStats> connectorStats = Arrays.asList(connectorStats1, connectorStats2);\n\t\ttrashEmailStats.setConnectorStats(connectorStats);\n\t\tassertEquals(connectorStats, trashEmailStats.getConnectorStats());\n\t}\n}"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/EmailServerInteractionTests.java",
    "content": "package io.github.trashemail;\n\nimport io.github.trashemail.Configurations.EmailServerConfig;\nimport io.github.trashemail.exceptions.EmailAliasNotCreatedExecption;\nimport io.github.trashemail.models.EmailAllocation;\nimport org.junit.jupiter.api.AfterEach;\nimport org.junit.jupiter.api.BeforeAll;\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.DisplayName;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.jupiter.MockitoExtension;\nimport org.springframework.http.HttpEntity;\nimport org.springframework.http.HttpStatus;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.web.client.RestTemplate;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertFalse;\nimport static org.junit.jupiter.api.Assertions.assertThrows;\nimport static org.junit.jupiter.api.Assertions.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.when;\n\n@ExtendWith(MockitoExtension.class)\nclass EmailServerInteractionTests {\n\n    @InjectMocks\n    private EmailServerInteraction emailServerInteraction;\n    @Mock\n    private EmailServerConfig emailServerConfig;\n    @Mock\n    private RestTemplate restTemplate;\n\n    private static EmailAllocation emailAllocation;\n\n    @BeforeAll\n    static void setUpBeforeClass() {\n        emailAllocation = new EmailAllocation();\n        emailAllocation.setEmailId(\"a@a.com\");\n        emailAllocation.setEmailId(\"emailid@a.com\");\n        emailAllocation.setForwardsTo(\"forwardsto@a.com\");\n    }\n\n    @BeforeEach\n    void setUpBefore() {\n        when(emailServerConfig.getAdminEmail()).thenReturn(\"admin@a.com\");\n        when(emailServerConfig.getAdminPassword()).thenReturn(\"password\");\n\n    }\n\n    @AfterEach\n    void teardown() {\n        emailServerConfig = null;\n        restTemplate = null;\n    }\n\n\n    @Test\n    void testCreateEmail() throws EmailAliasNotCreatedExecption {\n        when(emailServerConfig.getAddUrl()).thenReturn(\"www.addurl.com\");\n        when(restTemplate.postForEntity(Mockito.anyString(), any(HttpEntity.class), any(Class.class)))\n                .thenReturn(ResponseEntity.ok(\"\"));\n\n        String actual = emailServerInteraction.createEmailId(emailAllocation);\n\n        assertEquals(\"Email ID : *emailid@a.com* successfully Created :)\", actual);\n    }\n\n    @Test\n    void testCreateEmailException() throws EmailAliasNotCreatedExecption {\n        when(emailServerConfig.getAddUrl()).thenReturn(\"www.addurl.com\");\n        when(restTemplate.postForEntity(Mockito.anyString(), any(HttpEntity.class), any(Class.class)))\n                .thenReturn(ResponseEntity.badRequest().body(\"\"));\n\n        assertThrows(EmailAliasNotCreatedExecption.class, () -> emailServerInteraction.createEmailId(emailAllocation));\n    }\n\n\n    @Test\n    @DisplayName(\"Delete email with 200 response\")\n    void testDeleteEmailId() {\n        when(emailServerConfig.getRemoveUrl()).thenReturn(\"www.removeurl.com\");\n        when(restTemplate.postForEntity(Mockito.anyString(), any(HttpEntity.class), any(Class.class)))\n                .thenReturn(ResponseEntity.ok(\"\"));\n\n        boolean actual = emailServerInteraction.deleteEmailId(emailAllocation);\n\n        assertTrue(actual);\n    }\n\n    @Test\n    @DisplayName(\"Delete email with 400 response\")\n    void testDeleteEmailIdBadRequest() {\n        when(emailServerConfig.getRemoveUrl()).thenReturn(\"www.removeurl.com\");\n        when(restTemplate.postForEntity(Mockito.anyString(), any(HttpEntity.class), any(Class.class)))\n                .thenReturn(new ResponseEntity(HttpStatus.BAD_REQUEST));\n\n        boolean actual = emailServerInteraction.deleteEmailId(emailAllocation);\n\n        assertFalse(actual);\n    }\n\n    @Test\n    @DisplayName(\"Delete email with 500 response\")\n    void testDeleteEmailIdBadRequestOtherStatusCode() {\n        when(emailServerConfig.getRemoveUrl()).thenReturn(\"www.removeurl.com\");\n        when(restTemplate.postForEntity(Mockito.anyString(), any(HttpEntity.class), any(Class.class)))\n                .thenReturn(new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR));\n\n        boolean actual = emailServerInteraction.deleteEmailId(emailAllocation);\n\n        assertFalse(actual);\n    }\n}\n"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/TrashEmailApplicationTests.java",
    "content": "package io.github.trashemail;\n\nimport org.junit.jupiter.api.Disabled;\nimport org.junit.jupiter.api.Test;\nimport org.springframework.boot.test.context.SpringBootTest;\n\n@Disabled\n@SpringBootTest\nclass TrashEmailApplicationTests {\n\n    @Test\n    void contextLoads() {\n    }\n\n}\n"
  },
  {
    "path": "TrashEmailService/src/test/java/io/github/trashemail/TrashEmailResourceTest.java",
    "content": "package io.github.trashemail;\n\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport io.github.trashemail.Configurations.EmailServerConfig;\nimport io.github.trashemail.Configurations.TrashEmailConfig;\nimport io.github.trashemail.DTO.ConnectorStats;\nimport io.github.trashemail.DTO.CreateEmailRequest;\nimport io.github.trashemail.DTO.DeleteEmailRequest;\nimport io.github.trashemail.DTO.SendEmailRequest;\nimport io.github.trashemail.models.EmailAllocation;\nimport io.github.trashemail.repositories.EmailAllocationRepository;\nimport io.github.trashemail.repositories.EmailCounterRepository;\nimport org.junit.jupiter.api.Test;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;\nimport org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;\nimport org.springframework.boot.test.mock.mockito.MockBean;\nimport org.springframework.http.HttpStatus;\nimport org.springframework.http.MediaType;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.test.web.servlet.MockMvc;\nimport org.springframework.web.client.RestTemplate;\n\nimport java.util.Arrays;\nimport java.util.Date;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.when;\nimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;\nimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;\nimport static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;\nimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;\nimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;\n\n@AutoConfigureMockMvc\n@WebMvcTest(controllers = TrashEmailResource.class)\nclass TrashEmailResourceTest {\n\n    @MockBean\n    private EmailAllocationRepository emailAllocationRepository;\n    @MockBean\n    private EmailCounterRepository emailCounterRepository;\n    @MockBean\n    private EmailServerConfig emailServerConfig;\n    @MockBean\n    private EmailServerInteraction emailServerInteraction;\n    @Autowired\n    private MockMvc mockMvc;\n    @MockBean\n    private RestTemplate restTemplate;\n    @MockBean\n    private TrashEmailConfig trashEmailConfig;\n\n    @Test\n    void testPresentDashBoard() throws Exception {\n\n        ConnectorStats connectorStats = new ConnectorStats();\n        connectorStats.setConnectorName(\"connectorname\");\n\n\n        when(trashEmailConfig.getVersion()).thenReturn(\"1.0.0\");\n        when(trashEmailConfig.getConnectorURLs()).thenReturn(Arrays.asList(\"www.connection.com\"));\n        when(emailServerConfig.getHosts()).thenReturn(Arrays.asList(\"localhost\"));\n        when(emailAllocationRepository.findByEmailIdEndsWith(anyString())).thenReturn(Arrays.asList(new EmailAllocation()));\n        when(emailAllocationRepository.getEmailIdsCreatedTodayCount()).thenReturn(1L);\n        when(emailAllocationRepository.getEmailIdsCreatedInWeek(any(Date.class), any(Date.class))).thenReturn(Arrays.asList(1L));\n        when(emailAllocationRepository.count()).thenReturn(1L);\n\n        when(restTemplate.getForEntity(anyString(), any(Class.class)))\n                .thenReturn(new ResponseEntity(connectorStats, HttpStatus.OK));\n\n        mockMvc.perform(get(\"/stats\"))\n               .andDo(print())\n               .andExpect(content().json(\"{\\\"numberOfUsers\\\":null,\\\"numberOfEmailsRegistered\\\":null,\\\"domainsToNumbers\\\":{\\\"localhost\\\":1},\\\"emailIdsCreatedToday\\\":1,\\\"emailIdsCreatedInWeek\\\":[1],\\\"version\\\":\\\"1.0.0\\\",\\\"numberOfEmailsProcessed\\\":0,\\\"totalNumberOfUsers\\\":null,\\\"connectorStats\\\":[{\\\"connectorName\\\":\\\"connectorname\\\",\\\"activeUsers\\\":null,\\\"totalNumberOfUsers\\\":null,\\\"activeEmailIds\\\":null,\\\"totalNumberOfEmailIds\\\":null}]}\"))\n               .andExpect(status().isOk());\n    }\n\n\n    @Test\n    void testSendEmailTargetNotActive() throws Exception {\n\n        doNothing().when(emailCounterRepository).updateCount();\n        when(emailAllocationRepository.findByEmailIdAndIsActiveTrue(anyString())).thenReturn(null);\n\n        SendEmailRequest sendEmailRequest = new SendEmailRequest();\n        sendEmailRequest.setEmailId(\"emailid\");\n        String payload = new ObjectMapper().writeValueAsString(sendEmailRequest);\n\n        mockMvc.perform(post(\"/sendMail\")\n                                .contentType(MediaType.APPLICATION_JSON_VALUE)\n                                .content(payload))\n               .andDo(print())\n               .andExpect(status().isOk())\n               .andExpect(content().string(\"Mail target not active\"));\n    }\n\n\n    @Test\n    void testSendEmail() throws Exception {\n\n        doNothing().when(emailCounterRepository).updateCount();\n\n        EmailAllocation emailAllocation = new EmailAllocation();\n        emailAllocation.setDestinationType(\"url\");\n        emailAllocation.setDestination(\"destination\");\n\n        when(emailAllocationRepository.findByEmailIdAndIsActiveTrue(anyString())).thenReturn(emailAllocation);\n\n        SendEmailRequest sendEmailRequest = new SendEmailRequest();\n        sendEmailRequest.setEmailId(\"emailid\");\n        String payload = new ObjectMapper().writeValueAsString(sendEmailRequest);\n\n        when(restTemplate.postForEntity(anyString(), any(Object.class), any(Class.class)))\n                .thenReturn(ResponseEntity.ok(\"\"));\n\n\n        mockMvc.perform(post(\"/sendMail\")\n                                .contentType(MediaType.APPLICATION_JSON_VALUE)\n                                .content(payload))\n               .andDo(print())\n               .andExpect(status().isOk())\n               .andExpect(content().string(\"\"));\n    }\n\n    @Test\n    void testSendEmailTargetTypeEmail() throws Exception {\n\n        doNothing().when(emailCounterRepository).updateCount();\n\n        EmailAllocation emailAllocation = new EmailAllocation();\n        emailAllocation.setDestinationType(\"email\");\n        emailAllocation.setDestination(\"destination\");\n\n        when(emailAllocationRepository.findByEmailIdAndIsActiveTrue(anyString())).thenReturn(emailAllocation);\n\n        SendEmailRequest sendEmailRequest = new SendEmailRequest();\n        sendEmailRequest.setEmailId(\"emailid\");\n        String payload = new ObjectMapper().writeValueAsString(sendEmailRequest);\n\n        when(restTemplate.postForEntity(anyString(), any(Object.class), any(Class.class)))\n                .thenReturn(ResponseEntity.ok(\"\"));\n\n\n        mockMvc.perform(post(\"/sendMail\")\n                                .contentType(MediaType.APPLICATION_JSON_VALUE)\n                                .content(payload))\n               .andDo(print())\n               .andExpect(status().isOk())\n               .andExpect(content().string(\"Mail Sent.\"));\n    }\n\n    @Test\n    void testDeleteEmailIdBadRequest() throws Exception {\n        DeleteEmailRequest deleteEmailRequest = new DeleteEmailRequest();\n        deleteEmailRequest.setEmailId(\"emailId\");\n        String payload = new ObjectMapper().writeValueAsString(deleteEmailRequest);\n\n        when(emailAllocationRepository.findByEmailIdAndIsActiveTrue(anyString())).thenReturn(null);\n\n        mockMvc.perform(post(\"/delete\")\n                       .contentType(MediaType.APPLICATION_JSON_VALUE)\n                       .content(payload))\n               .andDo(print())\n               .andExpect(status().isBadRequest());\n    }\n\n    @Test\n    void testDeleteEmailId() throws Exception {\n        DeleteEmailRequest deleteEmailRequest = new DeleteEmailRequest();\n        deleteEmailRequest.setEmailId(\"emailId\");\n        String payload = new ObjectMapper().writeValueAsString(deleteEmailRequest);\n        EmailAllocation emailAllocation = new EmailAllocation();\n\n\n        when(emailAllocationRepository.findByEmailIdAndIsActiveTrue(anyString())).thenReturn(emailAllocation);\n        when(emailServerInteraction.deleteEmailId(any(EmailAllocation.class))).thenReturn(true);\n        when(emailAllocationRepository.save(any(EmailAllocation.class))).thenReturn(emailAllocation);\n\n        mockMvc.perform(post(\"/delete\")\n                                .contentType(MediaType.APPLICATION_JSON_VALUE)\n                                .content(payload))\n               .andDo(print())\n               .andExpect(status().isOk())\n               .andExpect(content().json(\"{\\\"emailId\\\":\\\"emailId\\\",\\\"isDeleted\\\":true}\"));\n    }\n\n    @Test\n    void testCreateEmailBadRequest() throws Exception {\n        CreateEmailRequest createEmailRequest = new CreateEmailRequest();\n        createEmailRequest.setEmailId(\"emailid\");\n        String payload = new ObjectMapper().writeValueAsString(createEmailRequest);\n        when(emailAllocationRepository.findByEmailIdAndIsActiveTrue(anyString())).thenReturn(new EmailAllocation());\n\n        mockMvc.perform(post(\"/create\")\n                       .contentType(MediaType.APPLICATION_JSON_VALUE)\n                       .content(payload))\n               .andDo(print())\n               .andExpect(status().isBadRequest());\n    }\n\n    @Test\n    void testCreateEmailCreated() throws Exception {\n        CreateEmailRequest createEmailRequest = new CreateEmailRequest();\n        createEmailRequest.setEmailId(\"emailid\");\n        createEmailRequest.setDestination(\"destination\");\n        createEmailRequest.setDestinationType(\"destinationtype\");\n        EmailAllocation emailAllocation = new EmailAllocation();\n        String payload = new ObjectMapper().writeValueAsString(createEmailRequest);\n        when(emailAllocationRepository.findByEmailIdAndIsActiveTrue(anyString())).thenReturn(null);\n        when(emailAllocationRepository.findByEmailIdAndDestinationAndDestinationType(anyString(),\n                                                                                     anyString(),\n                                                                                     anyString())).thenReturn(emailAllocation);\n\n        when(emailServerInteraction.createEmailId(any(EmailAllocation.class))).thenReturn(\"\");\n        when(emailAllocationRepository.save(any(EmailAllocation.class))).thenReturn(emailAllocation);\n\n        mockMvc.perform(post(\"/create\")\n                                .contentType(MediaType.APPLICATION_JSON_VALUE)\n                                .content(payload))\n               .andDo(print())\n               .andExpect(status().isCreated());\n    }\n\n    @Test\n    void testCreateEmailRandom() throws Exception {\n        CreateEmailRequest createEmailRequest = new CreateEmailRequest();\n        createEmailRequest.setEmailId(\"emailid\");\n        createEmailRequest.setDestination(\"destination\");\n        createEmailRequest.setDestinationType(\"destinationtype\");\n        EmailAllocation emailAllocation = new EmailAllocation();\n        String payload = new ObjectMapper().writeValueAsString(createEmailRequest);\n        when(emailAllocationRepository.findByEmailIdAndIsActiveTrue(anyString())).thenReturn(null);\n        when(emailAllocationRepository.findByEmailIdAndDestinationAndDestinationType(anyString(),\n                                                                                     anyString(),\n                                                                                     anyString())).thenReturn(null);\n\n        when(emailServerConfig.getTargetAlias()).thenReturn(Arrays.asList(\"Alias\"));\n        when(emailServerInteraction.createEmailId(any(EmailAllocation.class))).thenReturn(\"\");\n        when(emailAllocationRepository.save(any(EmailAllocation.class))).thenReturn(emailAllocation);\n\n        mockMvc.perform(post(\"/create\")\n                                .contentType(MediaType.APPLICATION_JSON_VALUE)\n                                .content(payload))\n               .andDo(print())\n               .andExpect(status().isCreated());\n    }\n}\n"
  },
  {
    "path": "build-and-run.sh",
    "content": "#! /bin/bash\n\nenvironment=${1:-dev}\nexport SPRING_PROFILES_ACTIVE=$environment\n\nmake $environment\ndocker-compose up\n\n\n"
  }
]