示例#1
0
 def anno_delete(self, request):
     """
     Exposes an API endpoint to delete an existing anno.
     """
     user = auth_user(self.request_state.headers)
     if request.id is None:
         raise endpoints.BadRequestException('id field is required.')
     anno = Anno.get_by_id(request.id)
     if anno is None:
         raise endpoints.NotFoundException('No anno entity with the id "%s" exists.' % request.id)
     Anno.delete(anno)
     return message_types.VoidMessage()
示例#2
0
    def anno_delete(self, request):
        """
        Exposes an API endpoint to delete an existing anno.
        """
        user = auth_user(self.request_state.headers)

        if request.id is None:
            raise endpoints.BadRequestException('id field is required.')

        anno = Anno.get_by_id(request.id)

        if anno is None:
            raise endpoints.NotFoundException('No anno entity with the id "%s" exists.' % request.id)

        # send notifications
        ActivityPushNotifications.send_push_notification(first_user=user, anno=anno, action_type=AnnoActionType.DELETED)

        Anno.delete(anno)
        return message_types.VoidMessage()