Code Monkey home page Code Monkey logo

watchdog-1's Introduction

WatchDOG

API Design

backend_inner

1.encrypt code method: post URL: {host}:{port}/powercubicle/v1/seat/encrypt

request body(JSON):
{
    "seat_number":string
}
response:
status code: 201
response body{JSON}:
{
    "encrypt_text": string,
    "ipAddr": string,
    "msg": string,
}

backend_outer

1.check all seats status method: get URL: {host}:{port}/powercubicle/v1/seat

response:
status code: 200
response body(JSON):
{
    "data": {
        "seats":
            [
                {"A" : 10},
                {"B": 19},
                ...
            ]  
    }
}

2.check single region seats status method: get URL: {host}:{port}/powercubicle/v1/seat?region={region_code}

response:
status code: 200
response body(JSON):
{
    "data": {
        "seats":{
             "A1" : "availble",
             "A2": "Zhang3",
            ...
        }
    }
}

3.user register method: post URL: {host}:{port}/powercubicle/v1/user/register

request body(JSON):
{
    "name":string,
    "password":string
}
response:
status code: 201
response body{JSON}:
{
    "Session_key":string
}

4.user login method: post URL: {host}:{port}/powercubicle/v1/user/login

request body(JSON):
{
    "name":string,
    "password":string
}
response:
status code: 201
response body{JSON}:
{
    "Session_key":string,
}

5.seat register method: post URL: {host}:{port}/powercubicle/v1/seat/register

request body(JSON):
header:{Auth:{$session_token}}
{
    "encrypted_qrcode":string,
}
response:
status code: 201

5-1.seat release method: post URL: {host}:{port}/powercubicle/v1/seat/release

header:{Auth:{$session_token}}
response:
status code: 201

6.get current seat method: get URL: {host}:{port}/powercubicle/v1/user/seat

header:{"session_key":string}
response:
status code: 200
response body{JSON}:
{
    "seat": "A1"/nil
}

database middleware

1.check all seats status method: get URL: {host}:{port}/powercubicle/v1/db/seat

response:
status code: 200
response body(JSON):
{
    "data": {
        "seats":
            [
                {"A" : 10},
                {"B": 19},
                ...
            ]  
    }
}

2.check single region seats status method: get URL: {host}:{port}/powercubicle/v1/db/seat?region={region_code}

response:
status code: 200
response body(JSON):
{
    "data": {
        "seats":[
            {"A1" : "availble"},
            {"A2": "Zhang3"},
            ...
        ]
    }
}

3.user register method: post URL: {host}:{port}/powercubicle/v1/db/user/register

request body(JSON):
{
    "user_name":string,
    "user_password":string
}
response:
status code: 201
response body{JSON}:
{
    "session_key":string
}

4.user login method: post URL: {host}:{port}/powercubicle/v1/db/user/login

request body(JSON):
{
    "user_name":string,
    "user_password":string
}
response:
status code: 201
response body{JSON}:
{
    "session_key":string,
}

5.seat register method: post URL: {host}:{port}/powercubicle/v1/db/seat/register

header:{Auth:{$session_token}}
request body(JSON):
{
    "encrypted_qrcode":string,
    "time_for_use":enum[-0.5, +0.5, 1]
}
response:
status code: 201

5-1.seat release method: post URL: {host}:{port}/powercubicle/v1/seat/release

header:{Auth:{$session_token}}
response:
status code: 201

6.get current seat method: get URL: {host}:{port}/powercubicle/v1/db/user/seat

header:{"session_key":string}
response:
status code: 200
response body{JSON}:
{
    "seat": "A1"/nil
}

Managemnt Account

1.update key method: post URL: {host}:{port}/powercubicle/v1/management/key

request body(JSON):
{
    "key":string,
}
response:
status code: 200
response body{JSON}:
{
    "status": "success",
}

error_handling

status code: 400
response body{JSON}:
{
    "status": "Bad request",
    "message": "{error_message}"
}
status code: 404
response body{JSON}:
{
    "status": "Request not found",
    "message": "{error_message}"
}
status code: 500
response body{JSON}:
{
    "status": "Internal server error",
    "message": "{error_message}"
}

watchdog-1's People

Contributors

carriely avatar chrisli03 avatar minatoaquamk2 avatar minwen-liu avatar qimaoyang 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.