Giter Site home page Giter Site logo

coding-challenge-go's Introduction

Software Engineer Coding challenge

How to submit your code

  • Init git repository and commit initial code there (it is not needed to push it somewhere);
  • Create as many commits and branches as you wish;
  • Archive repository when done and send it back to us.

Install and Run

Requirements

  1. Docker/Docker Compose
  2. Git client

How to install?

The fast way to run the service is by executing "make" target from root folder of the repository:

make init

How to run?

make up

Interact with the API

Get a page of products

curl "http://localhost:8080/api/v1/products"

curl "http://localhost:8080/api/v1/products?page=2"

Get a product

curl "curl "http://localhost:8080/api/v1/product?id=8bc12dec-e2f5-11ea-b308-0242acf00a02"

Create a product

curl -X POST -d '{"name":"LED Shoes","brand":"Niko","stock":11,"seller":"8bbf3c90-e2f5-11ea-b308-0242acf00a02"}' localhost:8080/api/v1/product

Update a product

curl -X PUT -d '{"name":"Berlin S.O.L.I.D. T-Shirt","brand":"Shirts Inc.","stock":150}' "http://localhost:8080/api/v1/product?id=156c764b-f563-11e9-94e7-38baf859afa1"

Delete a product

curl -X DELETE "http://localhost:8080/api/v1/product?id=156c826e-f563-11e9-94e7-38baf859afa1"

Get list of sellers

curl "http://localhost:8080/api/v1/sellers"

Tasks to DO:

Task 1

Currently, V1 Product object in API responses has the following structure:

{
 "brand": "string",
 "name": "string",
 "seller_uuid": "string",
 "stock": 0,
 "uuid": "string"
}

Based on business requirements All Product Get endpoints should be updated to contain links on seller resources. It was decided to release the second version of the API (call it V2) with the following changes:

  • V2 Product endpoints should respond with the Product object of structure:
{
"brand": "string",
"name": "string",
"seller": {
   "uuid": "string",
   "_links": {
      "self":{
          "href":"http://localhost:8080/sellers/{seller_uuid}"
      }
   }
},
"stock": 0,
"uuid": "string"
}
  • V2 Product objects sent in requests(POST and PUT actions) should remain the same as in V1.
  • API V1 should NOT be changed for end customer (applications that implement API V1 should never break).

Task 2.

Current behaviour:

If Product Update (PUT request) changes current Stock of the products, then the seller of this product receives Email with warning.

Behaviour to implement:

If Product Update (PUT request) changes current Stock of the products, then the seller of this product receives Email and/or SMS with warning. What type of notifications should be sent to seller SHOULD be defined as an application level configuration.

IMPORTANT: Implementation of communication with 3rd party SMS providers is not needed. Instead, please create log entry with following text template:

SMS Warning sent to {seller_UUID} (Phone: {seller_Phone}): {Product_name} Product stock changed

Task 3

Behaviour to implement:

  • API V2 should contain /api/v2/sellers/top10 GET Endpoint.
  • This endpoint should return array of maximum 10 sellers ordered by count of products they have for sale (count of entries in product table) from the largest to the smallest number.

coding-challenge-go's People

Contributors

ewgra avatar

Watchers

James Cloos 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.