def save_user_profile(self, profile_dto: ProfileDto): try: save_profile_result = self.firestore.update_document( usersCol, self.uid, asdict(profile_dto)) return save_profile_result except: NotFound('profile')
def find_user_status(self): try: user_info = self.firestore.read_document(usersCol, self.uid).to_dict() return user_info[userStatusFiled] except: raise NotFound('user status.')
def find_fund_issue_list_order_datetime(self, fund_name): try: issue_list = self.firestore.query_sub_document_data( fundCol, fund_name, issueHistoryCol, datetimeFiled) return issue_list except: raise NotFound("issue list with datetimeFiled")
def find_report_list_order_datetime(self, fund_name): try: report_list = self.firestore.query_sub_document_data( fundCol, fund_name, reportHistoryCol, datetimeFiled) return report_list except: raise NotFound("report list with datetimeFiled")
def find_funding_history(self, fund_name): try: funding_list = self.firestore.read_sub_collection( fundCol, fund_name, fundingHistoryCol) return funding_list except: raise NotFound('fund list.')
def find_user_fund_history(self, uid, fund_name): try: user_funding_history = self.firestore.read_ordered_documents( f'{usersCol}/{uid}/{fund_name}', limit=1) return user_funding_history except: raise NotFound('user funding hitsory.')
def find_otp(self): try: otp = self.firestore.read_document(otpCol, self.uid).to_dict()['otp'] except: raise NotFound('OTP') return otp
def find_fund_issue_history(self, fund_name): try: issue_list = self.firestore.read_sub_collection( fundCol, fund_name, issueHistoryCol) return issue_list except: raise NotFound('issue list.')
def find_fund_data(self, fund_name): try: fund_data = self.firestore.read_document(fundCol, fund_name).to_dict() print(fund_data) return fund_data except: raise NotFound('fund data')
def find_network_commission(self, asset, network): try: network_doc = self.firestore.read_document(policiesCol, withdrawalDoc) network_data = network_doc.to_dict() network_commission = network_data[asset][network][withdrawalFeeFiled] return network_commission except: raise NotFound('withdrawal fee')
def update_user_info(self, params): try: self.firestore.update_document(usersCol, self.uid, params) return 'success' except: raise NotFound('nick name')
def find_user_profile_url(self, email): try: profile_url = self.firestore.get_auth_user(email).photo_url return profile_url except: NotFound('profile url')
def find_user_display_name(self, email): try: display_name = self.firestore.get_auth_user(email).display_name return display_name except: NotFound('Nick name')
def update_notice(self, uid, notice_params): try: firestore.update_document(noticeCol, uid, notice_params) return 'success' except: raise NotFound('notice')
def find_otp_info(self): try: otp_info = self.firestore.read_document(otpCol, self.uid).to_dict() return otp_info['otp'], otp_info['count'] except: raise NotFound('OTP')
def save_otp(self, email_params): try: self.firestore.create_document(otpCol, self.uid, email_params) except: raise NotFound('otp') return