Skip to content

firdasafridi/parkinglot

Repository files navigation

Parking Lot

Parking Lot is sample boilerplate usecase for workshop tokopedia academy.

Configuration & Dependency

How to run the project

Initial config docker env configuration

# Copy the config env
parkinglot$ cp .env.sample .env

# Change password default mysql root on .env
MYSQL_ROOT_PASSWORD=sample

# Run docker for installation
docker-compose up

Initial config docker env configuration

# Copy the config env
parkinglot/files/etc/parkinglot$ cp parkinglot.development.yaml.sample parkinglot.development.yaml

# Change the config parkinglot.development.yaml
version: "0.0.1"

server: 
  name: "parkinglot"
  http: 
    address: ":8080"
    write_timeout: 1
    read_timeout: 2
    max_header_bytes: 500000
    enable: true


database:
  testing: true
  dsn: "root:sample@tcp(127.0.0.1:3306)/test_parking_lot?charset=utf8mb4&parseTime=True&loc=Local"
  max_conns: 15
  max_idle_conns: 5
  max_retry: 5

new_relic:
  app_name: "Parking Lot"
  secret: "this_secret_generated" #generated from one.newrelic.com
  
# Change the config newrelic-infra.yml
license_key: this_secret_generated #generated from one.newrelic.com

Running golang apps

parkinglot$ make app

The endpoint list

Get Parking List

{
    "data": [
        {
            "plat_no": "DA123DEF",
            "slot_number": 1,
            "registration_date": "2022-03-12T01:49:41+08:00"
        }
    ]
}

Get Nearest Empty Parking Spot

{
    "data": 1
}

Get Parking location by Plat Number

{
    "data": 11
}

Get Parking History by Date

{
  "data": [
    {
      "history_id": 1321,
      "plat_no": "O135509SOU",
      "slot_number": 983,
      "registration_date": "2020-01-01T22:56:27Z"
    },
    {
      "history_id": 1706,
      "plat_no": "N922759HQR",
      "slot_number": 941,
      "registration_date": "2020-01-01T18:54:55Z"
    }ß
  ]
}

Get Report Number of Vehicles ßPer Day

{
  "data": {
    "total_days": 367,
    "reports": [
      {
        "date": "2020-01-01",
        "total_vehicle": 113
      },
      {
        "date": "2020-01-02",
        "total_vehicle": 303
      }
  }
}

Get Country Information (Upstream)

{
  "data": [
    {
      "name": {
        "common": "Indonesia",
        "official": "Republic of Indonesia",
        "nativeName": {
          "ind": {
            "official": "Republik Indonesia",
            "common": "Indonesia"
          }
        }
      },
      "tld": [
        ".id"
      ],
      "cca2": "ID",
      "ccn3": "360",
      "cca3": "IDN",
      "cioc": "INA",
      "independent": true,
      "status": "officially-assigned",
      "unMember": true,
    }
  ]
}

About

Sample workshop parking lot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages