Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jvitosousa committed Feb 15, 2023
0 parents commit 23e0b6d
Show file tree
Hide file tree
Showing 102 changed files with 12,048 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
paclage-lock.json
```
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js',],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:14.15.4-alpine3.12

RUN npm install -g @nestjs/cli@8.0.0

USER node

WORKDIR /home/node/app

COPY . .

USER root

RUN npm install

RUN chmod +x /home/node/app/init.sh

USER node

ENTRYPOINT [ "sh", "./init.sh" ]
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
</p>

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

<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->

## Description

[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.

## Installation

```bash
$ npm install
```

## Running the app

```bash
[Docker]
===================================
# 1
docker system prune -a

# 2
$ docker network create teste_onfly

# 3
$ docker-compose up --build

# 4
docker exec -it onfly_teste sh

# 5
npx typeorm-ts-node-commonjs migration:run -d src/infrastructure/config/typeorm/typeorm.config.ts
===================================
```

## Test

```bash
# to run tests usecases
$ npm run test

[PLEASE RUN IN DOCKER]
======================
# first
$ docker exec -it onfly_teste sh

# to run full tests
$ npm run test:e2e

# to run full tests coverage
$ npm run test:e2e:cov
========================
# test coverage
$ npm run test:cov
```

## Swagger
````
# url
http://localhost:3000/api#
````

## Support

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).

## Stay in touch

- Author - [Jose Vitor](jvitosousa@gmail.com)


## License

Nest is [MIT licensed](LICENSE).
38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'

services:
api:
container_name: onfly_teste
build: '.'
volumes:
- .:/home/node/app
- /home/node/app/node_modules
environment:
NODE_ENV: local
depends_on:
- postgres
ports:
- '3000:3000'
- '9229:9229'

postgres:
container_name: db_onfly
image: postgres:11
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: db_onfly
ports:
- '5432:5432'
volumes:
- ../postgres-data:/var/lib/postgresql/data

volumes:
postgres-data:


networks:
default:
external:
name: teste_onfly
11 changes: 11 additions & 0 deletions env/local.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DB_HOST=db_onfly
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=db_onfly
DB_SCHEMA=public
JWT_SECRET=123456
JWT_EXPIRATION_TIME=3600
AWS_ACCESS_KEY_ID=AKIAQIOTEB6CGMVK2SZA
AWS_SECRET_ACCESS_KEY=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
AWS_REGION=us-east-1
11 changes: 11 additions & 0 deletions env/teste.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=db_onfly
DB_SCHEMA=public
JWT_SECRET=123456
JWT_EXPIRATION_TIME=3600
AWS_ACCESS_KEY_ID=AKIAQIOTEB6CGMVK2SZA
AWS_SECRET_ACCESS_KEY=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
AWS_REGION=us-east-1
6 changes: 6 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
npm install

npm run start:dev

npx typeorm-ts-node-commonjs migration:run -d src/infrastructure/config/typeorm/typeorm.config.ts
10 changes: 10 additions & 0 deletions jest-e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"coverageDirectory": "./coverage-e2e"
}
8 changes: 8 additions & 0 deletions nest-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true
}
}
Loading

0 comments on commit 23e0b6d

Please sign in to comment.