all files / model/ FileNode.js

50% Statements 5/10
0% Branches 0/2
33.33% Functions 1/3
50% Lines 5/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                                                               
import DocumentNode from './DocumentNode'
 
class FileNode extends DocumentNode {
 
  constructor(...args) {
    super(...args)
  }
 
  getUrl() {
    if (this.proxy) {
      return this.proxy.getUrl()
    } else {
      // this happens if no FileProxy is attached
      console.warn('No file proxy attached to ', this.id)
      return ''
    }
  }
 
  setProxy(proxy) {
    this.proxy = proxy
  }
}
 
FileNode.type = 'file'
 
FileNode.schema = {
  url: { type: 'string', optional: true },
  fileType: { type: 'string', optional: true },
  mimeType: { type: 'string', optional: true },
  sourceFile: { type: 'object', optional: true }
}
 
FileNode.prototype._isFileNode = true
FileNode._isFileNode = true
 
export default FileNode