import SourceService from "../service/source-service.js"; import ApiResult from "../config/api.js"; import ParamsService from "../service/params-service.js"; import ParamsDictService from "../service/params-dict-service.js"; import TrackService from "../service/track-service.js"; const ShipFilterControl = { getConfig: async (req, res) => { try { const sourceData = await SourceService.list({orderByColumn: 'sort', isAsc: false}) for (const source of sourceData) { const trackData = await TrackService.queryBy({sourceId: source.id}) source.track = trackData?.[0] || {} const paramsData = await ParamsService.list({sourceId: source.id}) for (const params of paramsData) { const dictData = await ParamsDictService.list({paramsId: params.id}) params.dict = dictData } source.params = paramsData } res.send(new ApiResult().success(sourceData)) } catch (e) { res.send(new ApiResult().error(e)) } }, } export default ShipFilterControl