Skip to content

iguess-app/IGuess-API-Guess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

IGuess-API-Guess

API Microservice responsible by match prediction and users leagues

GuessLine

Everything that linked with predictions.

GuessLeague

About the users leagues.

MongoDB

The Guess Microservice have a user to guessDB Read and Write and to the holiDB read-only

Stack

  • Node.js v8.x.x // NPM v5.X
  • MongoDB v3.4
  • Redis v3.2.6

Pre-established pattern

  • Env variables are always called at config, with Capitalize and Underscore
  • Enums are used with Capitalize
  • The function are accessed by module.exports, there are no dependency injection
  • The file index.js is a pattern to export file
  • There are no console.log or console.error, all console used is from Pino, a NPM installed
  • The requires libs and variables at top file mandatorily need to follow the sequence: NPM modules, localFiles, Global Variables, Variables
  • To all tests that is IO (InputOutput) tests, you must comment a description about the IO, like if a document need to exist in a DB
  • To all IO tests, at test name it necessary to put [IO] at prefix
  • Always that possible date/hour treatment should be coded at coincident dateManager

Language

All functions and variables need to be in English

Folder layers responsibilities

Routes

Responsible to declare Routes, with Rest Verb, url path, call the schemas and handler the request

Schema

Responsible to fix a schema pattern to response/request/headers. All route need to have schemas.

Controller

Responsible to response the request, error or success

ServiceΒΉ

Responsible to treat clientErrors, cache logic, some bussiness Rule, multiple repositories logic

Routines

Responsible fire events to get from Holi the championships, matchDays and matchDays results

ModelsΒ²

Responsible to declare a collection pattern, indexes, requireds fields

Repositories

Responsible by external connections, HTTP, SOAP, GraphQL, SQL, noSQL, etc.

  1. Anemic Models need to be avoided, it is possible elimine this layers if necessary
  2. There are a Schema for each Collection at MongoDB

Folders structure

app.js
src
  β”œβ”€β”€ routes
  β”‚   β”œβ”€β”€ login
  β”‚   β”‚   β”œβ”€β”€ index.js
  β”‚   β”‚   β”œβ”€β”€ signUpRoutes.js
  β”‚   β”‚   β”œβ”€β”€ signInRoutes.js
  |   |   β”œβ”€β”€ schemas.js
  |   |   |   β”œβ”€β”€ signUpSchemas.js
  |   |   |   β”œβ”€β”€ signInSchemas.js
  β”‚   β”œβ”€β”€ availability
  β”‚   β”‚   β”œβ”€β”€ index.js
  β”‚   β”‚   β”œβ”€β”€ userNameAvailabilityRoutes.js
  |   |   β”œβ”€β”€ schemas.js
  |   |   |   β”œβ”€β”€ userNameAvailabilitySchemas.js
  β”œβ”€β”€ controllers
  β”‚   β”œβ”€β”€ login  
  β”‚   β”‚   β”œβ”€β”€ signUpController.js
  β”‚   β”‚   β”œβ”€β”€ signInController.js
  β”‚   β”œβ”€β”€ availability
  β”‚   β”‚   β”œβ”€β”€ userNameAvailabilityController.js
  β”œβ”€β”€ services
  β”‚   β”œβ”€β”€ login  
  β”‚   β”‚   β”œβ”€β”€ signUpService.js
  β”‚   β”‚   β”œβ”€β”€ signInService.js
  β”‚   β”œβ”€β”€ availability
  β”‚   β”‚   β”œβ”€β”€ userNameAvailabilityService.js
  β”œβ”€β”€ routines
  β”‚   β”œβ”€β”€ updatePontuationRoutine  
  β”‚   β”‚   β”œβ”€β”€ cronTime.js
  β”‚   β”‚   β”œβ”€β”€ updateGuessLinesPredictionsPontuationsRoutine.js
  β”‚   β”‚   β”œβ”€β”€ functions
  β”œβ”€β”€ models  
  β”‚   β”œβ”€β”€ profileModel.js
  β”‚   β”œβ”€β”€ optionsModel.js
  β”œβ”€β”€ repositories
  β”‚   β”œβ”€β”€ login
  β”‚   β”‚   β”œβ”€β”€ signUpRepository.js
  β”‚   β”‚   β”œβ”€β”€ signInRepository.js
  β”‚   β”œβ”€β”€ availability
  β”‚   β”‚   β”œβ”€β”€ userNameAvailabilityRepository.js
test
  β”œβ”€β”€ (TODO: terminar readMe )

About

🎰 Prediction/Leagues Manager Microservice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published