Hi team,
Im trying add new smart action for set valid our records. But i get error " RecordsGetter is not defined"
I tried two case,
Case 1:
router.post('/actions/mark-is-live', permissionMiddlewareCreator.smartAction(), (request, response) => {
return new RecordsGetter(wegPvmPvmModel).getIdsFromRequest(request)
.then((id) => {
return wegPvmPvmModel.update({is_valid: true}, {where: {id: id}})
.then(() => {
response.send({success: true});
})
});
});
Case 2:
router.post('/actions/mark-as-live', permissionMiddlewareCreator.smartAction(), (req, res) => {
const recordsGetter = new RecordsGetter(wegPvmPvmModel, request.user, request.query);
return recordsGetter.getIdsFromRequest(req)
.then(companyIds => companies.update({ status: 'live' }, { where: { id: companyIds }}))
.then(() => res.send({ success: 'Company is now live!' }));
});
Can you help me please?
Thanks,
Cem