Caloriosa / caloriosa

Documentation, Wiki, Analysis, issues and reports for Caloriosa
https://caloriosa.com
0 stars 0 forks source link

Create a device #6

Open purrplingcat opened 6 years ago

purrplingcat commented 6 years ago

Create a device

Web UI

Procondition: User is logged in to Web UI

Legend:

Scenario

  1. U enter page with devices table
  2. U click to button 'Create device'
  3. S redirected U to page with form for create a device
  4. U fill following data to form:
    • Device title
    • Device description (this field is optionally for fill)
    • Location (User can fill City and/or GPS or Locator. Locator can't be filled if GPS filled and conversely)
    • Tags 4.1 U can't fill these field:
    • Featured sensor (before device creation not exists any sensors assigned to that device)
  5. U click 'Save'
  6. S generate name for device, create it and save data
  7. S redirected user to a device summary
  8. U is on a device summary and see devices data for read-only.

REST service

Precondition: User is logged in via /auth and haves a valid token. Every REST request is subscribed with a token in HTTP header. user can communicate with REST service directly or via Web-UI or Admin-UI, if user is in admin role.

Legend:

Scenario

  1. U send JSON data about form via POST method to /devices Data contains:
    • Device title
    • Device description (this field is optionally for fill)
    • Tags
  2. S verify U authentication and permissions via token 2.1. If U has a valid token, then user verified and process continues 2.2 If U has no valid token or no token given, then result is an error status. Device add process terminated 2.3 if U has no permissions for this operation, result is an error status. Terminated
  3. S validate data. Validation is success if:
    • Device title and description is string
    • Location City is string
    • If location contains GPS, then GPS coords must be in a valid coord format and locator not filled
    • If location contains locator, then locator mus be in format AANNAA(NN) (A - Char, N - Number)
    • Tags is an array of strings
  4. S generate device name
  5. S save data to database storage
  6. Result is an added data of device contains generated device name

Related: #5 #2 Following: Source: