Code Monkey home page Code Monkey logo

demoserver's Introduction

demoServer

/organisations - create/retrieve/update/delete organisations

POST request

  {
   "name": "ABC Logistics"
  }

response

  {
    "id": 1,
    "name": "ABC Logistics",
    "createdAt": "2022-06-15 16:36:45"
  }

PATCH request /organisations?id=1

  {
    "name": "ABCD Logistics"
  }

response

  {
    "id": 1,
    "name": "ABCD Logistics",
    "createdAt": "2022-06-15 16:36:45"
  }

/warehouses - create/retrieve/update/delete warehouses

POST request

  {
    "orgId": 1,
    "name": "ABC Warehouse at Madurai"
  }

response

  {
    "id": 2,
    "name": "ABC Warehouse at Madurai",
    "orgId": 1
  }

/items - create/retrieve/update/delete items

POST request

  {
    "orgId": 1,
    "name": "Blue pen",
    "description": "Blue pen from cello",
    "costPrice": 15,
    "sellingPrice":20
  }

response

   {
      "id": 2,
      "name": "Blue pen",
      "description": "Blue pen from cello",
      "costPrice": 15,
      "sellingPrice": 20,
      "orgId": 1,
      "createdAt": "2022-06-15 16:37:32.0",
      "totalStock": 390
    }

/stocks - create/retrieve/update/delete stock entry for items in their warehouse

POST request

  {
    "itemId": 2,
    "warId": 1,
    "count": 200   
  }

response

  {
    "id": 4,
    "warId": 1,
    "itemId": 2,
    "count": 200
  }

PATCH request /stocks?id=4

  {
    "count": 150   
  }

response

{
    "id": 4,
    "warId": 1,
    "itemId": 2,
    "count": 150
}

/invoices - create/retrieve/update/delete invoice for orders accepts orders as list

POST request

  {
    "orgId": 1,
    "customerName": "sudhar",  
    "discount": 5.78,
    "tax": 4.69,
    "orders": [
        {
          "itemId": 2,
          "quantity": 10,
          "warId":2
        },
        {
          "itemId": 1,
          "quantity": 10,
          "warId":1
        }
    ]
  }

response

{
    "id": 1,
    "orgId": 1,
    "customerName": "sudhar",
    "createdAt": "2022-06-15 16:38:43.0",
    "discount": 5.78,
    "tax": 4.69,
    "totalPrice": 300.0,
    "withTaxDis": 295.91675,
    "orders": [
        {
            "id": 1,
            "invoiceId": 1,
            "customerName": "sudhar",
            "itemId": 2,
            "orgId": 1,
            "price": 15,
            "quantity": 10,
            "createdAt": "2022-06-15 16:38:43.0",
            "warId": 2,
            "amount": 150
        },
        {
            "id": 2,
            "invoiceId": 1,
            "customerName": "sudhar",
            "itemId": 1,
            "orgId": 1,
            "price": 15,
            "quantity": 10,
            "createdAt": "2022-06-15 16:38:43.0",
            "warId": 1,
            "amount": 150
        }
    ]
}

/reports/items report for items options eg.?sortBy=soldUnits

available options : soldUnits,stockUnits,itemPrice,totalSaleAmount

sample /reports/items?sortBy=-totalSaleAmount

[
    {
        "createdAt": 1655448707000,
        "sellingPrice": 500,
        "totalSaleAmount": 25000,
        "item_id": 1,
        "name": "shoe",
        "stockUnits": 250,
        "soldUnits": 50
    },
    {
        "createdAt": 1655448707000,
        "sellingPrice": 15,
        "totalSaleAmount": 150,
        "item_id": 2,
        "name": "pen",
        "stockUnits": 100,
        "soldUnits": 10
    },
 ]

/reports/customer report for customer options eg.?sortBy=cname

available options : cname,totalPrice,invoices

sample /reports/items?sortBy=totalPrice

[
    {
        "invoices": 1,
        "totalPrice": 4000,
        "cname": "zack"
    },
    {
        "invoices": 5,
        "totalPrice": 16100,
        "cname": "sudhar"
    }
]

/groups create delete item groups

POST request

{
    "orgId": 1,
    "name": "Pens",
    "items":[
        {
          "name":"Red Pen",
           "costPrice": 11,
            "sellingPrice":20
        },{
          "name":"Blue Pen",
           "costPrice": 12,
            "sellingPrice":20
        },
        {
          "name":"Green Pen",
           "costPrice": 13,
            "sellingPrice":20
        }
    ]
}

response

{
    "id": 3,
    "name": "Pens",
    "orgId": 1,
    "items": [
        {
            "id": 8,
            "name": "Red Pen",
            "description": "null",
            "costPrice": 11,
            "sellingPrice": 20,
            "orgId": 1,
            "createdAt": "2022-06-20 14:03:00.0",
            "totalStock": 0,
            "groupId": 3,
            "stocks": []
        },
        {
            "id": 9,
            "name": "Blue Pen",
            "description": "null",
            "costPrice": 12,
            "sellingPrice": 20,
            "orgId": 1,
            "createdAt": "2022-06-20 14:03:00.0",
            "totalStock": 0,
            "groupId": 3,
            "stocks": []
        },
        {
            "id": 10,
            "name": "Green Pen",
            "description": "null",
            "costPrice": 13,
            "sellingPrice": 20,
            "orgId": 1,
            "createdAt": "2022-06-20 14:03:00.0",
            "totalStock": 0,
            "groupId": 3,
            "stocks": []
        }
    ]
}

demoserver's People

Contributors

redlonewolf avatar

Watchers

James Cloos 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.