|
|
@ -40,11 +40,11 @@ async function sendSegments(ctx: Router.IRouterContext) { |
|
|
|
async function updateSegments(ctx: Router.IRouterContext) { |
|
|
|
async function updateSegments(ctx: Router.IRouterContext) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
let segmentsUpdate = ctx.request.body; |
|
|
|
let segmentsUpdate = ctx.request.body; |
|
|
|
let key = segmentsUpdate.analyticUnitKey; |
|
|
|
let id = segmentsUpdate.id; |
|
|
|
let addedIds = insertSegments(key, segmentsUpdate.addedSegments, true); |
|
|
|
let addedIds = insertSegments(id, segmentsUpdate.addedSegments, true); |
|
|
|
removeSegments(key, segmentsUpdate.removedSegments); |
|
|
|
removeSegments(id, segmentsUpdate.removedSegments); |
|
|
|
ctx.response.body = { addedIds }; |
|
|
|
ctx.response.body = { addedIds }; |
|
|
|
runLearning(key); |
|
|
|
runLearning(id); |
|
|
|
} catch(e) { |
|
|
|
} catch(e) { |
|
|
|
ctx.response.status = 500; |
|
|
|
ctx.response.status = 500; |
|
|
|
ctx.response.body = { |
|
|
|
ctx.response.body = { |
|
|
|