2014-12-24 16:40:40 +00:00
|
|
|
async = require('async')
|
|
|
|
permissions = require('../permissions/permissions')
|
|
|
|
helpers = require('../helpers/helpers')
|
2015-01-08 12:04:37 +00:00
|
|
|
resin = require('resin-sdk')
|
2014-12-24 16:40:40 +00:00
|
|
|
|
2015-01-15 13:47:17 +00:00
|
|
|
exports.set = permissions.user (params, options, done) ->
|
2014-12-24 16:40:40 +00:00
|
|
|
async.waterfall([
|
|
|
|
|
|
|
|
(callback) ->
|
|
|
|
if not params.note?
|
2015-01-09 18:07:50 +00:00
|
|
|
return helpers.readStdin(callback)
|
2014-12-24 16:40:40 +00:00
|
|
|
return callback(null, params.note)
|
|
|
|
|
|
|
|
(note, callback) ->
|
|
|
|
resin.models.device.note(options.device, note, callback)
|
|
|
|
|
2015-01-15 13:47:17 +00:00
|
|
|
], done)
|