import DS from 'ember-data'; import { validator, buildValidations } from 'ember-cp-validations'; const Validations = buildValidations({ 'addressType' : { validators: [ validator('presence', { presence: true, dependentKeys: ['model.addressType.id'] }) ], }, 'alamat1' : validator('presence', true), 'country' : { validators: [ validator('presence', { presence: true, dependentKeys: ['model.country.id'] }) ], }, 'province' : { validators: [ validator('presence', { presence: true, dependentKeys: ['model.province.id'] }) ], }, 'governmentIdValue' : validator('presence', true), }); export default DS.Model.extend(Validations, { partyNumber: DS.attr('number'), isPrimary: DS.attr('boolean'), addressType: DS.belongsTo('address-type', {inverse: null}), country: DS.belongsTo('country', {inverse: null}), alamat1: DS.attr('string'), alamat2: DS.attr('string'), alamat3: DS.attr('string'), village: DS.belongsTo('village', {inverse: null}), province: DS.belongsTo('province', {inverse: null}), municipality: DS.belongsTo('municipality', {inverse: null}), subDistrict: DS.belongsTo('sub-district', {inverse: null}), kodePos: DS.attr('string'), governmentIdValue: DS.attr('string'), accountManagement: DS.belongsTo('account-management', {inverse: null}), });