diff --git a/.env.example b/.env.example index 87c1958..11ccf5f 100644 --- a/.env.example +++ b/.env.example @@ -2,11 +2,19 @@ PORT= SECRET_KEY= # DATABASE CONNECTION -DATABASE_URL= +DATABASE_URL=postgresql://docker:ignite@mentores-backend.soujunior.tech:5432/mentores_backend +DATABASE_URL_LOCAL=postgresql://docker:ignite@localhost:5432/mentores_backend +URL_CONFIRM_EMAIL=http://localhost:Porta que o frontend esta rodando/confirmacao +URL_RESTORATION_EMAIL=http://localhost:Porta que o frontend esta rodando/setNewPassword +#Para fazer a captura de email, use o https://mailtrap.io/, caso esteja na duvida como usar olhe o readme. #EMAIL INFO MAIL_HOST= MAIL_PORT= MAIL_USER= -MAIL_PASSWORD= \ No newline at end of file +MAIL_PASSWORD= + +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_S3_BUCKET_NAME= \ No newline at end of file diff --git a/README.md b/README.md index 00a13b1..477f491 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,72 @@ -

- Nest Logo -

- -[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 -[circleci-url]: https://circleci.com/gh/nestjs/nest - -

A progressive Node.js framework for building efficient and scalable server-side applications.

-

-NPM Version -Package License -NPM Downloads -CircleCI -Coverage -Discord -Backers on Open Collective -Sponsors on Open Collective - - Support us - -

- - -## Description - -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. - -## Installation +# mentores-backend + +Projeto Opensource que visa melhorar o match entre Mentores e Juniors. + +## Observação: + +>Antes de iniciar a instalação, lembre-se de fazer um fork do repositório oficial e realizar as alterações no repositório "forkado" enviando modificações através de Pull Requests. Nunca modifique diretamente o repositório oficial. + + +Clone o projeto: ```bash -$ npm install + git clone https://github.com/{SEU USUARIO}/mentores-backend.git ``` -## Running the app +Entre no diretório do projeto: ```bash -# development -$ npm run start + cd mentores-backend/ +``` -# watch mode -$ npm run start:dev +Instale as dependências: -# production mode -$ npm run start:prod +```bash + npm install ``` -## Test +## Rodando localmente + +- Verifique se esta com o docker instalado e aberto + +Dentro da pasta mentores-backend, rode o seguinte comando: ```bash -# unit tests -$ npm run test +docker-compose up -d +``` + +com o banco de dados rodando localmente, só precisa pegar as variaveis .env com alguem do projeto. -# e2e tests -$ npm run test:e2e +## Como utilizar o mailtrap. -# test coverage -$ npm run test:cov +Entre no [Mailtrap](https://mailtrap.io) e crie uma conta, com a conta criada vá em email Testing e clique em my inbox: + +![image](https://github.com/wendesongomes/mentores-backend/assets/82889172/f966d27c-6a13-4a7a-90c9-3b3a37500ae8) + +Veja a parte de Integration e clique em Show Credentials, vai precisar do Host, Port, Username e Password. + +![image](https://github.com/wendesongomes/mentores-backend/assets/82889172/efcbb466-69d9-4264-8553-4b73bfa13eb4) +![image](https://github.com/wendesongomes/mentores-backend/assets/82889172/c6b59518-f9a7-40d7-817e-d3c429e12fbe) + +Agora só utilizar o: + +```bash +npm run dev ``` -## Support +### Mailtrap não capturou o email + +Caso você tenha feito isso tudo e não recebeu o email no mailtrap faça o seguinte, Na pasta do mentores-backend vá em: + +src/modules/mails/mail.module.ts -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). +dentro dela tem um: -## Stay in touch +```bash +secure: true, +``` -- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) +![image](https://github.com/wendesongomes/mentores-backend/assets/82889172/0386598d-5053-4189-9e9b-e7d1a4ef1655) -## License -Nest is [MIT licensed](LICENSE). +troque para false, com isso o mailtrap vai capturar seus emails normalmente. diff --git a/docker-compose.yml b/docker-compose.yml index 91e4c1c..f577a54 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,8 @@ services: - POSTGRES_PASSWORD=ignite - POSTGRES_DB=mentores_backend volumes: - - pgdata:/data/postgres + - pgdata:/var/lib/postgresql/data + mentores_backend: build: . container_name: mentores_backend @@ -21,15 +22,13 @@ services: - 3000:3000 volumes: - .:/usr/app - links: - - database_soujunior depends_on: - database_soujunior env_file: - .env environment: - - DATABASE_URL=postgresql://docker:ignite@mentores_backend:3306/mentores_backend?reconnect=true + - DATABASE_URL=postgresql://docker:ignite@database_soujunior:5432/mentores_backend volumes: pgdata: - driver: local + driver: local \ No newline at end of file diff --git a/src/modules/mails/mail.service.ts b/src/modules/mails/mail.service.ts index dd49748..84cb7c9 100644 --- a/src/modules/mails/mail.service.ts +++ b/src/modules/mails/mail.service.ts @@ -11,7 +11,7 @@ export class MailService { async mentorSendEmailConfirmation(mentor: MentorEntity): Promise { const { email, fullName, code } = mentor; - const url = `${process.env.URL_CONFIRM_EMAIL}code=${code}&email=${email}`; + const url = `${process.env.URL_CONFIRM_EMAIL}?code=${code}&email=${email}`; await this.mailerService .sendMail({ @@ -32,9 +32,9 @@ export class MailService { const { email, fullName, code } = mentor; const { URL_CONFIRM_EMAIL } = process.env; - const url = `${URL_CONFIRM_EMAIL}code=${code}&email=${email}`; + const url = `${URL_CONFIRM_EMAIL}?code=${code}&email=${email}`; - console.log( this.mailerService) + console.log(this.mailerService); try { await this.mailerService .sendMail({ @@ -59,7 +59,7 @@ export class MailService { const { email, code } = mentorData; const { URL_RESTORATION_EMAIL } = process.env; - const url = `${URL_RESTORATION_EMAIL}code=${code}&email=${email}`; + const url = `${URL_RESTORATION_EMAIL}?code=${code}&email=${email}`; try { await this.mailerService @@ -81,7 +81,7 @@ export class MailService { async userSendEmailConfirmation(user: UserEntity): Promise { const { email, fullName, code } = user; - const url = `${process.env.URL_CONFIRM_EMAIL}code=${code}&email=${email}`; + const url = `${process.env.URL_CONFIRM_EMAIL}?code=${code}&email=${email}`; await this.mailerService .sendMail({ @@ -102,7 +102,7 @@ export class MailService { const { email, fullName, code } = user; const { URL_CONFIRM_EMAIL } = process.env; - const url = `${URL_CONFIRM_EMAIL}code=${code}&email=${email}`; + const url = `${URL_CONFIRM_EMAIL}?code=${code}&email=${email}`; try { await this.mailerService @@ -128,7 +128,7 @@ export class MailService { const { email, code } = userData; const { URL_RESTORATION_EMAIL } = process.env; - const url = `${URL_RESTORATION_EMAIL}code=${code}&email=${email}`; + const url = `${URL_RESTORATION_EMAIL}?code=${code}&email=${email}`; try { await this.mailerService