Giter VIP home page Giter VIP logo

tk_ecom_api's Introduction

Welcome from TK-Graphics E-commerce API

This is an API for TK-Graphics store front website.

Services Used

  • Redis
  • MongoDB
  • AWS (S3)

Required ENV Variables

  • ADMIN_USER
  • API_URL
  • AWS_REGION
  • AWS_BUCKET
  • AWS_S3_DOMAIN
  • AWS_SECRET_ACCESS_KEY
  • AWS_ACCESS_KEY_ID
  • ORIGIN
  • JWT_SECRET
  • DATABASE_URL

API HTTP REQUEST EXAMPLES

Get all orders
/admin/order/getAll

This route will return all orders

const data = await fetch('/admin/order/getAll', {
  method: "GET", 
  headers: {
    user: process.env.ADMIN_USER,
  }
})

Example Response

[
  {
    orderId: "O1670252018110:2:1",
    orderStatus: "PENDING",
    customerId: "2299770097",
    orderItems: [
      {
        productId: "7886",
        imageURL: "https://via.placeholder.com/150",
        qty: 1,
      },
      {
        productId: "7886",
        imageURL: "https://via.placeholder.com/130",
        qty: 2,
      },
    ]
  }
]
Get an order
/admin/order/:orderId

This route will an order with specified orderId

const data = await fetch(`/admin/order/${orderId}`, {
  method: "GET", 
  headers: {
    user: process.env.ADMIN_USER,
  }
})

Example Response

{
  orderId: "O1670252018110:2:1",
  orderStatus: "PENDING",
  customerId: "2299770097",
  orderItems: [
    {
      productId: "7886",
      imageURL: "https://via.placeholder.com/150",
      qty: 1,
    },
    {
      productId: "7886",
      imageURL: "https://via.placeholder.com/130",
      qty: 2,
    },
  ]
}
Get all orders by date
/admin/order/searchOrdersByDate

This route will return all orders within specified date

const data = await fetch('/admin/order/searchOrdersByDate', {
  method: "GET", 
  headers: {
    user: process.env.ADMIN_USER,
  },
  body: JSON.stringify({
    from: Date,
    to: Date (one month ago)
  })
})

Example Response

[
  {
    orderId: "O1670252018110:2:1",
    orderStatus: "PENDING",
    customerId: "2299770097",
    orderItems: [
      {
        productId: "7886",
        imageURL: "https://via.placeholder.com/150",
        qty: 1,
      },
      {
        productId: "7886",
        imageURL: "https://via.placeholder.com/130",
        qty: 2,
      },
    ]
  }
]
Get all orders by customerId
/admin/order/searchOrdersByCustomerId

This route will return all orders from specified customer

const data = await fetch('/admin/order/searchOrdersByCustomerId', {
  method: "GET", 
  headers: {
    user: process.env.ADMIN_USER,
  },
  body: JSON.stringify({
    customerId: "2299770097",
    from: Date,
    to: Date (one month ago)
  })
})

Example Response

[
  {
    orderId: "O1670252018110:2:1",
    orderStatus: "PENDING",
    customerId: "2299770097",
    orderItems: [
      {
        productId: "7886",
        imageURL: "https://via.placeholder.com/150",
        qty: 1,
      },
      {
        productId: "7886",
        imageURL: "https://via.placeholder.com/130",
        qty: 2,
      },
    ]
  }
]
Get all orders by productId
/admin/order/searchOrdersByProductId

This route will return all orders with specified product

const data = await fetch('/admin/order/searchOrdersByProductId', {
  method: "GET", 
  headers: {
    user: process.env.ADMIN_USER,
  },
  body: JSON.stringify({
    product: "7886",
    from: Date,
    to: Date (one month ago)
  })
})

Example Response

[
  {
    orderId: "O1670252018110:2:1",
    orderStatus: "PENDING",
    customerId: "2299770097",
    orderItems: [
      {
        productId: "7886",
        imageURL: "https://via.placeholder.com/150",
        qty: 1,
      },
      {
        productId: "7886",
        imageURL: "https://via.placeholder.com/130",
        qty: 2,
      },
    ]
  }
]
Get all orders by order status
/admin/order/searchOrdersByOrderStatus

This route will return all orders with specified order status

const data = await fetch('/admin/order/searchOrdersByOrderStatus', {
  method: "GET", 
  headers: {
    user: process.env.ADMIN_USER,
  },
  body: JSON.stringify({
    status: "PENDING",
    from: Date,
    to: Date (one month ago)
  })
})

Example Response

[
  {
    orderId: "O1670252018110:2:1",
    orderStatus: "PENDING",
    customerId: "2299770097",
    orderItems: [
      {
        productId: "7886",
        imageURL: "https://via.placeholder.com/150",
        qty: 1,
      },
      {
        productId: "7886",
        imageURL: "https://via.placeholder.com/130",
        qty: 2,
      },
    ]
  }
]
Update order status
/admin/order/updateOrderStatus

This route will update the status of specified order

const data = await fetch('/admin/order/updateOrderStatus', {
  method: "PUT", 
  headers: {
    user: process.env.ADMIN_USER,
  },
  body: JSON.stringify({
    orderId: "O1670252018110:2:1",
    status: "PROCESSING",
  })
})

Example Response

{
  orderId: "O1670252018110:2:1",
  orderStatus: "PROCESSING",
  customerId: "2299770097",
  orderItems: [
    {
      productId: "7886",
      imageURL: "https://via.placeholder.com/150",
      qty: 1,
    },
    {
      productId: "7886",
      imageURL: "https://via.placeholder.com/130",
      qty: 2,
    },
  ]
}
Delete Order
/admin/order/deleteOrder

This route will delete an order

const data = await fetch('/admin/order/deleteOrder', {
  method: "PUT", 
  headers: {
    user: process.env.ADMIN_USER,
  },
  body: JSON.stringify({
    orderId: "O1670252018110:2:1",
  })
})

Tech Stack

  • Typescript
  • Node.js (Nest.js)
  • Prisma (ORM)

tk_ecom_api's People

Watchers

Kyaw Zin Thiha 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.