webwoods / streamline-1.0

This comprehensive solution is designed to streamline and optimize your business processes, providing a centralized platform to manage and coordinate various aspects of your enterprise. Whether you are a small business or a large corporation, our ERP software is tailored to meet your organizational needs and enhance overall efficiency.
5 stars 1 forks source link

Error creating request items: duplicate key value violates unique constraint "UQ_da93a21bf8a4bcc10f649a6b948" #70

Open kodiidok opened 6 months ago

kodiidok commented 6 months ago

Unhandled Runtime Error

ApolloError: Error creating request item: Error creating request items: duplicate key value violates unique constraint "UQ_da93a21bf8a4bcc10f649a6b948"

Possible solution: Check if a request item has been created with the same request id and store item id.

    useEffect(() => {
        if (createRequestItemData) {
            addRequestItemsToRequestMutation({
                variables: {
                    requestId: createRequestData?.createRequest?.id,
                    requestItemIds: createRequestItemData?.createRequestItems?.map((item: any) => (item.id))
                }
            })
        }

        if (addRequestItemsError) {
            alert(addRequestItemsError);
            return;
        }
    }, [createRequestItemData])