PThorpe92 / mvscanner

Front End For A Scanner Application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MVCF Scanning system API design

Data/Tables


Resident:


  • rfid: == String (17 digit num)
  • name: == String (Last, First)
  • doc: == String (982392)
  • room: == String (e.g 10b) 1 number && 'b' | t'' unit: == int

/api/residents

GET: Index /api/residents

GET: SHOW /api/residents/{rfid}

POST: Create /api/residents body=full payload

PATCH: Update /api/residents/{rfid} body={any_updated_fields}

DELETE: Delete /api/residents/{id}

GET: Index /api/residents/{id}/timestamps Get all timestamps for X resident DEFAULT= TODAY

GET: Show /api/residents/{id}/timestamps/{start_date}/{end_date}

========================================================

Locations:

/api/locations

  • id: int e.g. (6)
  • name: string e.g. (DeltaPod)

GET: Index (all locations)

GET: Show /api/locations{id} Get the name of location X

POST: Create /api/locations{body=full_payload} Add a new location to sign out to

/api/locations/{id}/timestamps

GET: Show Get all timestamps for X location DEFAULT= TODAY

/api/locations/{id}/timestamps/{start_date}/{end_date}

GET: Show Get all timestamps for X location within date range

Timestamps

/api/timestamps

  • rfid: string
  • dest: string

GET: Index /api/timestamps Get timestamps for that day (default)

GET: Show /api/timestamps

POST: Create /api/timestamps/{body=timestamp}

TIMESTAMP (Sent by front-end)

  [ 
    {
      "rfid": "12345678901234567",
      "location": 8
    }
  ]

RETURNS: (from back-end)

  {
    "rfid": "12345678901234567",
    "location": 0,
    "timestamp": "2019-10-10 10:10:10"
  }

IF two timestamps are received at the same location, the location returned will be 0: "AWAY" and that can be checked for on the front-end, and you can send another timestamp after prompting the user

GET Show /api/timestamps/{start_date}/{end_date}

About

Front End For A Scanner Application


Languages

Language:Rust 47.7%Language:TypeScript 43.3%Language:CSS 5.2%Language:JavaScript 3.5%Language:HTML 0.3%