Giter VIP home page Giter VIP logo

dealer-api's Introduction

Dealer REST API

Tools

  • Laravel 8
  • PHP 8
  • MongoDB 4.2

Prasyarat Instalasi

  1. Anda wajib memiliki PHP package mongodb. Jika tidak memiliki, silahkan download file dll di link berikut
  2. Ekstrak file php_mongodb.dll ke dalam folder path/to/php/ext milik anda
  3. Buka file php.ini dan tambahkan tulisan extension=mongodb

Petunjuk Instalasi

  1. Buka command-prompt
  2. Clone project dealer-api ini dengan perintah git clone https://github.com/siannas/dealer-api.git
  3. Masuk ke dalam folder cd .\dealer-api\
  4. Jalankan perintah copy .\.env.example .env untuk menyalin .env file
  5. Dalam file .env, ubahlah DB_URI & DB_DATABASE sesuai koneksi MongoDB anda
  6. Jalankan perintah composer install
  7. Impor semua data dengan perintah php artisan db:seed
  8. php artisan serve untuk menjalankan server pengembangan

Testing Fitur

Testing terdiri dari uji fitur pada API endpoint /api/login, /api/stok, /api/penjualan, dan /api/laporan. Jalankan perintah composer test untuk mengujinya.

Screenshot of testing result
Screenshot of testing result

Petunjuk Penggunaan

  1. Fitur Login

    POST /api/login (Melakukan Autentikansi)
    Parameters

    None

    Data-Raw
    name data type example description
    email string "[email protected]" Gunakan email ini sebagai default
    password string "admin" Password default dari email [email protected]
    Responses
    http code content-type response
    200 application/json {"success": true, "user":{...}, "token":"my-token"}
    Example cURL
      curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" --data-raw @post.json http://localhost:8000/api/login
    Screenshot
    Screenshot of login
    Login using Postman
  2. Data Stok Kendaraan

    GET /api/stok?token={token} (Mendapatkan data stok kendaraan belum terjual)
    Parameters
    name type data type description
    token required string Token yang didapatkan saat login
    Responses
    http code content-type response
    200 application/json {"total": 10, "mobil": {"count": 3, "data": [...], "motor": {"count": 3, "data": [...]} }
    401 application/json {"message":"Unauthenticated."}
    Example cURL
      curl -X GET -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8000/api/stok?token=my-token
    Screenshot
    Screenshot of Cek Stok
    Checking Vehicles on sale using Postman
    Screenshot of Cek Stok
    Checking Vehicles on Browser
  3. Data Penjualan Kendaraan

    GET /api/penjualan?token={token} (Mendapatkan data kendaraan yang telah terjual)
    Parameters
    name type data type description
    token required string Token yang didapatkan saat login
    Responses
    http code content-type response
    200 application/json {"total": 10, "total revenue": 999999, "mobil": {"count": 3, "revenue": 999, "penjualan": [...], "motor": {"count": 3, "revenue": 999, "penjualan": [...]} }
    401 application/json {"message":"Unauthenticated."}
    Example cURL
      curl -X GET -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8000/api/penjualan?token=my-token
    Screenshot
    Screenshot of Cek Stok
    Retrieve Sold Vehicles Data using Postman
    Screenshot of Cek Stok
    Retrieve Sold Vehicles Data on Browser
  4. Data Laporan Penjualan per Kendaraan

    GET /api/laporan?token={token} (Mendapatkan Laporan Penjualan per Kendaraan)
    Parameters
    name type data type description
    token required string Token yang didapatkan saat login
    Data-Raw
    name data type example description
    dateStart string "2023-03-01" Tanggal awal laporan yang diinginkan
    dateDiff integer 7 Rentang hari pengelompokan laporan penjualan, jika 7 artinya pengelompokkan perpekan
    tipeKendaraan array [1] Tipe kendaraan yang ingin diambil laporannya, [1] artinya motor, [2] artinya mobil, jika [1,2] artinya keduanya
    Responses
    http code content-type response
    200 application/json {{"total": 10, "total revenue": 999999, "detil": [...{"count":2, "date start": "2023-03-01", "date end": "2023-03-07", "revenue": 999, "penjualan":[...]}] }
    401 application/json {"message":"Unauthenticated."}
    Example cURL
      curl -X GET -H "Content-Type: application/json" -H "Accept: application/json" --data-raw @get.json http://localhost:8000/api/laporan?token=my-token
    Screenshot
    Screenshot of Cek Stok
    Sale Report using Postman
    Screenshot of Cek Stok
    Sale Report on Browser

dealer-api's People

Contributors

siannas avatar

Watchers

Kostas Georgiou 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.