/api/administrator/administrator-accounts-count (GET)
await global.api.administrator.AdministratorAccountsCount.get(req) Located in Dashboard API
Returns integer
Exceptions
These exceptions are thrown (NodeJS) or returned as JSON (HTTP) if you provide incorrect data or do not meet the requirements:
Exception | Circumstances |
---|
NodeJS source (edit on github)
If you see a problem with the source submit a pull request on Github.
const dashboard = require('../../../../index.js')
module.exports = {
get: async (req) => {
return dashboard.StorageList.count(`${req.appid}/administrator/accounts`)
}
}
Test source (edit on github)
Tests perform real HTTP requests against a running Dashboard server.
/* eslint-env mocha */
const assert = require('assert')
const TestHelper = require('../../../../test-helper.js')
describe('/api/administrator/administrator-accounts-count', () => {
describe('returns', () => {
it('integer', async () => {
const owner = await TestHelper.createOwner()
await TestHelper.createAdministrator(owner)
const req = TestHelper.createRequest('/api/administrator/administrator-accounts-count')
req.account = owner.account
req.session = owner.session
req.filename = __filename
req.saveResponse = true
const result = await req.get()
assert.strictEqual(result, global.pageSize)
})
})
})