Merge pull request #14870 from overleaf/bg-async-await-linked-files-handler

add exported promises to linked files handler

GitOrigin-RevId: 43570f7e93240c3b5901eecb28325930f2b8fb05
This commit is contained in:
Brian Gough 2023-09-20 08:47:18 +01:00 committed by Copybot
parent 67ec78f7c6
commit 2394a32858

View file

@ -10,7 +10,6 @@
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
let LinkedFilesHandler
const FileWriter = require('../../infrastructure/FileWriter')
const EditorController = require('../Editor/EditorController')
const ProjectLocator = require('../Project/ProjectLocator')
@ -22,8 +21,9 @@ const {
V1ProjectNotFoundError,
BadDataError,
} = require('./LinkedFilesErrors')
const { promisifyAll } = require('../../util/promises')
module.exports = LinkedFilesHandler = {
const LinkedFilesHandler = {
getFileById(projectId, fileId, callback) {
if (callback == null) {
callback = function () {}
@ -151,3 +151,10 @@ module.exports = LinkedFilesHandler = {
})
},
}
module.exports = {
...LinkedFilesHandler,
promises: promisifyAll(LinkedFilesHandler, {
multiResult: { getFileById: ['file', 'path', 'parentFolder'] },
}),
}