/
home
/
infinitibizsol
/
.trash
/
node_modules.8
/
.cache
/
esm
/
File Upload :
llllll
Current File: /home/infinitibizsol/.trash/node_modules.8/.cache/esm/e518843576b6a537.js
let db,AppError,catchAsync,successResponse,failedResponse;_76b.x([["default",()=>_76b.o]]);_76b.w("../../model/index",[["default",["db"],function(v){db=v}]]);_76b.w("../../utils/apiError",[["default",["AppError"],function(v){AppError=v}]]);_76b.w("../../utils/catchAsync",[["default",["catchAsync"],function(v){catchAsync=v}]]);_76b.w("../../utils/responseFormat",[["successResponse",["successResponse"],function(v){successResponse=v}],["failedResponse",["failedResponse"],function(v){failedResponse=v}]]); const index = catchAsync(async (req, res, next) => { const query = req.query; let allData = await db.AdditionalContact.find().populate("contact_id", [ "_id", "first_name", "last_name", ]); return successResponse(res, allData); }); const add = catchAsync(async (req, res, next) => { const additionalContact = new db.AdditionalContact(req.body); await additionalContact.save(); return successResponse( res, additionalContact, "AdditionalContact saved successfully" ); }); const edit = catchAsync(async (req, res, next) => { let result = await db.AdditionalContact.findByIdAndUpdate( { _id: req.params.id }, { $set: req.body }, { new: true } ); if (!result) { return next(new AppError("No data found", 404)); } return successResponse(res, result, "AdditionalContact updated successfully"); }); const deleteData = catchAsync(async (req, res, next) => { let additionalContact = await db.AdditionalContact.deleteOne({ _id: req.params.id, }); if (!additionalContact) { return next(new AppError("No data found", 404)); } return successResponse( res, additionalContact, "AdditionalContact deleted successfully" ); }); _76b.d({ index, add, edit, deleteData });
Copyright ©2k19 -
Hexid
|
Tex7ure