Ghost/ghost/admin/mirage/factories/integration.js
Kevin Ansfield fa84808048 Dropped ember-cli-moment-shim dependency
no issue

Since `ember-moment@10.0` it's not been necessary to use the `ember-cli-moment-shim` package, with `moment` instead being usable directly via `ember-auto-import`. Getting rid of the shim package is necessary for compatibility with `embroider`, Ember's new build tooling.

- dropped `ember-cli-moment-shim` dependency
- added `moment-timezone` dependency and updated all imports to reflect the different package
- worked around `ember-power-calendar` having `ember-cli-moment-shim` as a sub-dependency
  - added empty in-repo-addon `ember-power-calendar-moment` to avoid `ember-power-calendar` complaining about a missing package
  - added `ember-power-calendar-utils` in-repo-addon that is a copy of `ember-power-calendar-moment` but without the build-time renaming of the tree for better compatibility with embroider
2022-09-24 13:28:23 +02:00

24 lines
724 B
JavaScript

import moment from 'moment-timezone';
import {Factory} from 'miragejs';
export default Factory.extend({
name(i) { return `Integration ${i + 1}`;},
slug() { return this.name.toLowerCase().replace(' ', '-'); },
description: null,
iconImage: null,
type: 'custom',
createdAt() { return moment.utc().format(); },
createdBy: 1,
updatedAt() { return moment.utc().format(); },
updatedBy: 1,
afterCreate(integration, server) {
let contentKey = server.create('api-key', {type: 'content', integration});
let adminKey = server.create('api-key', {type: 'admin', integration});
integration.apiKeyIds = [contentKey.id, adminKey.id];
integration.save();
}
});