2023-06-19 10:37:51 +03:00
|
|
|
import Model from '@ember-data/model';
|
2023-05-23 08:28:53 +03:00
|
|
|
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
2023-06-19 10:37:51 +03:00
|
|
|
import {attr} from '@ember-data/model';
|
|
|
|
import {computed} from '@ember/object';
|
2023-05-23 08:28:53 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
|
|
|
|
export default Model.extend(ValidationEngine, {
|
|
|
|
validationType: 'collection',
|
|
|
|
|
|
|
|
title: attr('string'),
|
|
|
|
slug: attr('string'),
|
|
|
|
description: attr('string'),
|
|
|
|
type: attr('string', {defaultValue: 'manual'}),
|
|
|
|
filter: attr('string'),
|
|
|
|
featureImage: attr('string'),
|
|
|
|
createdAtUTC: attr('moment-utc'),
|
|
|
|
updatedAtUTC: attr('moment-utc'),
|
|
|
|
createdBy: attr('number'),
|
|
|
|
updatedBy: attr('number'),
|
|
|
|
count: attr('raw'),
|
|
|
|
|
2023-06-19 10:37:51 +03:00
|
|
|
posts: attr('raw'),
|
|
|
|
|
|
|
|
postIds: computed('posts', function () {
|
|
|
|
if (this.posts && this.posts.length) {
|
|
|
|
return this.posts.map(post => post.id);
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
|
2023-05-23 08:28:53 +03:00
|
|
|
feature: service()
|
|
|
|
});
|