Sindbad~EG File Manager
let db,AppError,catchAsync,successResponse;_03a.x([["default",()=>_03a.o]]);_03a.w("../../model/index",[["default",["db"],function(v){db=v}]]);_03a.w("../../utils/apiError",[["default",["AppError"],function(v){AppError=v}]]);_03a.w("../../utils/catchAsync",[["default",["catchAsync"],function(v){catchAsync=v}]]);_03a.w("../../utils/responseFormat",[["successResponse",["successResponse"],function(v){successResponse=v}]]);
const index = catchAsync(async (req, res, next) => {
const query = req.query;
let allData = await db.ExtendedPolicyInfo.find(query);
return successResponse(res, allData);
});
const add = catchAsync(async (req, res, next) => {
const additionalInterest = new db.ExtendedPolicyInfo(req.body);
await additionalInterest.save();
return successResponse(
res,
additionalInterest,
"Extended-Policy-Info saved successfully"
);
});
const edit = catchAsync(async (req, res, next) => {
let result = await db.ExtendedPolicyInfo.findByIdAndUpdate(
{ _id: req.params.id },
{ $set: req.body },
{ new: true }
);
if (!result) {
return next(new AppError("No data found.", 404));
}
return successResponse(
res,
result,
"Extended-Policy-Info updated successfully"
);
});
const deleteData = catchAsync(async (req, res, next) => {
let additionalInterest = await db.ExtendedPolicyInfo.findByIdAndDelete({
_id: req.params.id,
});
if (!additionalInterest) {
return next(new AppError("No data found.", 404));
}
return successResponse(
res,
additionalInterest,
"Extended-Policy-Info deleted successfully"
);
});
_03a.d({ index, add, edit, deleteData });
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists