Joplin deleted all notes

This is a well documented issue and there's a warning about it on the config page and an entry on the FAQ about it.

Joplin perhaps is not an app for everybody because it gives you a lot of flexibility, but you also have to be careful in some cases and understand what you're doing (or read the doc, ask here, etc.), especially when doing major operations like switching the sync target (and especially when doing so without a backup).