Is it right to write that you want getScanFilesPromise to complete the loop before performing. Then?

  arr.forEach(function (scans) {
            getScanFilesPromise(project, subject, experiment, scans)
                .then((files) => {
                    const getFilesTags = files.map((file) => {
                        return getFilesTagsPromise(project, subject, experiment, scans, file)
                    });

                    Promise.all(getFilesTags).then((tagsList) => {
                        res.json(tagsList.map((tags) => {
                            const obj = {};
                            tags.forEach((tag) => {
                                obj[tag.tag] = {
                                    "Value": [tag.value],
                                    "vr": tag.vr,
                                }
                            });
                            return obj;
                        }));
                    });
                })
        })

is it right to write that you want getScanFilesPromise to execute. Then finish the loop? How should it be modified?

Feb.10,2022
Menu