Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

larien/family-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Family tree

Project with Go and Neo4j.

Keywords


[Go, Neo4j, Clean Architecture]

Requirements


  • Docker
  • Docker-compose
  • Go >= 1.11
  • Neo4j

Installation


git clone https://github.com/larien/family-tree.git

Run application


Option 1: docker-compose [unstable]

make compose

Option 2: docker

make docker

Running tests


cd backend/tests/
go test

Usage


Add People

  • URL

    localhost:8899/api/v1/person

  • Method:

    POST

  • URL Params

    none

  • Data Params

    [
      {
        "name": "<name>",
        "parents": ["<parent>", "<parent>"],
        "children": ["<child>", "<child>"]
      }
    ]
  • Success Response:

    • Code: 201 CREATED
      Content: { "message": "People registered successfully!" }
  • Error Response:

    • Description: Invalid JSON
      Code: 401 Bad Request
      Content: { "message": "Failed to parse json" }

    • Description: Server error
      Code: 500 Internal Server Error
      Content: { "message": "Failed to register people" }

  • Sample Body:

[
  {
    "name": "Bruce",
    "parents": ["Mike", "Phoebe"]
  },
  {
    "name": "Dunny",
    "parents": ["Mike", "Phoebe"]
  }
]

Get All People

  • URL

    localhost:8899/api/v1/person

  • Method:

    GET

  • URL Params

    none

  • Data Params

    none

  • Success Response:

    • Code: 200 OK
      Content:

      [
        {
          "name": "Bruce",
          "parents": ["Mike", "Phoebe"],
          "children": null
        },
        {
          "name": "Mike",
          "parents": null,
          "children": ["Bruce", "Dunny"]
        },
        {
          "name": "Phoebe",
          "parents": null,
          "children": ["Bruce", "Dunny"]
        },
        {
          "name": "Dunny",
          "parents": ["Mike", "Phoebe"],
          "children": null
        }
      ]
    • Code: 204 No Content
      Content: { "message": "No people were found" }

  • Error Response:

    • Description: Server error
      Code: 500 Internal Server Error
      Content: { "message": "Failed to find all people" }
  • Sample Body:

    none

Get Person

  • URL

    localhost:8899/api/v1/person/name/:name

  • Method:

    GET

  • URL Params

    name: string

  • Data Params

    none

  • Success Response:

    • Code: 200 OK
      Content:

      {
        "name": "Bruce",
        "parents": ["Mike", "Phoebe"],
        "children": null
      }
    • Code: 204 No Content
      Content: { "message": "{name} wasn't found" }

  • Error Response:

    • Description: Server error
      Code: 500 Internal Server Error
      Content: { "message": "Failed to find {name}" }
  • Sample Body:

    none

Ascendancy

  • URL

    localhost:8899/api/v1/person/ascendancy/:name

  • Method:

    GET

  • URL Params

    name: string

  • Data Params

    none

  • Success Response:

    • Code: 200 OK
      Content:

      [
        {
          "name": "Bruce",
          "parents": ["Mike", "Phoebe"],
          "children": null
        },
        {
          "name": "Mike",
          "parents": ["Sonny"],
          "children": ["Bruce", "Dunny"]
        },
        {
          "name": "Dunny",
          "parents": ["Mike", "Phoebe"],
          "children": null
        }
      ]
    • Code: 204 No Content
      Content: { "message": "{name} wasn't found" }

  • Error Response:

    • Description: Server error
      Code: 500 Internal Server Error
      Content: { "message": "Failed to find {name}'s ascendancy" }
  • Sample Body:

    none

[HELPER] Clear

This is just to help while testing. It will clear every data.

  • URL

    localhost:8899/api/v1/person/clear

  • Method:

    GET

  • URL Params

    none

  • Data Params

    none

  • Success Response:

    • Code: 200 OK
      Content: { "message": Database cleared sucessfully" }
  • Error Response:

    • Description: Server error
      Code: 500 Internal Server Error
      Content: { "message": "Failed to clear database" }
  • Sample Body:

    none

About

Project with Go and Neo4j.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published