certificate.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. const Backbone = require('backbone');
  2. const model = Backbone.Model.extend({
  3. idAttribute: 'id',
  4. defaults: function () {
  5. return {
  6. id: undefined,
  7. created_on: null,
  8. modified_on: null,
  9. provider: '',
  10. nice_name: '',
  11. domain_names: [],
  12. expires_on: null,
  13. meta: {},
  14. // The following are expansions:
  15. owner: null,
  16. proxy_hosts: [],
  17. redirection_hosts: [],
  18. dead_hosts: []
  19. };
  20. },
  21. /**
  22. * @returns {Boolean}
  23. */
  24. hasSslFiles: function () {
  25. let meta = this.get('meta');
  26. return typeof meta['certificate'] !== 'undefined' && meta['certificate'] && typeof meta['certificate_key'] !== 'undefined' && meta['certificate_key'];
  27. }
  28. });
  29. module.exports = {
  30. Model: model,
  31. Collection: Backbone.Collection.extend({
  32. model: model
  33. })
  34. };