Skip to content

victorabarros/fpso-equipment-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FPSO equipment manager

Maintainability Go Report Card MIT Licensed

Description

goal

The assignment involves creating a backend to manage different equipment of an FPSO (Floating Production, Storage and Offloading). This system will be used for other applications in the organization and we should have APIs with the appropriate HTTP request methods to be able to reuse them. The data should be stored in the database (you can use in-memory database).

functionalities

  • Registering a vessel. The vessel data input is its code, which can’t be repeated (return the HTTP code appropriate and an error message if the user tries to register a existing code). For instance, a valid input of a vessel is: “code”: “MV102”.
  • Registering a new equipment in a vessel. The data inputs of each equipment are name, code, location and status. Each equipment is associated to a given vessel and has a unique code, which can’t be repeated (return the HTTP code appropriate and an error message if the user tries to register a existing code). For each new equipment registered, the equipment status is automatically active. For instance, a valid input of a new equipment related to a vessel “MV102” is:
    {
        "name": "compressor",
        "code": "5310B9D7",
        "location": "Brazil"
    }
  • Setting an equipment’s status to inactive. The input data should be one or a list of equipment code.
  • Returning all active equipment of a vessel

evaluate

  • Best practices on how you design your solution
  • Unit tests are mandatory
  • Software engineering principles: API design, separation of concerns and modularity

Development

Programming languange choice

To improve a better performance and explore the native tools, I choose Golang. It's a language getting more space on market, simple writenning and fast. To improve the infrastructure and make a easy scalability the development was made with Docker.

Requirements

Endpoints

Method Route Description
GET /healthz liveness probe
GET /healthy readness probe
POST /vessel insert vessel
GET /vessel/{code} list equipments by vessel
POST /vessel/{code}/equipment insert single equipment
POST /vessel/{code}/equipments insert list of equipments
DELETE /equipemnt/{code} inactive equipemnt

More details about payloads are at the collection

How to Run

Write .env file based on .env.example and execute:

make build
make run

Tests

To see the html coverage c.out, execute:

make test-coverage

To see .log , execute:

make test-log

output tests-summ.log

coverage: 100.0% of statements
ok  	github.com/victorabarros/fpso-equipment-manager/app/server	0.085s	coverage: 100.0% of statements
coverage: 83.3% of statements
ok  	github.com/victorabarros/fpso-equipment-manager/internal/config	0.031s	coverage: 83.3% of statements

About

manage different equipment of an FPSO

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published