GithubHelp home page GithubHelp logo

netronix_test_task's Introduction

GeoTracker

Geo-based tasks tracker

Build an API to work with geo-based tasks. Use Elixir and PostgreSQL (recommended). All API endpoints should work with json body (not form-data). The result should be available as Github repo with commit history and the code covered by tests. Please commit the significant step to git, and we want to see how you evolved the source code.

Each request needs to be authorized by token. You can use pre-defined tokens stored on the backend side. Operate with tokens for two types of users:

Manager
Driver

Create tokens for more drivers and managers, not just 1-1.

Each task can be in 3 states:

New (Created task)
Assigned (The driver has picked this task)
Done (Task marked as completed by the driver)

Access

Manager can create tasks with two geo locations pickup and delivery
Driver can get the list of tasks nearby (sorted by distance) by sending his current location
Driver can change the status of the task (to assigned/done).
Drivers can't create/delete tasks.
Managers can't change task status.

Workflow:

The manager creates a task with location pickup [lat1, long1] and delivery [lat2,long2]
The driver gets the list of the nearest tasks by submitting current location [lat, long]
Driver picks one task from the list (the task becomes assigned)
Driver finishes the task (becomes done)

How to start?

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.setup
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

netronix_test_task's People

Contributors

ihorkatkov avatar

Watchers

 avatar

netronix_test_task's Issues

Create User schema

  • Create User schema
  • Add roles field with values [:driver, :manager]
  • Add :api_key field
  • Create migration and fulfill api_key field with random values
  • Create seed data for users

Create Task schema

Create Task schema with the following fields:

field :pickup_location, :geometry
field :dropoff_location, :geometry
field :status, :string

Definition of done:

  • Task schema is created
  • It should have above fields
  • Status field should have a validation which checks that a status is in [:new, :assgined, :done]
  • Task schema should have transition validation :new -> :assigned -> :done and only in that order

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.