Пример #1
0
    def patients_remove(self, req):
        """Remove a single patient.

        :param req.patient_id: (int) ID of the patient to remove.
        """
        patient_id = req.patient_id
        resp = SimpleResponse()
        try:
            account = get_current_user()
            services.accounts.patient_remove(account.id, patient_id)
            return resp.ToMessage()
        except exp.ServiceExp as e:
            handle_exception(e)
Пример #2
0
    def hide(self, req):
        """Hide a message in a thread.

        :param req.message_id: (int) ID of the message to hide.
        """
        resp = SimpleResponse()
        message_id = req.message_id
        try:
            account = get_current_user()
            services.messages.hide_message(account.id, message_id)
            return resp.ToMessage()
        except exp.ServiceExp as e:
            handle_exception(e)
Пример #3
0
    def leave(self, req):
        """Leave a thread.

        :param req.thread_id: (int) ID of the thread.
        """
        resp = SimpleResponse()
        thread_id = req.thread_id
        try:
            account = get_current_user()
            services.messages.leave_thread(account.id, thread_id)
            return resp.ToMessage()
        except exp.ServiceExp as e:
            handle_exception(e)
Пример #4
0
    def remove(self, req):
        """Remove an existing connection.

        :param req.account_id: (int) ID of the account to be removed.
        """
        resp = SimpleResponse()
        other_id = req.account_id
        try:
            account = get_current_user()
            services.connections.remove_connection(account.id, other_id)
            return resp.ToMessage()
        except exp.ServiceExp as e:
            handle_exception(e)
Пример #5
0
    def request(self, req):
        """Send a connection request to a user.

        :param req.account_id: (int) ID of the account receiving the request.
        """
        resp = SimpleResponse()
        to_id = req.account_id
        try:
            account = get_current_user()
            services.connections.send_request(account.id, to_id)
            return resp.ToMessage()
        except exp.ServiceExp as e:
            handle_exception(e)
Пример #6
0
    def decline(self, req):
        """Decline a connection request form a user.

        :param req.account_id: (int)
            ID of the account that sent the connection request.
        """
        resp = SimpleResponse()
        from_id = req.account_id
        try:
            account = get_current_user()
            services.connections.decline_request(account.id, from_id)
            return resp.ToMessage()
        except exp.ServiceExp as e:
            handle_exception(e)