2022-09-23 20:15:08 +03:00
|
|
|
import moment from 'moment-timezone';
|
2022-03-08 14:32:01 +03:00
|
|
|
import {Factory} from 'miragejs';
|
2018-10-18 02:18:29 +03:00
|
|
|
|
|
|
|
export default Factory.extend({
|
|
|
|
name(i) { return `Integration ${i + 1}`;},
|
|
|
|
slug() { return this.name.toLowerCase().replace(' ', '-'); },
|
|
|
|
description: null,
|
|
|
|
iconImage: null,
|
2019-02-22 07:11:15 +03:00
|
|
|
type: 'custom',
|
2018-10-18 02:18:29 +03:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|