/
user.js
53 lines (48 loc) · 1.08 KB
/
user.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
var _ = require('lodash'),
Entity = require('../entity'),
logger = require('../../logger');
var UserSchema = new Entity.SchemaObject({
UserID: {
type: String,
toObject: 'never'
},
EmailAddress: {
type: String
},
FirstName: {
type: String,
toObject: 'always',
validators: {
maxLength: 255
}
},
LastName: {
type: String,
toObject: 'always',
validators: {
maxLength: 255
}
},
UpdatedDateUTC: {
type: Date
},
IsSubscriber: {
type: Boolean
},
OrganisationRole: {
type: String
}
});
var User = Entity.extend(UserSchema, {
constructor: function(application, data, options) {
logger.debug('User::constructor');
this.Entity.apply(this, arguments);
},
initialize: function(data, options) {},
toXml: function() {
var user = _.omit(this.toObject());
return this.application.js2xml(user, 'User');
}
});
module.exports = User;
module.exports.UserSchema = UserSchema;