def post(self, request): try: return self.service.add_customers(request) except Exception as e: logger.error( f'Request -- Error : Question answer in to system {e}') return response.exception_500(e)
def get(self, request): """User Login function""" try: return self.service.get_contact_status() except Exception as e: logger.error(f'Request -- Error : Login in to system {e}') return response.exception_500(e)
def get(self, request): """User Login function""" try: ip = get_client_ip(request) return self.service.get_question() except Exception as e: logger.error(f'Request -- Error : Login in to system {e}') return response.exception_500(e)
def post(self, request): try: return self.service.update_service_Status(data=request.data, user=request.user) except Exception as e: logger.error( f'Request -- Error : updating customer status in to system {e}' ) return response.exception_500(e)
def get(self, request): """Function to logout the current user""" try: ip = get_client_ip(request) return self.user_service.logout(request, ip=ip) except Exception as e: logger.error( f'Request by user : {request.user} -- Error : Logging out of the system {e}' ) return response.exception_500(e)
def post(self, request): """User Login function""" try: username = request.data.get('username') print('user', username) password = request.data.get('password') return self.service.user_login_v1(username, password) except Exception as e: logger.error(f'Request -- Error : Login in to system {e}') return response.exception_500(e)