Created
November 18, 2015 19:58
-
-
Save jking6884/aeccd7a4c833bcd673a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.Model.extend({ | |
mlsName: DS.attr('string'), | |
mlsUserId: DS.attr('string'), | |
licenseNum: DS.attr('string') | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.Model.extend({ | |
first: DS.attr('string'), | |
last: DS.attr('string'), | |
email : DS.attr('string'), | |
password: DS.attr('string'), | |
address1: DS.attr('string'), | |
address2: DS.attr('string'), | |
city: DS.attr('city'), | |
state: DS.attr('state'), | |
zip: DS.attr('string'), | |
mobile: DS.attr('string'), | |
work: DS.attr('string'), | |
fax: DS.attr('string'), | |
businessEmail: DS.attr('string'), | |
businessName: DS.attr('string'), | |
businessPhone: DS.attr('string'), | |
marketingEmailOut: DS.attr('bool'), | |
userMlsData: DS.belongsTo('user-mls-data'), | |
// realty specific | |
//mlsName: DS.attr('string'), | |
//mlsUserId: DS.attr('string'), | |
//licenseNum: DS.attr('string'), | |
emailData: DS.attr( | |
//emailAdddress: DS.attr('string'), | |
//emailImapHost: DS.attr('string'), | |
//emailImapPort: DS.attr('string'), | |
//emailName: DS.attr('string'), | |
//emailPassword: DS.attr('string'), | |
//emailSmtpHost: DS.attr('string'), | |
//emailSmtpPort: DS.attr('string'), | |
), | |
//calculated | |
fullName: function () { | |
var fullName = this.get('first') + ' ' + this.get('last'); | |
return Ember.$("<div/>").html(fullName).text(); | |
}.property('first', 'last') | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
import Ember from 'ember'; | |
export default DS.RESTSerializer.extend({ | |
isNewSerializerAPI: true, | |
normalizeResponse: function(store, modelClass, payload, id, requestType){ | |
var rtn = { | |
"data": { | |
"id": 1, | |
"type": "user", | |
"attributes": { | |
"first" : payload.general.first, | |
"last" : payload.general.last, | |
"email" : payload.general.email, | |
"address1" : payload.general.address_1, | |
"address2" : payload.general.address_2, | |
"city" : payload.general.city, | |
"state" : payload.general.state, | |
"zip" : payload.general.zip, | |
"mobile" : payload.general.mobile, | |
"work" : payload.general.work, | |
"fax" : payload.general.fax, | |
"businessEmail" : payload.general.business_email, | |
"businessName" : payload.general.business_email, | |
"businessPhone" : payload.general.business_phone, | |
"marketingEmailOut" : payload.general.marketing_email_out, | |
//"mlsData" : { | |
// mlsName: payload.realty.mls_name, | |
// mlsUserId: payload.realty.mls_user_id, | |
// licenseNum: payload.realty.license_num | |
//}, | |
//"mlsName" : payload.realty.mls_name, | |
//"mlsUserId" : payload.realty.mls_user_id, | |
//"licenseNum" : payload.realty.license_num, | |
"emailData": payload.email | |
//"emailAddress" : payload.email.email_address, | |
//"emailImapHost" : payload.email.email_imap_host, | |
//"emailImapPort" : payload.email.email_imap_port, | |
//"emailName" : payload.email.email_name, | |
//"emailPassword" : payload.email.email_password, | |
//"emailSmtpHost" : payload.email.email_smtp_host, | |
//"emailSmtpPort" : payload.email.email_smtp_port | |
}, | |
relationships: { | |
userMlsData: { | |
data: { | |
id: 1, | |
"type": "user-mls-data", | |
"attributes": { | |
mlsName: payload.realty.mls_name, | |
mlsUserId: payload.realty.mls_user_id, | |
licenseNum: payload.realty.license_num | |
} | |
} | |
} | |
} | |
} | |
}; | |
return rtn; | |
}, | |
normalize: function(type, hash, prop){ | |
debugger; | |
}, | |
serializeIntoHash(hash, type, record, options) { | |
debugger; | |
hash.user = this.serialize(record, options); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment