https://github.com/rafael-vasconcellos/payment-api
challenge resolution with nest js
https://github.com/rafael-vasconcellos/payment-api
api class-validator jest nest-js nestjs nodemailer prisma server-client server-side supertest
Last synced: about 1 month ago
JSON representation
challenge resolution with nest js
- Host: GitHub
- URL: https://github.com/rafael-vasconcellos/payment-api
- Owner: rafael-vasconcellos
- Created: 2024-04-04T15:29:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T20:36:47.000Z (over 1 year ago)
- Last Synced: 2025-06-12T12:50:15.354Z (9 months ago)
- Topics: api, class-validator, jest, nest-js, nestjs, nodemailer, prisma, server-client, server-side, supertest
- Language: TypeScript
- Homepage:
- Size: 143 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sobre
Resolução do [desafio](https://github.com/PicPay/picpay-desafio-backend) por um completo iniciante em backend
## API
Algumas rotas fazem uso de uma proto autenticação através do header *"Authorization"*.
```typescript
const AuthorizationHeader = {
Authorization: "email:pass"
}
```
### /api (GET)
lista as rotas
### /user
o método GET utiliza parâmetros de busca, enquanto POST e PUT utilizam o body da requisição
```typescript
// GET & PUT
interface IUserDTO {
id?: string
document?: string,
type?: "COMMON" | "MERCHANT",
name?: string,
lastname?: string,
email?: string,
pass?: string,
balance?: number
}
// POST
interface ICreateUserDTO {
document: string,
type: "COMMON" | "MERCHANT",
name: string,
email: string,
pass: string,
lastname?: string,
}
```
### /transaction
os métodos GET e DELETE utilizam parâmetros de busca, enquanto o método POST utiliza o body da requisição
```typescript
// POST
interface ICreateTransactionDTO {
sender: string
receiver: string
amount: number
}
// DELETE
interface IReverseTransactionDTO {
id: string
}
// GET
interface IGetTransactionDTO extends IGetUser {
transactionId?: string
}
```
#### Variáveis de ambiente
*HOST, PORT, USER, PASS* (credenciais do provedor de email)
## Instalação
```bash
$ npm install
```
## Executando
```bash
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
```
## Executando Testes
```bash
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
```