Hello, I observed that my data hooks have stopped executing code,I have several hooks attached to several collections which is meant to change information beforeInserts, beforeUpdate and afterQuery, but none of the expected execution occurs. It is strange because all the hooks had been working previously and were all tested, but then they have stopped working suddenly, Please can anyone kindly help with this situation - its rather urgent.
below is what my data.js code looks like. thanks in advance
import {normalizeIrregularText,filterableFields,
prepareFiltersID, prepareKeyAndValue,
prepareArtDimensions} from 'public/util.js';
export function faac_art_beforeInsert(item, context) {
//TODO: write your code here for mainly csv imports...
if(!item.filters){
const filters = filterableFields.map((field)=>{
const {key,value}=prepareKeyAndValue(field,item)
const _id = prepareFiltersID(key,value)
return (value)?{_id,key,value}:null;
});
item.isPublished=true;
item.showDetail=true;
item.filters = JSON.stringify(filters.filter(item=>item!==null));
}
return item;
}
export function faac_tag_beforeInsert(item, context) {
//TODO: write your code here...
item.name = item.title && normalizeIrregularText(item.title);
return item;
}
export function faac_category_beforeInsert(item, context) {
//TODO: write your code here...
item.name = item.title && normalizeIrregularText(item.title);
return item;
}
export function faac_tag_beforeUpdate(item, context) {
//TODO: write your code here...
item.name = item.title && normalizeIrregularText(item.title)+'--'+item.category.name;;
return item;
}
export function faac_category_beforeUpdate(item, context) {
//TODO: write your code here...
item.name = item.title && normalizeIrregularText(item.title);
return item;
}
export function faac_art_afterQuery(item, context) {
//TODO: write your code here...
if(item.dimensions && item.filters){
item.filters = item.filters.replace('[',prepareArtDimensions(item.dimensions));
}
return item;
}