Coder Social home page Coder Social logo

test-drivers's Introduction

Drivers API

This is a technical test for the hiring process of a backend developer position.

Challenge information

Context

We have a website on the Internet and we would like to get some very simple indication of how visitors navigate the pages. For that purpose, we managed to configure our website to send an event every time a visitor navigates to a page. Our website is capable of generating unique identifiers for visitors as a string of characters. The system generating that event is able to talk to a REST HTTP interface and represents each individual event as a JSON document containing two attributes: the unique identifier of the visitor and the URL of the visited page. Our product team is starting a new sprint. We are picking the following user story: As a digital marketeer, I need to know how many distinct visitors navigated to a page, knowing its URL.

Task

Build a GoLang web service capable of:

  • Ingesting user navigation JSON events via a REST HTTP endpoint. Each event is to be ingested via a separate HTTP request (i.e. no batch and no streaming ingestion).
  • Serving the number of distinct visitors for any given page via another REST HTTP endpoint. The page URL we are interested in should be a query parameter of the HTTP request. The number of distinct visitors for that URL is returned in a JSON object.

Constraints

  • There is no need for persistence to a database. Everything can be kept in memory.
  • The web service must be capable of handling concurrent requests on both endpoints.
  • Don't solve the data access concurrency problem using an external library

Description

The API is used by a merchandise service company that is delivered by drivers. This API allows you to enter as an administrator, manage the ABM of the drivers and see a list of them.

See more details about requirements.

Endpoints

POST /drivers

Saves driver.

Needs authentication and save-users permission (as default in admin profile).

Body:

{
  Username: string, required
  Password: string, required
  Name: string, required
  Surname: string, required
  DNI: string, required
}

Returns

Status 200: driver saved Status 400: bad request Status 403: user unauthorized Status 409: username is already used Status 500: internal server error

GET /drivers?page=[page]

Gets driver by pagination.

Needs authentication and get-users permission (as default in admin profile).

Query params

  • page: number, required

Returns

Array of:

{
  Username: string
  Name: string
  Surname: string
  DNI: string
}

Status 200: processed ok Status 400: bad request Status 403: user unauthorized Status 500: internal server error

GET /drivers/non-travelling

Gets non travelling drivers.

Needs authentication and get-users permission (as default in admin profile).

Returns

Array of:

{
  Username: string
  Name: string
  Surname: string
  DNI: string
}

Status 200: processed ok Status 400: bad request Status 403: user unauthorized Status 500: internal server error

POST /login

Login with profile.

Body:

{
  Username: string, required
  Password: string, required
  Profile: string, required
}

Possible profiles:

  • admin
  • driver

Returns

Status 200: logged ok

test-drivers's People

Contributors

kvothe838 avatar

Watchers

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