|
|
@ -88,6 +88,10 @@ async function getUnits(ctx: Router.IRouterContext) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getTypes(ctx: Router.IRouterContext) { |
|
|
|
|
|
|
|
ctx.response.body = AnalyticUnit.ANALYTIC_UNIT_TYPES; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function createUnit(ctx: Router.IRouterContext) { |
|
|
|
async function createUnit(ctx: Router.IRouterContext) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
let id = await createAnalyticUnitFromObject(ctx.request.body); |
|
|
|
let id = await createAnalyticUnitFromObject(ctx.request.body); |
|
|
@ -155,6 +159,7 @@ export var router = new Router(); |
|
|
|
router.get('/', getUnit); |
|
|
|
router.get('/', getUnit); |
|
|
|
router.get('/units', getUnits); |
|
|
|
router.get('/units', getUnits); |
|
|
|
router.get('/status', getStatus); |
|
|
|
router.get('/status', getStatus); |
|
|
|
|
|
|
|
router.get('/types', getTypes); |
|
|
|
router.patch('/alert', setAlert); |
|
|
|
router.patch('/alert', setAlert); |
|
|
|
router.post('/', createUnit); |
|
|
|
router.post('/', createUnit); |
|
|
|
router.delete('/', deleteUnit); |
|
|
|
router.delete('/', deleteUnit); |
|
|
|