Warehouse Management Server written in Haskell with Yesod
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nicolas Lenz 828b02f232 Readme 2 days ago
app Upload 1 month ago
app-ctl ctl help message 4 days ago
config Overview and Container CSV 4 days ago
src License, author, source notice on root page 4 days ago
test Upload 1 month ago
.dir-locals.el Upload 1 month ago
.gitignore Upload 1 month ago
LICENSE Add Apace2 license file 4 days ago
README.md Readme 2 days ago
package.yaml Upload 1 month ago
stack.yaml Bump stack snapshot 1 week ago
stack.yaml.lock Bump stack snapshot 1 week ago

README.md

WMS Server

Info

This is the server application for my Warehouse Management System. It is meant to be used with the fitting voice-controlled Android app.

This is written in Haskell, using Yesod as web framework and stack as build tool.

As it has users with passwords, it should only be used through a secure HTTPS connection. Locally, the passwords are of course saved securely encrypted (hashed and salted using Argon2, that is).

Setup

  1. If you haven’t already, install Stack
    • On POSIX systems, this is usually curl -sSL https://get.haskellstack.org/ | sh
  2. Build: stack build (or install with stack install which copies the binaries to .local/bin)
  3. Start: stack exec wms-server.

This opens the server up at localhost:3000 which you can then reverse-proxy. Remember to use HTTPS.

Further instructions to deploy the server in other ways (e.g. if you don’t want to compile on the server or use FastCGI), see https://www.yesodweb.com/book/deploying-your-webapp.

A user can be added (and the first user has to) with stack exec wms-server-ctl add-user USERNAME. It will ask for a password.

API

These are the addresses this server serves:

  • /container/#Int
    • GET: Gets information about the locations of a container as JSON list. Example: /container/123

      [
        {
          "amount": 3,
          "location": "A1"
        },
      {
        "amount": 12,
        "location": "B3"
        }
      ]
    • PUT: Sets the location information for a container. The request must contain a body formatted like the output of a GET, see above.

  • /container
    • GET: Gets information about all known containers as JSON list. Example:

      [
        {
          "container": 123,
          "allocations": [
            {
              "amount": 3,
              "location": "A1"
            },
            {
              "amount": 12,
              "location": "B3"
            }
          ]
        }
      ]
  • /containers.csv
    • GET: Returns a CSV file containing data on all known containers.
  • /location/#Text
    • GET: Gets information about the containers stored in a location. Example:

      [
        {
          "amount": 12,
          "container": 123
        }
      ]
    • PUT: Sets the information about a location. The request body must be formatted like the output of a GET, see above.

  • /location
    • GET: Gets information about all locations. Example:

      [
        {
          "location": "K23",
          "allocations": [
            {
              "amount": 42,
              "container": 456
            }
          ]
        }
  • /add
    • POST: Allows to add specific containers easily. Format the body like this:

      {
        "amount": 10,
        "container": 42,
        "location": "J11"
      }
  • /log
    • GET: Returns the action log. Example:

      [
        {
          "time": "2019-08-14T13:23:53.545977086Z",
          "action": "Put away",
          "details": "Put 12 of 123 to J1-23"
        }
      ]
  • /user/#Text
    • PUT: Sets (that is, adds or changes password) a user. Format the body like this:

      {
        "password": "securePassword123"
      }
    • DELETE: Deletes the user.

  • /user
    • GET: Gets names of all known users. Example: /user/peter

      ["testuser1", "testuser2"]
    • POST: Allows to post user data using HTML forms and simple key value pairs. Needs a key “request” containing either “put”, which will set a user and needs keys “username” and “password” to be set, or “delete” which needs only the key “username” to be set.

  • /control
    • GET: A control panel for user data.
  • /
    • GET: Home page, shows all known containers and has links to the control panel and CSV file.