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

- refactor response sending algorithms for tickets #493

Closed freelancing-solutions closed 3 years ago

freelancing-solutions commented 3 years ago

https://github.com/freelancing-solutions/gcp-database-as-a-service-stock-markets/blob/656cb833af7b9a281ae2de6f2e157a8a19c788d7/data_service/views/helpdesk.py#L244


        """
            find ticket send notification update ticket to reflect that notification was sent
        """
        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 add_response(self, ticket_id: str, subject: str, message: str) -> tuple:
        """
            find ticket add 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

    # TODO - refactor response sending algorithms for tickets

class TicketThreadView(Validators):

682d07a6dc956a66f7bcb8482560e5c4bd194a2b

freelancing-solutions commented 3 years ago

Closed in 6047891007ac89f5b2fcad02fd570d3446baf961