Esempio n. 1
0
var Settings = minimodel.Model.extend({ 
  id: {
    type: String,
    default: "MainSettings",
    set: function(val) {
      this.setRaw("MainSettings");
    }
  },
  adminUser: {
    id: {
      type: String,
      default: "1",
      set: function(val) {
        this.setRaw("1");
      }
    },
    username: {
      type: String,
      required: true
    },
    hashed_password: {
      type: String,
      required: true,
      includeInJson: false,
      includeInObject: false
    },
    password: {
      type: minimodel.Types.Virtual,
      set: function(val) {
        if(val) {
          this.model.setRaw("adminUser.hashed_password", crypto.createHash('sha512').update(val).digest('hex'));
        }
      }
    }
  },
  website: {
    title: {
      type: String,
      required: true
    },

    headline: String
  },
  social: {
    twitter: {
      username: String,
      showShareButton: Boolean
    },
    linkedin: {
      username: String,
      showShareButton: Boolean
    },
    github: {
      username: String
    },
    google: {
      username: String,
      showShareButton: Boolean
    },
    facebook: {
      showShareButton: Boolean
    }
  },
  menu: [{
    label: {
      type: String,
      required: true
    },
    link: {
      type: String,
      required: true
    },
    iconClass: String
  }]
});
Esempio n. 2
0
var Settings = minimodel.Model.extend({ 
  id: {
    type: String,
    default: "MainSettings",
    set: function(val) {
      this.setRaw("MainSettings");
    }
  },
  adminUser: {
    id: {
      type: String,
      default: "1",
      set: function(val) {
        this.setRaw("1");
      }
    },
    username: {
      type: String,
      required: true
    },
    hashed_password: {
      type: String,
      required: true,
      includeInJson: false,
      includeInObject: false
    },
    password: {
      type: minimodel.Types.Virtual,
      set: function(val) {
        if(val) {
          var hash = bcrypt.hashSync(val, 10);
          this.model.setRaw("adminUser.hashed_password", hash);
          this.model.adminUser.password_type = 'bcrypt';
        }
      }
    },
    password_type: {
      type: String,
      includeInJson: false,
      includeInObject: false
    }
  },
  website: {
    title: {
      type: String,
      required: true
    },

    headline: String
  },
  social: {
    twitter: {
      username: String,
      showShareButton: Boolean
    },
    linkedin: {
      username: String,
      showShareButton: Boolean
    },
    github: {
      username: String
    },
    google: {
      username: String,
      showShareButton: Boolean
    },
    facebook: {
      showShareButton: Boolean
    }
  },
  menu: [{
    label: {
      type: String,
      required: true
    },
    link: {
      type: String,
      required: true
    },
    iconClass: String
  }]
});
Esempio n. 3
0
var minimodel = require('minimodel');

var FriendlyUrl = minimodel.Model.extend({
  id: String,
  url: String
});

module.exports = FriendlyUrl;
module.exports.__module = {
  type: 'object'
};
Esempio n. 4
0
});

var Post = minimodel.Model.extend({
  id: {
    type: String,
    default: function() {
      return uuid.v4();
    }
  },
  title: {
    type: String,
    required: true
  },
  isPublished: Boolean,
  createdDate: {
    type: Date,
    default: function() {
      return new Date();
    }
  },
  content: String,
  contentType: {
    type: String,
    default: 'markdown'
  },
  lead: String,
  friendlyUrl: String,
  headlineImage: String
});

Post.prototype.getRenderedContent = function() {