Skip to content
Snippets Groups Projects
node.js 436 B
Newer Older
  • Learn to ignore specific revisions
  • Eugen Ciur's avatar
    Eugen Ciur committed
    import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
    
    
    export default class NodeModel extends Model {
    
    Eugen Ciur's avatar
    Eugen Ciur committed
      @attr title;
    
      @attr model;
    
    Eugen Ciur's avatar
    Eugen Ciur committed
      @hasMany('node',  { polymorphic: true }) children;
      @belongsTo('node', { inverse: 'children' }) parent;
    
    
      get is_folder() {
    
        return this.type === "folder" || this.model === "folder";
    
      }
    
      get is_document() {
    
        return this.type === "document" || this.model === "document";
    
    Eugen Ciur's avatar
    Eugen Ciur committed
    }