freelancing-solutions / gcp-database-as-a-service-stock-markets

GCP NDB database as a service for a stock market investment and social web services.
MIT License
3 stars 1 forks source link

Send response here #489

Open freelancing-solutions opened 3 years ago

freelancing-solutions commented 3 years ago

Send response here

https://github.com/freelancing-solutions/gcp-database-as-a-service-stock-markets/blob/25c0cc3b80998776dee32b9ae6d0ab704c06a025/data_service/views/helpdesk.py#L202


                            'message': 'successfully updated ticket'}), 200
        return jsonify({'status': False, 'message': 'Unable to find ticket'}), 500

    @use_context
    @handle_view_errors
    def assign_ticket(self, ticket_id: str, assigned_to_uid: str) -> tuple:
        ticket_instance: Ticket = Ticket.query(Ticket.ticket_id == ticket_id).get()
        if isinstance(ticket_instance, Ticket):
            ticket_instance.assigned_to_uid = assigned_to_uid
            key = ticket_instance.put()
            if key is None:
                return jsonify({'status': False, 'message': 'General error updating database'}), 500
            return jsonify({'status': True, 'payload': ticket_instance.to_dict(),
                            'message': 'successfully updated ticket'}), 200
        return jsonify({'status': False, 'message': 'Unable to find ticket'}), 500

    @use_context
    @handle_view_errors
    def send_response_by_email(self, ticket_id: str, subject: str, message: str) -> tuple:
        """
            find ticket send email response mark ticket save ticket save response
        """
        ticket_instance: Ticket = Ticket.query(Ticket.ticket_id == ticket_id).get()
        if isinstance(ticket_instance, Ticket):
            ticket_instance.response_sent = True
            key = ticket_instance.put()
            # TODO Send response here
            if key is None:
                return jsonify({'status': False, 'message': 'General error updating database'}), 500
            return jsonify({'status': True, 'payload': ticket_instance.to_dict(),
                            'message': 'successfully updated ticket'}), 200
        return jsonify({'status': False, 'message': 'Unable to find ticket'}), 500

    @use_context
    @handle_view_errors
    def send_sms_notification(self, ticket_id: str, subject: str, message: str) -> tuple:
        """
            find ticket send notification update ticket to reflect that notification was sent
        """
        pass

    def add_response(self):

16d7531af4c758dcbc30f4152d83698f21e844cc