The table has following fields: id document_id id of the document. feature_id id of the feature. feature_layer layer of the feature. Thanks to a QGIS feature named Polymorphic Relations we can link a document with features of multiple layers. The polymorphic relation can evaluate an expression to decide in which table will be the feature to link.
https://www.opengis.ch/2022/11/29/qgis-relations-their-widgets-and-the-plugins-of-them/