bigsonlvrocha / ilia-nodejs-challenge Goto Github PK
View Code? Open in Web Editor NEWThis project forked from aisdigital/ilia-nodejs-challenge
ília - NodeJS Challenge
License: Apache License 2.0
This project forked from aisdigital/ilia-nodejs-challenge
ília - NodeJS Challenge
License: Apache License 2.0
Must check the password for an e-mail and return true or false, jwt auth must be done in interface layer
Can only delete
Delete in a paranoid way
Must use transactions
microsservice to check if user has 0 balance - will be done in a latter card
Involves
Initial structure for service
must have:
must use 3003 port
Swagger definition
paths:
[...]
/balance:
get:
description: Esse endpoint deve retornar um consolidado das transações de CREDITO e DEBITO, fazendo o calculo do valor, de prefência que seja uma query fazendo o calculo
tags:
- Transactions
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/BalanceResponse'
'401':
$ref: '#/components/responses/UnauthorizedError'
security:
- bearerAuth: []
components:
schemas:
[...]
BalanceResponse:
type: object
properties:
amount:
type: integer
responses:
UnauthorizedError:
description: Access token is missing or invalid
The internal api must use port 3003 to be used by another
Implement reading from the database
Parameters that can be passed:
Implement a class that represents a transaction
The transaction must implement the following fields:
Initial structure for service
must have:
Implement reading the consolidation of the user's balance, try to use calculation bia database
Parameters:
Implement database creation of transaction
The document must implement the following fields
Implementação swagger:
paths:
/transactions:
[...]
get:
tags:
- Transactions
security:
- bearerAuth: []
parameters:
- in: query
name: type
schema:
type: string
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/TransactionsModel'
'401':
$ref: '#/components/responses/UnauthorizedError'
[...]
components:
schemas:
[...]
TransactionsModel:
type: object
required:
- user_id
- type
- amount
properties:
id:
type: string
user_id:
type: string
amount:
type: integer
type:
type: string
enum:
- CREDIT
- DEBIT
[...]
since listing user is open for everyone, so should be single user read
The app must listen in port 3002
swagger definition
paths:
/users/:id:
get:
tags:
- Users
security:
- bearerAuth: []
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UsersResponse'
'401':
$ref: '#/components/responses/UnauthorizedError'
Implement a docker compose configuration that will setup
Important: the network of the service must be ilia_code_challenge
to allow connection between the services
/auth:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AuthRequest'
tags:
- Auth
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/AuthResponse'
description: Response
'401':
$ref: '#/components/responses/UnauthorizedError'
Implement module that introduces and index file for running the app
User must have fields
New users must be created via an auth domain service, so plain text password will not be stored in this entity
Swagger definition:
paths:
# Users
/users:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserRequest'
tags:
- Users
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UsersResponse'
description: Response
'401':
$ref: '#/components/responses/UnauthorizedError'
Must be able to update fields
Must allow to update only the logged in user
Swagger definition:
paths:
/users/:id:
patch:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserRequest'
tags:
- Users
security:
- bearerAuth: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UsersResponse'
description: Response
'401':
$ref: '#/components/responses/UnauthorizedError'
Implement and test interface of POST /transactions
Swagger definition
[...]
paths:
# Transactions
/transactions:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Transactions'
tags:
- Transactions
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/TransactionsModel'
description: Response
'401':
$ref: '#/components/responses/UnauthorizedError'
security:
- bearerAuth: []
[...]
components:
schemas:
Transactions:
type: object
required:
- user_id
- type
- amount
properties:
user_id:
type: string
amount:
type: integer
type:
type: string
enum:
- CREDIT
- DEBIT
TransactionsModel:
type: object
required:
- user_id
- type
- amount
properties:
id:
type: string
user_id:
type: string
amount:
type: integer
type:
type: string
enum:
- CREDIT
- DEBIT
securitySchemes:
bearerAuth: # arbitrary name for the security scheme
type: http
scheme: bearer
bearerFormat: JWT
responses:
UnauthorizedError:
description: Access token is missing or invalid
Implement with docker or docker-compose for caching depedencies
The pipeline will
Implement the db persistency of users entity
User must have the fields:
Beware that password must be stored encrypted
Must have:
Must return all users
delete:
tags:
- Users
security:
- bearerAuth: []
responses:
200:
description: OK
'401':
$ref: '#/components/responses/UnauthorizedError'
Swagger definition
paths:
# Users
/users:
get:
tags:
- Users
security:
- bearerAuth: []
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/UsersResponse'
'401':
$ref: '#/components/responses/UnauthorizedError'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.