-
Notifications
You must be signed in to change notification settings - Fork 1
/
account.js
58 lines (48 loc) · 1.26 KB
/
account.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import Model, { attr } from '@ember-data/model';
import { memberAction } from 'ember-api-actions';
import { fragment } from 'ember-data-model-fragments/attributes';
import { serializeAndPush } from "ember-blueprint-data";
export default class AccountModel extends Model {
/// Email address for the account.
@attr
email;
/// Username of the account.
@attr
username;
/// Password for the account. The password is only used with the account is being
/// created.
@attr
password;
/// The enabled state of the account.
@attr('boolean')
enabled;
/// The scope for the account. It will be an array of strings.
@attr
scope;
/// Change the password for the account.
changePassword = memberAction ({ path: 'password', type: 'post', urlType: 'findRecord'});
/**
* Resend the verification email.
*/
resend = memberAction ({
path: 'resend',
type: 'post',
urlType: 'findRecord',
after: serializeAndPush ()
});
/// The account has been verified.
@attr('boolean')
verified;
@fragment('account-verification')
verification;
serialize () {
return {
id: this.id,
email: this.email,
username: this.username,
scope: this.scope,
enabled: this.enabled,
verified: this.verified
};
}
}