GithubHelp home page GithubHelp logo

arlus / location_service Goto Github PK

View Code? Open in Web Editor NEW

This project forked from christianotieno/location_service

0.0 1.0 0.0 109 KB

Microservice to manage addresses

License: Other

Dockerfile 0.50% Shell 5.79% Python 93.71%

location_service's Introduction

+++ title = "Location service (Django)" api_url = "marketplace/location-service" +++

Location service (Django)

Summary

The location service enables your application to store and group international addresses. It exposes the SiteProfile model with a flexible schema for location data and the ProfileType model to classify the SiteProfiles.

REST data models

SiteProfile

A SiteProfile is a representation of a location. It has the following properties:

  • uuid: UUID of the SiteProfile.
  • name: Name of the SiteProfile.
  • organization_uuid: UUID of the organization that has access to the SiteProfile.
  • profiletype: UUID of the related ProfileType of the SiteProfile.
  • address_line1: First address line of the SiteProfile, like street and number.
  • address_line2: Second address line of the SiteProfile.
  • address_line3: Third address line of the SiteProfile.
  • address_line4: Fourth address line of the SiteProfile.
  • postcode: Postal code of the SiteProfile.
  • city: City of the SiteProfile.
  • country: Country of the SiteProfile as a two-char ISO code.
  • administrative_level1: Administrative division (First level).
  • administrative_level2: Administrative division (Second level).
  • administrative_level3: Administrative division (Third level).
  • administrative_level4: Administrative division (Fourth level).
  • latitude: Latitude (decimal coordinates).
  • longitude: Longitude (decimal coordinates).
  • notes: Textual notes for the SiteProfile.
  • create_date: Timestamp when the SiteProfile was created (set automatically).
  • edit_date: Timestamp, when the SiteProfile was last modified (set automatically).
  • workflowlevel2_uuid: UUID of the related WorkflowLevel2.

Endpoints

  • GET /siteprofiles/: Retrieves a list of SiteProfiles.
  • POST /siteprofiles/: Creates a new SiteProfile.
  • GET /siteprofiles/{uuid}/: Retrieves a SiteProfile by its UUID.
  • PUT /siteprofiles/{uuid}/: Updates the SiteProfile with the given UUID (all fields).
  • PATCH /siteprofiles/{uuid}/: Updates the SiteProfile with the given UUID (only specified fields).
  • DELETE /siteprofiles/{uuid}/: Deletes the SiteProfile with the given UUID.

ProfileType

A ProfileType helps grouping SiteProfiles together. It has the following properties:

  • name: Name of the ProfileType.
  • organization_uuid: ID of the organization that has access to the ProfileType.
  • create_date: Timestamp when the SiteProfile was created (automatically set).
  • edit_date: Timestamp when the SiteProfile was last modified (automatically set).

Endpoints

  • GET /profiletypes/: Retrieves a list of ProfileTypes.
  • POST /profiletypes/: Creates a new ProfileType.
  • GET /profiletypes/{id}/: Retrieves a ProfileType by its ID.
  • PUT /profiletypes/{id}/: Updates the ProfileType with the given ID (all fields).
  • PATCH /profiletypes/{id}/: Updates the ProfileType with the given ID (only specified fields).
  • DELETE /profiletypes/{id}/: Deletes the ProfileType with the given ID.

Click here for the full API documentation.

Local development

Prerequisites

You must have Docker installed.

Build & run service locally

Build the Docker image:

docker-compose build

Run a web server with this service:

docker-compose up

Now, open your browser and go to http://localhost:8004.

For the admin panel, go to http://localhost:8004/admin (user: admin, password: admin).

The local API documentation can be consulted in http://localhost:8004/docs.

Run tests

To run the tests once:

docker-compose run --rm --entrypoint 'bash scripts/run-tests.sh' location_service

To run the tests and leave bash open inside the container so that it's possible to re-run the tests faster again using bash scripts/run-tests.sh [--keepdb]:

docker-compose run --rm --entrypoint 'bash scripts/run-tests.sh --bash-on-finish' location_service

To run bash:

docker-compose run --rm --entrypoint 'bash' location_service

If you would like to clean the database and start the application, do:

docker-compose up --renew-anon-volumes --force-recreate --build

API documentation (Swagger)

Click here to go to the full API documentation.

License

Copyright ©2019 Humanitec GmbH.

This code is released under the Humanitec Affero GPL.

location_service's People

Contributors

docktorrr avatar jefmoura avatar lemkeb avatar ralfzen avatar sasgokhan avatar ybekdemir 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.