Git Product home page Git Product logo

penjualan-kendaraan's Introduction

Panduan Instalasi Proyek Penjualan Kendaraan REST API Laravel

Proyek Penjualan Kendaraan REST API Laravel adalah sebuah aplikasi berbasis Laravel yang menyediakan API untuk mengelola penjualan kendaraan.

Daftar Isi

Prasyarat

Sebelum memulai instalasi, pastikan Anda telah memenuhi prasyarat berikut:

  1. PHP v8.0
  2. Composer
  3. MongoDB v4.2
  4. Git

Langkah-langkah Instalasi

Berikut adalah langkah-langkah untuk menginstal proyek Penjualan Kendaraan REST API Laravel:

  1. Clone Repositori

    Buka terminal atau command prompt dan jalankan perintah berikut untuk mengkloning repositori:

    git clone https://github.com/shofistwn/penjualan-kendaraan.git
  2. Pindah ke Direktori Proyek

    Masuk ke direktori proyek yang telah di-kloning dengan menjalankan perintah:

    cd penjualan-kendaraan
  3. Instal Dependensi

    Jalankan perintah berikut untuk menginstal semua dependensi yang diperlukan oleh proyek:

    composer install
  4. Konfigurasi Lingkungan

    Salin file .env.example menjadi .env dengan menjalankan perintah:

    cp .env.example .env
  5. Generate Kunci Aplikasi

    Jalankan perintah berikut untuk menghasilkan kunci aplikasi:

    php artisan key:generate
  6. Konfigurasi Database

    Buka file .env dan ubah pengaturan database seperti berikut:

     DB_CONNECTION=mongodb
     DB_HOST=127.0.0.1
     DB_PORT=27017
     DB_DATABASE=penjualan_kendaraan
     DB_USERNAME=
     DB_PASSWORD=
  7. Mengimpor Database

    Import file database yang berada di /documents/database/penjualan_kendaraan.agz

  8. Mengimpor Collection Postman

    Import file collection yang berada di /documents/postman/penjualan-kendaraan.postman_collection.json

  9. Jalankan Server Lokal

    Terakhir, jalankan server lokal dengan perintah:

    php artisan serve

    Server akan berjalan di http://localhost:8000.

Dokumentasi API

Berikut adalah dokumentasi API yang tersedia dalam proyek ini.

Autentikasi

  1. Register

    Request:

    POST /api/v1/auth/register
    
    Body:
    {
        "name" : "John Doe"
        "email": "[email protected]",
        "password": "password"
    }

    Response:

    {
        "success": true,
        "message": "Pendaftaran berhasil",
        "data": {
            "_id": "647949443cac74567d0f4919",
            "email": "[email protected]",
            "name": "John Doe",
            "password": "$2y$10$W0ttWIhBPd5ULcwWkV6eM..."
        }
    }
  2. Login

    Request:

    POST /api/v1/auth/login
    
    Header:
    Authorization: Bearer <JWT Token>
    
    Body:
    {
        "email": "[email protected]",
        "password": "password"
    }

    Response:

    {
        "success": true,
        "message": "Login berhasil",
        "data": {
            "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ...",
            "token_type": "bearer",
            "expires_in": 3600
        }
    }
  3. Logout

    Request:

    POST /api/v1/auth/login
    
    Header:
    Authorization: Bearer <JWT Token>

    Response:

    {
        "success": true,
        "message": "Logout berhasil",
        "data": []
    }

Kendaraan

  1. Mengambil Stok Kendaraan

    Request:

    POST /api/v1/vehicles/stock
    
    Header:
    Authorization: Bearer <JWT Token>

    Response:

    {
        "success": true,
        "message": "Dapatkan stok kendaraan",
        "data": [
            {
                "_id": "64788d11904ea19c110f2425",
                "harga": "25000000",
                "motor": {
                    "mesin": "150cc",
                    "tipe_suspensi": "Telescopic",
                    "tipe_transmisi": "Manual"
                },
                "tahun_keluaran": "2022",
                "terjual": false,
                "tipe_kendaraan": "motor",
                "warna": "Merah"
            },
            {
                "_id": "64788d58904ea19c110f2426",
                "harga": "850000000",
                "mobil": {
                    "mesin": "1200cc",
                    "kapasitas_penumpang": "7",
                    "tipe": "SUV"
                },
                "tahun_keluaran": "2023",
                "terjual": false,
                "tipe_kendaraan": "mobil",
                "warna": "Merah"
            }
        ]
    }
  2. Menjual Kendaraan

    Request:

    POST /api/v1/vehicles/sell
    
    Header:
    Authorization: Bearer <JWT Token>
    
    Body:
    {
        "kendaraan_id": "64788d11904ea19c110f2425"
    }

    Response:

    {
        "success": true,
        "message": "Kendaraan terjual",
        "data": {
            "_id": "64788d11904ea19c110f2425",
            "harga": "25000000",
            "motor": {
                "mesin": "150cc",
                "tipe_suspensi": "Telescopic",
                "tipe_transmisi": "Manual"
            },
            "tahun_keluaran": "2022",
            "terjual": true,
            "tipe_kendaraan": "motor",
            "warna": "Merah"
        }
    }
  3. Laporan Penjualan

    Request:

    POST /api/v1/vehicles/sales-report
    
    Header:
    Authorization: Bearer <JWT Token>

    Response:

    {
        "success": true,
        "message": "Dapatkan laporan penjualan",
        "data": {
            "mobil": {
                "terjual": 1,
                "tersisa": 1,
                "total": 2
            },
            "motor": {
                "terjual": 1,
                "tersisa": 2,
                "total": 3
            }
        }
    }
  4. Menambahkan Kendaraan Motor

    Request:

    POST /api/v1/vehicles/add-motor
    
    Header:
    Authorization: Bearer <JWT Token>
    
    Body:
    {
        "tahun_keluaran": "2018",
        "warna": "Putih",
        "harga": "40000000",
        "mesin": "400cc",
        "tipe_suspensi": "Mono Shock",
        "tipe_transmisi": "Automatic"
    }

    Response:

    {
        "success": true,
        "message": "Kendaraan berhasil ditambahkan",
        "data": {
            "_id": "647948503cac74567d0f4916",
            "harga": "40000000",
            "motor": {
                "mesin": "400cc",
                "tipe_suspensi": "Mono Shock",
                "tipe_transmisi": "Automatic"
            },
            "tahun_keluaran": "2018",
            "terjual": false,
            "tipe_kendaraan": "motor",
            "warna": "Putih"
        }
    }
  5. Menambahkan Kendaraan Mobil

    Request:

    POST /api/v1/vehicles/add-car
    
    Header:
    Authorization: Bearer <JWT Token>
    
    Body:
    {
        "tahun_keluaran": "2022",
        "warna": "Putih",
        "harga": "300000000",
        "mesin": "2000cc",
        "kapasitas_penumpang": "5",
        "tipe": "MPV"
    }

    Response:

    {
        "success": true,
        "message": "Kendaraan berhasil ditambahkan",
        "data": {
            "_id": "6479487d3cac74567d0f4917",
            "harga": "300000000",
            "motor": {
                "mesin": "2000cc",
                "kapasitas_penumpang": "5",
                "tipe": "MPV"
            },
            "tahun_keluaran": "2022",
            "terjual": false,
            "tipe_kendaraan": "mobil",
            "warna": "Putih"
        }
    }

penjualan-kendaraan's People

Contributors

shofistwn 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.