S redirected U to page with form for create a device
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)
U click 'Save'
S generate name for device, create it and save data
S redirected user to a device summary
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:
U - user
S - service
Scenario
U send JSON data about form via POST method to /devices Data contains:
Device title
Device description (this field is optionally for fill)
Tags
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
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
S generate device name
S save data to database storage
Result is an added data of device contains generated device name
Create a device
Web UI
Procondition: User is logged in to Web UI
Legend:
Scenario
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
/devices
Data contains:Related: #5 #2 Following: Source: