endo-core
Version:
Put some description here
24 lines (17 loc) • 689 B
text/coffeescript
class UserDevicesController
constructor: ->
create: (req, res) =>
authorizedUuid = req.meshbluAuth.uuid
req.credentialsDevice.createUserDevice {authorizedUuid}, (error, userDevice) =>
return res.sendError error if error?
res.status(201).send userDevice
delete: (req, res) =>
{userDeviceUuid} = req.params
req.credentialsDevice.deleteUserDeviceSubscription {userDeviceUuid}, (error) =>
return res.sendError error if error?
res.sendStatus 204
list: (req, res) =>
req.credentialsDevice.getUserDevices (error, userDevices) =>
return res.sendError error if error?
res.send userDevices
module.exports = UserDevicesController