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 inviteData = {
|
2020-01-07 16:23:15 +03:00
|
|
|
email: this.email,
|
|
|
|
role_id: this.belongsTo('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'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|