mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-28 01:28:51 +00:00
24 lines
492 B
CoffeeScript
24 lines
492 B
CoffeeScript
canvas = require('./_canvas')
|
|
_ = require('lodash')
|
|
Promise = require('bluebird')
|
|
errors = require('../errors/errors')
|
|
|
|
exports.getAll = (applicationId) ->
|
|
return canvas.get
|
|
resource: 'device'
|
|
options:
|
|
filter:
|
|
application: applicationId
|
|
expand: 'application'
|
|
orderby: 'name asc'
|
|
.then (devices) ->
|
|
if _.isEmpty(devices)
|
|
return Promise.reject(new errors.NotAny('devices'))
|
|
|
|
return devices
|
|
|
|
exports.remove = (id) ->
|
|
return canvas.delete
|
|
resource: 'device'
|
|
id: id
|