2016-11-16 14:01:58 +03:00
|
|
|
/* eslint camelcase: [2, {properties: "never"}] */
|
2016-09-26 19:03:53 +03:00
|
|
|
import Model from 'ember-data/model';
|
|
|
|
import attr from 'ember-data/attr';
|
|
|
|
import injectService from 'ember-service/inject';
|
2017-05-29 21:50:03 +03:00
|
|
|
import {belongsTo} from 'ember-data/relationships';
|
2016-09-26 19:03:53 +03:00
|
|
|
|
|
|
|
export default Model.extend({
|
|
|
|
token: attr('string'),
|
|
|
|
email: attr('string'),
|
|
|
|
expires: attr('number'),
|
|
|
|
createdAtUTC: attr('moment-utc'),
|
|
|
|
createdBy: attr('number'),
|
|
|
|
updatedAtUTC: attr('moment-utc'),
|
|
|
|
updatedBy: attr('number'),
|
|
|
|
status: attr('string'),
|
2016-11-16 14:01:58 +03:00
|
|
|
role: belongsTo('role', {async: false}),
|
2016-09-26 19:03:53 +03:00
|
|
|
|
|
|
|
ajax: injectService(),
|
|
|
|
ghostPaths: injectService(),
|
|
|
|
|
|
|
|
resend() {
|
|
|
|
let fullInviteData = this.toJSON();
|
2016-11-16 14:01:58 +03:00
|
|
|
|
2016-09-26 19:03:53 +03:00
|
|
|
let inviteData = {
|
|
|
|
email: fullInviteData.email,
|
2016-11-16 14:01:58 +03:00
|
|
|
role_id: fullInviteData.role
|
2016-09-26 19:03:53 +03:00
|
|
|
};
|
2016-11-16 14:01:58 +03:00
|
|
|
|
2016-09-26 19:03:53 +03:00
|
|
|
let inviteUrl = this.get('ghostPaths.url').api('invites');
|
|
|
|
|
|
|
|
return this.get('ajax').post(inviteUrl, {
|
|
|
|
data: JSON.stringify({invites: [inviteData]}),
|
|
|
|
contentType: 'application/json'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|