Hooks are not being called

I have created/enabled afterSave hook in my database collection. I added only console.log to see if the function is being called or not. I didnt do any imports in data.js. But the hooks are not calling at all.

I want hook because I have to set a column in database unique. So Im trying to use hooks to check if the data that user is trying to save is already in the DB or not.

data.js
export function SubmittedWork_afterInsert(item, context) {
//TODO: write your code here…
console.log(‘SubmittedWork_afterInsert’)
}

I set the mode to “write-only” because the data need to be submitted once and there should not be edit option in the dataset settings on the form page. (when I set the mode to “Read & Write” on going to the form page the fields are automatically being saved the old details that I dont want so…).

Please explain me what to do to make hooks work in my scenario.

Check out these Corvid Forum posts: https://www.wix.com/corvid/forum/community-discussion/afterquery-data-hook-not-firing
https://www.wix.com/corvid/forum/community-discussion/how-to-debug-hooks

Also make sure if you make all necessary imports and they are correct and that you have code that inserts a new item to the database (and it’s being called)