I designed this magnet bracket to replace the broken original. These magnets can be mounted on (small/light) doors or hatches to keep them closed. I reused the old magnet.
I printed mine without supports, but you might use supports to prevent the pin from bending.
I designed this using Autodesk Fusion 360