Skip to content

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Discord Backers on Open Collective Sponsors on Open Collective Donate us Support us Follow us on Twitter

πŸ“¦ Nest Inventory

Sistem Manajemen Inventaris menggunakan NestJS + PostgreSQL.


πŸ“‹ Deskripsi

Proyek ini adalah repository starter untuk membangun sistem inventaris sederhana dengan NestJS, TypeScript, PostgreSQL, Prisma ORM, dan Docker.


πŸš€ Setup Proyek

Clone repository, lalu jalankan perintah berikut:

# Build dan jalankan Docker
$ docker compose up --detach --build

# (Opsional) Jika ingin menjalankan di lokal, install dependensi
$ yarn install

Item API Spec

Create Item

Endpoint : POST /item

Request Body :

{
  "name": "iPhone 15 Pro",
  "description": "Latest iPhone",
  "price": 25000000,
  "quantity": 10,
  "categoryId": 1,
  "supplierId": 1,
  "createdBy": 1
}

Response Body

{
  "data": {
    "id": 1,
    "name": "iPhone 15 Pro",
    "description": "Latest iPhone",
    "price": 25000000,
    "quantity": 10,
    "categoryId": 1,
    "supplierId": 1,
    "createdBy": 1
  }
}

Get Item By Id

Endpoint : GET /item/:id Respones Body

{
  "data": {
    "id": 1,
    "name": "iPhone 15 Pro",
    "description": "Latest iPhone",
    "price": 25000000,
    "quantity": 10,
    "categoryId": 1,
    "supplierId": 1,
    "createdBy": 1
  }
}

Get All Item

Endpoint : GET /item

Response Body

{
  "data": [
    {
      "id": 1,
      "name": "iPhone 15 Pro",
      "description": "Latest iPhone",
      "price": 25000000,
      "quantity": 10,
      "categoryId": 1,
      "supplierId": 1,
      "createdBy": 1
    },
    {
      "id": 2,
      "name": "MacBook Pro",
      "description": "Powerful laptop",
      "price": 35000000,
      "quantity": 5,
      "categoryId": 1,
      "supplierId": 2,
      "createdBy": 2
    }
  ]
}

Update Item

Endpoint : PATCH /item/:id Request Body

{
  "name": "iPhone 15 Pro Max",
  "description": "Latest iPhone Pro Max",
  "price": 27000000,
  "quantity": 15,
  "categoryId": 1,
  "supplierId": 1
}

Response Body

{
  "data": {
    "id": 1,
    "name": "iPhone 15 Pro Max",
    "description": "Latest iPhone Pro Max",
    "price": 27000000,
    "quantity": 15,
    "categoryId": 1,
    "supplierId": 1,
    "createdBy": 1
  }
}

Delete item

Endpoint: DELETE /item/:id Response Body

{
  "data": true
}

Get Supplier Summary

Endpoint: GET /item/summary/supplier Response Body

{
  "data": [
    {
      "supplierId": 1,
      "supplierName": "Supplier A",
      "totalItems": 25
    },
    {
      "supplierId": 2,
      "supplierName": "Supplier B",
      "totalItems": 10
    }
  ]
}

Get Category Summary

Endpoint: GET /item/summary/category Response Body

{
  "data": [
    {
      "categoryId": 1,
      "categoryName": "Electronics",
      "totalItems": 35
    },
    {
      "categoryId": 2,
      "categoryName": "Clothing",
      "totalItems": 15
    }
  ]
}

Category API Spec

Create Category

Endpoint: POST /category

Request Body:

{
  "name": "Electronics",
  "description": "Kategori barang-barang elektronik"
}

Response Body

{
  "data": {
    "id": 1,
    "name": "Electronics",
    "description": "Kategori barang-barang elektronik"
  }
}

Get Category By ID

Endpoint: POST /category/:id

{
  "data": {
    "id": 1,
    "name": "Electronics",
    "description": "Kategori barang-barang elektronik"
  }
}

Get All Categories

Endpoint: GET /category

Response Body

{
  "data": [
    {
      "id": 1,
      "name": "Electronics",
      "description": "Kategori barang-barang elektronik"
    },
    {
      "id": 2,
      "name": "Fashion",
      "description": "Kategori pakaian dan aksesoris"
    }
  ]
}

Delete Categories

Endpoint: DELETE /category/:id

Response Body

{
  "data": true
}

Supplier API Spec

Create Supplier

Endpoint : POST /suppliers

Request Body:

{
  "name": "Supplier A",
  "contactInfo": "supplierA@example.com"
}

Response Body

{
  "data": {
    "id": 1,
    "name": "Supplier A",
    "contactInfo": "supplierA@example.com"
  }
}

Get Supplier By ID

Endpoint : GET /suppliers/:id Response Body

{
  "data": {
    "id": 1,
    "name": "Supplier A",
    "contactInfo": "supplierA@example.com"
  }
}

Get All Supplier

Endpoint : GET /suppliers Response Body

{
  "data": [
    {
      "id": 1,
      "name": "Supplier A",
      "contactInfo": "supplierA@example.com"
    },
    {
      "id": 2,
      "name": "Supplier B",
      "contactInfo": "supplierB@example.com"
    }
  ]
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages