I have a data collection named ‘Resume’ which includes a photo field and a reference field associated with Members/PublicData. My objective is to automatically update the member’s profile photo, located in Members/PublicData, to the Resume collection whenever the member uploads or updates it.

To accomplish this, I have created an after update hook on the PublicData collection. However, this implementation is not functioning as intended.

I would appreciate any guidance or advice you can provide on this matter.

Thank you.

import wixData from 'wix-data';

export function Members$PublicData_afterUpdate(item, context) {
    const memberId = item._id;
    return wixData.query("Resume")
    .eq("member", memberId)
    .then(() => {
        wixData.update("Resume", {photo: item.profilePhoto.url})