UNPKG

flexbiz-server

Version:

Flexible Server

3 lines (2 loc) 654 B
'use strict';const historyHandler=($ctrl_query$$,$actions_req$$,$mainCallback$$)=>{$ctrl_query$$={id_func:$ctrl_query$$.name,id_app:$actions_req$$.user.current_id_app,"data.id":$actions_req$$.params.id};($actions_req$$=$actions_req$$.query.actions)?($actions_req$$=$actions_req$$.split(","),$ctrl_query$$.action={$in:$actions_req$$,$ne:"GET"}):$ctrl_query$$.action={$ne:"GET"};global.getModel("log").find($ctrl_query$$).lean().exec(function($e$$,$rs$$){setImmediate(()=>$e$$?(console.error("history query", $e$$),$e$$.error?$mainCallback$$($e$$):$mainCallback$$({error:$e$$.message||$e$$})):$mainCallback$$(null,$rs$$))})};module.exports=historyHandler;