2016-09-26 19:03:53 +03:00
|
|
|
import Model from 'ember-data/model';
|
|
|
|
import attr from 'ember-data/attr';
|
2017-05-29 21:50:03 +03:00
|
|
|
import {belongsTo} from 'ember-data/relationships';
|
2017-10-30 12:38:01 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
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'),
|
2019-01-14 20:01:30 +03:00
|
|
|
|
2016-11-16 14:01:58 +03:00
|
|
|
role: belongsTo('role', {async: false}),
|
2016-09-26 19:03:53 +03:00
|
|
|
|
2017-10-30 12:38:01 +03:00
|
|
|
ajax: service(),
|
|
|
|
ghostPaths: service(),
|
2016-09-26 19:03:53 +03:00
|
|
|
|
|
|
|
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');
|
|
|
|
|
2019-03-06 16:53:54 +03:00
|
|
|
return this.ajax.post(inviteUrl, {
|
2016-09-26 19:03:53 +03:00
|
|
|
data: JSON.stringify({invites: [inviteData]}),
|
|
|
|
contentType: 'application/json'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|