Snippets Collections
 if (typeId === 1) {
                // aca_book_list
                const deleteBook = await prisma.aca_book_list.update({
                    where: {
                        id: +productId,
                        // is_active: true,
                        // institution_id: +authData.institution_id,
                    },
                    data: {
                        is_active: false,
                    }
                })
                await BasicResponse(res, 1, 'Book Deleted', deleteBook)
                if (!deleteBook) {
                    await BasicResponse(res, 0, 'Book Not Found to Delete', [])
                    return
                }

            }

            if (typeId === 2 || typeId === 3) {
                // console.log(typeId, productId);
                let deleteProduct: any = await prisma.sm_products.findMany({
                    where: {
                        id: productId,
                        // is_active: true,

                    }
                    // data: {
                    //     is_active: false,
                    // },
                })
                console.log('deleteProduct ', deleteProduct)
                // if (!deleteProduct) {
                //     if (typeId === 2) {
                //         await BasicResponse(res, 0, 'A Copies Not Found to Delete', [])
                //         return
                //     }
                //     if (typeId === 3) {
                //         await BasicResponse(res, 0, 'A Stationery Not Found to Delete', [])
                //         return
                //     }
                // }

                // if (typeId === 2) {
                //     await BasicResponse(res, 1, 'A Copies Deleted', deleteProduct)
                // }
                // if (typeId === 3) {
                //     await BasicResponse(res, 1, 'A Stationery Deleted', deleteProduct)
                // }
            }
star

Mon Jun 06 2022 07:24:48 GMT+0000 (Coordinated Universal Time)

#nodejs #prisma

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension