From e4960bb4c76faf3295260194d54b4a1be6f746b1 Mon Sep 17 00:00:00 2001
From: Wendeson <82889172+wendesongomes@users.noreply.github.com>
Date: Wed, 15 May 2024 19:04:49 -0300
Subject: [PATCH 1/2] Update README.md
---
README.md | 103 +++++++++++++++++++++++++++---------------------------
1 file changed, 51 insertions(+), 52 deletions(-)
diff --git a/README.md b/README.md
index 00a13b1..477f491 100644
--- a/README.md
+++ b/README.md
@@ -1,73 +1,72 @@
-
-
-
-
-[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.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## 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:
+
+
+
+Veja a parte de Integration e clique em Show Credentials, vai precisar do Host, Port, Username e Password.
+
+
+
+
+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)
+
-## License
-Nest is [MIT licensed](LICENSE).
+troque para false, com isso o mailtrap vai capturar seus emails normalmente.
From 8728ed4c615ec07c5401f9e670cfa08fda002e55 Mon Sep 17 00:00:00 2001
From: wendesongomes
Date: Wed, 15 May 2024 19:36:02 -0300
Subject: [PATCH 2/2] fix: corrigido o database_url do docker-compose, colocado
o ? que estava faltando nas url
---
.env.example | 12 ++++++++++--
docker-compose.yml | 9 ++++-----
src/modules/mails/mail.service.ts | 14 +++++++-------
3 files changed, 21 insertions(+), 14 deletions(-)
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/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