How to restore backup of only one user when we are using nextcloud with s3 being the primary storage?

We are using nextcloud with s3 being the primary storage and backing up S3 content to another location, however, the content has no readable name and no folder hierarchy and so I was unable to find out how I could restore the backup of just one user at specific, if it loses all its files and folders or if all its data is encrypted by ransoware.

Knowing that the metadata is located in the nextcloud database, would anyone know how to filter the metadata for a particular user, so that we can create a script that copies and replaces only the files of that specific user in the files in the s3 bucket?

Thank you!


Nextcloud version: 18.0.4
Operating system and version: Ubuntu 18.04.3 LTS
Apache or nginx version (eg, Apache 2.4.25):
PHP version: PHP 7.2.24