|
|
@ -4,6 +4,7 @@ import * as AnalyticUnit from '../models/analytic_unit_model'; |
|
|
|
import { createAnalyticUnitFromObject } from '../controllers/analytics_controller'; |
|
|
|
import { createAnalyticUnitFromObject } from '../controllers/analytics_controller'; |
|
|
|
|
|
|
|
|
|
|
|
import * as Router from 'koa-router'; |
|
|
|
import * as Router from 'koa-router'; |
|
|
|
|
|
|
|
import * as _ from 'lodash'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function getStatus(ctx: Router.IRouterContext) { |
|
|
|
async function getStatus(ctx: Router.IRouterContext) { |
|
|
@ -122,8 +123,10 @@ async function deleteUnit(ctx: Router.IRouterContext) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function runDetect(ctx: Router.IRouterContext) { |
|
|
|
async function runDetect(ctx: Router.IRouterContext) { |
|
|
|
const { id: analyticUnitId } = ctx.request.body as { id: AnalyticUnit.AnalyticUnitId }; |
|
|
|
const { ids } = ctx.request.body as { ids: AnalyticUnit.AnalyticUnitId[] }; |
|
|
|
AnalyticsController.runFirstLearning(analyticUnitId); |
|
|
|
|
|
|
|
|
|
|
|
await Promise.all(ids.map(AnalyticsController.runFirstLearning)); |
|
|
|
|
|
|
|
|
|
|
|
ctx.response.body = { |
|
|
|
ctx.response.body = { |
|
|
|
code: 200, |
|
|
|
code: 200, |
|
|
|
message: 'Success' |
|
|
|
message: 'Success' |
|
|
|