2020-01-16 20:01:12 +03:00
|
|
|
import Model, {attr, belongsTo} from '@ember-data/model';
|
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 inviteData = {
|
2020-01-07 16:23:15 +03:00
|
|
|
email: this.email,
|
2020-01-07 16:45:06 +03:00
|
|
|
role_id: this.role.id
|
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'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|