#Guys i want to create before insert hook on one table i don't seem to find proper reference

5 messages · Page 1 of 1 (latest)

valid parcel
#

I did create this code from doc help me out guys

            query: {
                transactions: {
                    async create({ model, operation, args, query }) {
                        prisma.$transaction(async tx => {
                            const oldTransaction = await tx.transactions.findFirst({ where: { iUserId: args.data.iUserId } });
                                   // do something before inserting
                            }
                        });
                    },
                },
            },
        });```
sharp compass
#

Hello 👋
Can you please elaborate on what you are trying to achieve?

valid parcel
#

Hey sorry for late reply, I want to create one function that execute every time whenever i insert the data into X table

#

@sharp compass

sharp compass