Please help anyone. Why are none of my Collection hooks working?
export function JobsAvailable_beforeUpdate(item, context) {
// Get Shifts Totals
wixData.query(“ShiftsAvailable”)
.eq(“jobId”, item._id)
.find()
.then( results => {
item.shiftsTotal = results.totalCount;
// Get ShiftsTaken
wixData.query("ShiftsTaken")
.eq("jobId", item._id)
.find()
.then( results11 => {
item.shiftsTaken = results11.totalCount;
// Calculate & return
item.shiftsNeeded = item.shiftsTotal - item.shiftsTaken;
return item;
});
});
}