Giter Club home page Giter Club logo

faceit-users's Introduction

Test task: web-service to CRUD users

Local run

Please make sure you have Docker installed on your system.

docker -v

The best way to start testing of the service locally is to use docker-compose.
Please make sure the port 8080 is not allocated by any other service/daemon/application before running commands listed below.
To start the service and its dependencies you need to run:

make integration-env-up

it will:

  1. create container of the PostgreSQL database and setup fresh schema in it.
  2. create image of the faceit-users service and start it.

The service should be ready for use after a couple of seconds. You can check if it is ready by running:

make integration-env-ready

Once the service is ready you could try to check some basic info about it:

curl localhost:8080/-/version

To create a user please run:

curl -v -H 'Content-type: application/json' \
    -d '{"first_name": "fn", "last_name":"ln", "nickname":"nn", "email":"[email protected]", "password": "password", "country":"XX"}' \
    localhost:8080/users

To get a user:

curl -v localhost:8080/<Location>

where is the value returned in Location header of the previous operation result without leading slash.

To change a user:

curl -v -H 'Content-type: application/json' \
    -X PUT \
     -d '{"first_name": "fnn", "last_name":"lnn", "nickname":"nnn", "email":"[email protected]", "country":"XY"}' \
    localhost:8080/<Location>

And finally to remove the user:

curl -v -X DELETE localhost:8080/<Location>

TODO: List users based on the filtration request.

The flow described above is also available as an integration test that could be run by the command:

make integration-test

NOTE: it may fail if user is already present in the database.

Not covered:

  • listing of user entities with filtering
  • no notifications send on the user update events
  • no automatic migration of database schema
  • no metrics exported
  • no proper README.md file with listing of configuration settings supported
  • no OpenAPI specification of the endpoints
  • the lack of test for functionality (especially for the storage package)
  • caching of the user information to reduce the load on the database
  • authorization and authentication of incoming requests
  • support of the feature flags
  • dynamic change of the logging level for certain endpoints to get better visibility in usgent cases
  • client lib for the service that could improve integration with it
  • hardcoded configuration values in the code
  • ... etc.

faceit-users's People

Contributors

pavelmemory avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.