New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/alexkaplun/tablebooker

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/alexkaplun/tablebooker

  • v0.0.0-20190918083426-2cd49c372413
  • Source
  • Go
  • Socket score

Version published
Created
Source

Simple service implementing table booking functionality

Install

  1. Clone repo outside of GOPATH

  2. Run:

    go build
    

Operation

The service will build into tablebooker binary.

Database initialization

./tablebooker initdb 

Initialization will create an SQLite db file tables.db into same directory, which will be used to store the data. Note that it will drop all existing data if exists

Starting the service

./tablebooker server

API reference

When the server is running, it implements the following API:

Get the list of all tables

Example request

GET /table/list

Example response

{
    "head": {
        "timestamp": "2019-09-18T08:25:06.646617Z" // request timestampp
    },
    "body": [
    // list of all tables below
        {
            "id": "77146dc9-df4b-46a9-a52a-3d36cc0a22a4",
            "number": 1,
            "capacity": 3
        },
        {
            "id": "e4d17aef-fc56-4679-a905-bf02c09eee2e",
            "number": 2,
            "capacity": 9
        }
     ]
}
Book the table by its id

Example request

POST /table/book/{table_id}    
{
    "bookDate": "2019-10-07",
    "guestName":"Alex",
    "guestContact":"Heyhey"
}

Example success response

{
    "head": {
        "timestamp": "2019-09-18T07:45:06.287185Z"
    },
    "body": {
        "id": "93b2fba1-8706-48b0-ac23-98f32b59df98",
        "tableId": "2d06220d-962f-4ab0-8847-78e9e3b45d83",
        "bookDate": "2019-10-07",
        "guestName": "Alex",
        "guestContact": "Heyhey",
        "code": "ae134cf7-c4e5-4b34-8f2a-2c5ba044af2d"
    }
}

Example error response

409 Conflict
table already booked 
Unbook table using the booking copde

Example request

DELETE /table/book/{code}

Example success response

{
    "head": {
        "timestamp": "2019-09-18T08:30:55.644159Z"
    },
    "body": "OK"
}

Example error response

404 Not Found
no booking with code found

FAQs

Package last updated on 18 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc