def branch_mapping(self, model, view): model.id = view['id'] model.address = AddressModel() model.address.id = model.id model.img = ImgModel() model.img.id = model.id model.vid = view['vid'] model.updatedBy = view['id'] model.updatedOn = datetime.datetime.now() BranchMapper(model, view).model_mapping() AddressMapper(model.address, view.get('address', None)).model_mapping() ImgMapper(model.img, view.get('img', None)).model_mapping()
def mapping(self, model, view): print(self.session_info) if view.get('id', None) is not None: model = BranchModel.query.filter_by(id=view.get('id')).first() if model is None: model = BranchModel() model.id = uid() model.address = AddressModel() model.address.id = model.id model.vid = self.session_info['vid'] model.updatedBy = self.session_info['id'] model.updatedOn = datetime.datetime.now() BranchMapper(model, view).model_mapping() AddressMapper(model.address, view.get('address', None)).model_mapping() return model
def mapping(self, model, view): print(self.session_info) if model.id is None: model.id = uid() model.address = AddressModel() model.address.id = model.id model.img = ImgModel() model.img.id = model.id model.createdOn = datetime.datetime.now() model.vid = self.session_info['vid'] model.updatedBy = self.session_info['id'] model.updatedOn = datetime.datetime.now() ConsumerMapper(model, view).model_mapping() AddressMapper(model.address, view.get('address', None)).model_mapping() ImgMapper(model.img, view.get('img', None)).model_mapping() return model
def profile_mapping(self, model, view): model.id = view['id'] model.branchId = view['branch']['id'] model.address = AddressModel() model.address.id = model.id model.address.vid = view['vid'] model.img = ImgModel() model.img.id = model.id model.createdBy = "system" model.createdOn = datetime.datetime.now() model.vid = view['vid'] model.updatedBy = "system" model.updatedOn = datetime.datetime.now() ProfileMapper(model, view).model_mapping() AddressMapper(model.address, view.get('address')).model_mapping() ImgMapper(model.img, view.get('img')).model_mapping()
def mapping(self, model, view): if model.id is None: model.id = uid() model.branchId = view['branch']['id'] model.address = AddressModel() model.address.id = model.id model.address.vid = self.session_info['vid'] model.img = ImgModel() model.img.id = model.id model.createdBy = self.session_info['id'] model.createdOn = datetime.datetime.now() model.vid = self.session_info['vid'] model.updatedBy = self.session_info['id'] model.updatedOn = datetime.datetime.now() ProfileMapper(model, view).model_mapping() AddressMapper(model.address, view.get('address')).model_mapping() ImgMapper(model.img, view.get('img')).model_mapping()
def mapping(self, model, view): print(self.session_info) if view.get('id', None) is not None: model = ProfileModel.query.filter_by(id=view.get('id')).first() if model is None: model = ProfileModel() model.id = uid() # model.branchId = view['branch']['id'] model.address = AddressModel() model.address.id = model.id model.address.vid = self.session_info['vid'] model.img = ImgModel() model.img.id = model.id model.vid = self.session_info['vid'] model.createdBy = self.session_info['id'] model.updatedBy = self.session_info['id'] model.updatedOn = datetime.datetime.now() model.createdOn = datetime.datetime.now() ProfileMapper(model, view).model_mapping() AddressMapper(model.address, view.get('address', None)).model_mapping() ImgMapper(model.img, view.get('img', None)).model_mapping() return model