const { Errors } = require('../../shared') const { NodeDescriptorType } = require('../../enum') // TODO should this return size info for the temp write file? module.exports = exports = async (message, di) => { const Node = di.models.get('fs:Node') const { descriptor } = message.data() const node_uuid = message.socket.session.file_descriptors?.[descriptor] if ( !node_uuid ) { return message.send_response( message.fresh().error(Errors.NodeDoesNotExist) ) } const node = await Node.findOne({ uuid: node_uuid, deleted: false, descriptor_type: NodeDescriptorType.File, }) if ( !node ) { return message.send_response( message.fresh().error(Errors.NodeDoesNotExist) ) } message.send_response( message.fresh().data({ node: node.to_api() }) ) }