import ParamsDictService from "../service/params-dict-service.js"; import ApiResult from "../config/api.js"; const ParamsDictControl = { list: async (req, res) => { try { ParamsDictService.list(req.body).then(data => { res.send(new ApiResult().success(data)) }).catch((e) => { res.send(new ApiResult().error(null, e)) }) } catch (e) { res.send(new ApiResult().error(e)) } }, page: async (req, res) => { try { ParamsDictService.page(req.body).then(data => { res.send(new ApiResult().success(data)) }).catch((e) => { res.send(new ApiResult().error(null, e)) }) } catch (e) { res.send(new ApiResult().error(e)) } }, info: async (req, res) => { try { ParamsDictService.info(req.params.id).then(data => { res.send(new ApiResult().success(data)) }).catch((e) => { res.send(new ApiResult().error(null, e)) }) } catch (e) { res.send(new ApiResult().error(e)) } }, add: async (req, res) => { try { ParamsDictService.add(req.body).then(data => { res.send(new ApiResult().success(data)) }).catch((e) => { res.send(new ApiResult().error(null, e)) }) } catch (e) { res.send(new ApiResult().error(e)) } }, edit: async (req, res) => { try { ParamsDictService.edit(req.body).then(data => { res.send(new ApiResult().success(data)) }).catch((e) => { res.send(new ApiResult().error(null, e)) }) } catch (e) { res.send(new ApiResult().error(e)) } }, del: async (req, res) => { try { ParamsDictService.del(req.params?.ids?.split(',')).then(data => { res.send(new ApiResult().success(data)) }).catch((e) => { res.send(new ApiResult().error(null, e)) }) } catch (e) { res.send(new ApiResult().error(e)) } }, enabled: async (req, res) => { try { ParamsDictService.enabled(req.params?.ids?.split(',')).then(data => { res.send(new ApiResult().success(data)) }).catch((e) => { res.send(new ApiResult().error(null, e)) }) } catch (e) { res.send(new ApiResult().error(e)) } }, disabled: async (req, res) => { try { ParamsDictService.disabled(req.params?.ids?.split(',')).then(data => { res.send(new ApiResult().success(data)) }).catch((e) => { res.send(new ApiResult().error(null, e)) }) } catch (e) { res.send(new ApiResult().error(e)) } }, } export default ParamsDictControl