mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 19:48:50 +03:00
ba4c53134f
no issue - update imports for `@ember-data` package (https://github.com/emberjs/rfcs/blob/master/text/0395-ember-data-packages.md) - use `computed.reads` where applicable (https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/require-computed-macros.md) - fix usage of `scheduleOnce` so that functions are only scheduled once (https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-incorrect-calls-with-inline-anonymous-functions.md)
35 lines
947 B
JavaScript
35 lines
947 B
JavaScript
import Model, {attr, hasMany} from '@ember-data/model';
|
|
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'),
|
|
type: attr('string'),
|
|
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');
|
|
})
|
|
});
|