2020-01-16 20:01:12 +03:00
|
|
|
import Model, {attr, hasMany} from '@ember-data/model';
|
2018-10-18 02:18:29 +03:00
|
|
|
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
|
|
|
import {computed} from '@ember/object';
|
|
|
|
|
|
|
|
export default Model.extend(ValidationEngine, {
|
|
|
|
validationType: 'integration',
|
|
|
|
|
|
|
|
name: attr('string'),
|
|
|
|
slug: attr('string'),
|
2019-02-15 17:18:05 +03:00
|
|
|
type: attr('string'),
|
2018-10-18 02:18:29 +03:00
|
|
|
iconImage: attr('string'),
|
|
|
|
description: attr('string'),
|
|
|
|
createdAtUTC: attr('moment-utc'),
|
|
|
|
createdBy: attr('number'),
|
|
|
|
updatedAtUTC: attr('moment-utc'),
|
|
|
|
updatedBy: attr('number'),
|
|
|
|
|
|
|
|
apiKeys: hasMany('api-key', {
|
|
|
|
embedded: 'always',
|
|
|
|
async: false
|
|
|
|
}),
|
|
|
|
webhooks: hasMany('webhook', {
|
|
|
|
embedded: 'always',
|
|
|
|
async: false
|
|
|
|
}),
|
|
|
|
|
|
|
|
adminKey: computed('apiKeys.[]', function () {
|
|
|
|
return this.apiKeys.findBy('type', 'admin');
|
|
|
|
}),
|
|
|
|
|
|
|
|
contentKey: computed('apiKeys.[]', function () {
|
|
|
|
return this.apiKeys.findBy('type', 'content');
|
|
|
|
})
|
|
|
|
});
|