Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync develop #13

Merged
merged 69 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
e4607af
build: setup deploy homologation
viniciuscosmome Aug 29, 2023
556d69f
Merge pull request #3 from viniciuscosmome/build/deploy-homologation
Daaaiii Aug 29, 2023
bc42c5e
chore: changes jest root dir
viniciuscosmome Aug 29, 2023
9bf09a6
test: creates services tests
viniciuscosmome Aug 29, 2023
6c25559
build: setup husky
viniciuscosmome Aug 29, 2023
56009d3
chore(deps): includes husky
viniciuscosmome Aug 29, 2023
513ef4d
chore: uses pre-push event
viniciuscosmome Aug 29, 2023
d078f9d
Merge pull request #4 from viniciuscosmome/tests/initial-setup
Daaaiii Aug 29, 2023
7f44d65
feat(submodule): includes mail-templates submodule
viniciuscosmome Sep 2, 2023
9d92e59
chore: specify what JSX code is generated
viniciuscosmome Sep 2, 2023
f6d06a6
chore(deps): install @react-email/render and submodule dependencies
viniciuscosmome Sep 2, 2023
5a4b472
chore(deps): install resend dependencies
viniciuscosmome Sep 2, 2023
17e276a
chore(dev-deps): install ` dotenv-cli ` and ` @types-react ` packages
viniciuscosmome Sep 2, 2023
c2d5c89
feat: creates mail service
viniciuscosmome Sep 2, 2023
1fca763
docs: updates swagger documentation and example files
viniciuscosmome Sep 2, 2023
db6f0e1
chore(onerror): shows error when trying to load html
viniciuscosmome Sep 2, 2023
d75d66c
styles: variable destructuring
viniciuscosmome Sep 2, 2023
0091e88
chore(deps): install ` class-validator ` and ` class-transformer ` pa…
viniciuscosmome Sep 4, 2023
6c794f9
refactor: renames properties
viniciuscosmome Sep 4, 2023
ee3aa3c
feat: creates new account method
viniciuscosmome Sep 4, 2023
0db0c4b
chore(dev-deps): install the faker-js package to generate test values
viniciuscosmome Sep 4, 2023
e7688a8
test: creates simple tests for newAccountPropsProcessing method
viniciuscosmome Sep 4, 2023
6334342
chore: changes container name
viniciuscosmome Sep 5, 2023
5eb52c8
chore: shows the port on which the server is running
viniciuscosmome Sep 5, 2023
dfe82bd
Merge pull request #5 from viniciuscosmome/feature/email-service
Daaaiii Sep 5, 2023
02e9f08
Merge branch 'develop' of https://github.com/loryblu/loryblu-api into…
viniciuscosmome Sep 6, 2023
085da59
docs: updates description
viniciuscosmome Sep 6, 2023
40fc1ed
Merge pull request #6 from viniciuscosmome/feature/register-parent
Daaaiii Sep 6, 2023
58f46c9
build(`ci-cd`): configure testing.yml for unit tests
viniciuscosmome Sep 6, 2023
3bf4faf
docs: updates api description
viniciuscosmome Sep 6, 2023
d0960df
Merge pull request #8 from viniciuscosmome/test/ci-unit-tests
viniciuscosmome Sep 10, 2023
33ee731
chore(submodule): updates email-templates
viniciuscosmome Sep 10, 2023
dadbd87
refactor: changes file name
viniciuscosmome Sep 10, 2023
4bd1c46
chore: updates mail loader
viniciuscosmome Sep 10, 2023
9465cdf
chore: sync submodule
viniciuscosmome Sep 10, 2023
ea5ef6a
chore: updates templates
viniciuscosmome Sep 10, 2023
b8173d8
chore: updates validation messages
viniciuscosmome Sep 11, 2023
1e8f36a
chore: creates encryptData method
viniciuscosmome Sep 11, 2023
247843b
refactor: updates prisma known errors
viniciuscosmome Sep 11, 2023
e8c353f
chore: encrypt password and hash email
viniciuscosmome Sep 11, 2023
e5bb0fc
docs: add new environment variable descrition
viniciuscosmome Sep 11, 2023
8a8a6cf
chore: import bcrypt
viniciuscosmome Sep 11, 2023
2c65309
chore: updates create account expect
viniciuscosmome Sep 11, 2023
9c43f6c
chore: changes messages and examples
viniciuscosmome Sep 11, 2023
cf8a1a5
feat: creates reset password information scheme
viniciuscosmome Sep 11, 2023
eb2d810
chore: log known errors
viniciuscosmome Sep 11, 2023
4fa7674
refactor: change log type
viniciuscosmome Sep 11, 2023
449b02f
chore: includes default error
viniciuscosmome Sep 11, 2023
57dd4e0
chore: removes prismaKnownValidationErrors
viniciuscosmome Sep 11, 2023
bbbf604
chore: updates error messages
viniciuscosmome Sep 11, 2023
6ef4874
Merge pull request #9 from viniciuscosmome/chore/updates-mail-service
viniciuscosmome Sep 12, 2023
59a4326
feat: creates and saves token to reset password
viniciuscosmome Sep 12, 2023
9760d1c
Merge branch 'develop' of https://github.com/loryblu/loryblu-api into…
viniciuscosmome Sep 12, 2023
c96ec0c
chore: await send mail
viniciuscosmome Sep 12, 2023
525d4bf
feat: send link to reset password
viniciuscosmome Sep 12, 2023
3d63f9c
chore: changes description
viniciuscosmome Sep 12, 2023
040726a
test: create reset password tests
viniciuscosmome Sep 12, 2023
98bec0b
chore: changes setup
viniciuscosmome Sep 12, 2023
f6f54a2
chore: await save token
viniciuscosmome Sep 12, 2023
963f9d3
Merge pull request #10 from loryblu/LOR-116-feature-reset-password
viniciuscosmome Sep 13, 2023
7285f7d
styles: changes file name
viniciuscosmome Sep 14, 2023
ee9622b
styles: rename folders
viniciuscosmome Sep 14, 2023
87f29b2
feat: creates set password route
viniciuscosmome Sep 15, 2023
48f1f06
feat: saves the new password and deletes the old recovery token
viniciuscosmome Sep 15, 2023
5279ce1
refactor: changes the way errors are handled
viniciuscosmome Sep 15, 2023
b01b65e
refactor: move files
viniciuscosmome Sep 15, 2023
e16dc22
fix: sets 5 minutes to expires the token
viniciuscosmome Sep 15, 2023
843dfff
Merge pull request #11 from viniciuscosmome/feature/set-new-password
viniciuscosmome Sep 16, 2023
eb5c2f2
chore: update config (#12)
viniciuscosmome Sep 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
PORT=5500
NODE_ENV=development

EMAIL_HOST=[Email host name]
EMAIL_PORT=[Email port]
EMAIL_USERNAME=[Email user name]
EMAIL_PASSWORD=[Email password]
FROM_EMAIL=[Email adress]
SALT_DATA_HASH=[string]
SALT_DATA_PASS=[string]

MAIL_API_KEY=[string]
MAIL_FROM=[string]
MAIL_TEST_DELIVERED=[string]
MAIL_TEST_BOUNCED=[string]
MAIL_TEST_COMPLAINED=[string]

POSTGRES_USER=admin
POSTGRES_PASSWORD=admin
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Deploy homologation environment

on:
push:
branches:
- homologation

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Execute cURL
run: |
curl -X POST ${{ secrets.DEPLOY_HOMOLOGATION_URL }}
28 changes: 28 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run tests

on:
pull_request:
branches:
- develop
- homologation

jobs:
tests:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.JS ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install packages
run: yarn

- name: Unit tests
run: yarn test
78 changes: 39 additions & 39 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
package-lock.json
.env
*.todo
# compiled output
/dist
/node_modules
# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# OS
.DS_Store
# Tests
/coverage
/.nyc_output
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
package-lock.json
.env
*.todo

# compiled output
/dist
/node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/modules/mail/templates"]
path = src/modules/mail/templates
url = https://github.com/loryblu/email-templates.git
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
src/modules/mail/templates
141 changes: 123 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,140 @@
## Installation
# LoryBlu API

![version](https://img.shields.io/github/package-json/v/loryblu/loryblu-api?style=flat-square&labelColor=f2f2f2&color=white)
![license](https://img.shields.io/github/license/loryblu/loryblu-api?style=flat-square&labelColor=f2f2f2&color=white)
![main tool](https://img.shields.io/badge/Nest_JS-f2f2f2?logo=nestjs&logoColor=db1737&style=flat-square)
![Database](https://img.shields.io/badge/PostgreSQL-50b0f0?logo=postgresql&logoColor=f2f2f2&style=flat-square)

<details>
<summary>Descrição em <b>pt-BR</b></summary>

### Requisitos
1. [Node.js 18.x LTS](https://nodejs.org/en) Instalado.
1. [PostgreSQL](https://www.postgresql.org/) ou [docker + docker-compose](https://docs.docker.com/compose/) instalado.
1. [Resend](https://resend.com/home) Serviço de e-mail usado na aplicação.

> ⚠ Se você tem o `docker` e `docker-compose` instalados, não precisa instalar o `PostgreSQL` (banco de dados), há um arquivo configurado para usar o PostgreSQL no docker, o `docker-compose.dev.yml`

## Clone o repositório

```bash
$ yarn install
# git clone <repo-url> <dist>
git clone https://github.com/loryblu/loryblu-api.git loryblu-api
```

## Running the app
Este comando vai clonar o repositório para o destino definido. Você pode omitir o destino.

## Configurar ambiente
1. Duplique o arquivo `.env.example` do projeto principal;
1. Renomeie para `.env`;

Atualize o novo `.env` com as instruções a seguir:
```md
# Substitua os exemplos dentro dos colchetes "[Database username]" pelo valor final "root"

PORT=[Porta que o servidor expõe]
# ex: 8080

NODE_ENV=[Ambiente atual]
# ex: development

SALT_DATA_HASH=[Chave secreta para mesclar com o hash de dados sensíveis]
# ex: secret.salt.data

SALT_DATA_PASS=[Chave secreta para randomizar a senha]
# ex: 8

MAIL_API_KEY=[Chave do serviço Resend]
# ex: re_123456789

MAIL_FROM=[Email de contato da aplicação]
# ex: [email protected]

MAIL_TEST_DELIVERED=[Email para teste : sucesso]
# ex: [email protected]

MAIL_TEST_BOUNCED=[Email para teste : erro]
# ex: [email protected]

MAIL_TEST_COMPLAINED=[Email para teste : marcado como spam]
# ex: [email protected]

POSTGRES_USER=[Nome de usuário do baco de dados]
# ex: admin

POSTGRES_PASSWORD=[Senha do banco de dados]
# ex: strongPass

POSTGRES_DB=[Nome da base de dados]
# ex: loryblu-clone-api

POSTGRES_HOST=[Host do banco de dados]
# ex: localhost

POSTGRES_PORT=[Porta do banco de dados]
# ex: 5432

DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public"
# ! Este valor não precisa ser alterado, use-o como está.
```

## Instalação
### Submódulos
Depois de clonar este repositório, e se for adicionado ou atualizado um dos submódulos, execute o comando abaixo para atualizar e iniciar todos os submódulos.
```bash
# development
$ yarn run start
$ git submodule update --init --recursive
```

# watch mode
$ yarn run start:dev
### Dependências

# production mode
$ yarn run start:prod
Depois de clonar e semple que atualizar o repositório, execute o comando abaixo para manter as dependências atualizadas.
```bash
$ yarn
```

## Executando a aplicação

<details>
<summary><b>Está usando docker?</b></summary>

Use o comando abaixo para baixar a imagem do PostgreSQL:14-alpine e configurar as credenciais.
```bash
docker-compose -f docker-compose.dev.yml up -d
```

Se preferir, há um script configurado para realizar este comando e todos os outros de desenvolvimento. Ele também inicia a aplicação:
```bash
yarn docker:dev
```

## Test
</details>

---

Esse comando executa tudo o que é necessário para configurar o banco de dados de desenvolvimento.
```bash
# unit tests
$ yarn run test
$ yarn dev
```

# e2e tests
$ yarn run test:e2e
Esse comando apenas inicia a aplicação no modo de desenvolvimento.
```bash
$ yarn start:dev
```

# test coverage
$ yarn run test:cov
Esse comando inicia a aplicação no modo de produção.
```bash
$ yarn run start:prod
```

## License
## Testes

Testes unitários
```bash
$ yarn test
```

## Licença

LoryBlu tem [licença MIT](LICENSE).

Nest is [MIT licensed](LICENSE).
</details>
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
database:
image: postgres:14-alpine
container_name: postgres
container_name: loryblu-postgres
env_file:
- .env
volumes:
Expand Down
Loading
Loading