Ejemplo n.º 1
0
    def remove_item(self, itemId):
        query = {'_id': self._id}
        document = {'items': {'_id': itemId}}
        Database.delete_one_from_array(Checklist.collection, query, document)
        cursor = Database.find_one(Checklist.collection, query)
        isRemovedtItemExist = list(
            filter(lambda c: c['_id'] == itemId, cursor['items']))

        if len(isRemovedtItemExist) == 0:
            return True
        return False
Ejemplo n.º 2
0
    def delete_attachment(self, fileId):
        query = {'_id': self._id}
        toRemoveFile = {'attachments.files': fileId}

        isRemoveFromFs = FS.delete(fileId)

        try:
            if isRemoveFromFs:
                if fileId == self.attachments['assigned']:
                    clearAssignment = {'attachments.assigned': ''}
                    Database.update_one(Card.collection, query,
                                        clearAssignment)

                Database.delete_one_from_array(Card.collection, query,
                                               toRemoveFile)

            return {**query, 'forList': self.forList, 'deletedFile': fileId}
        except:
            raise "The file is not exist with — {} | id".format(fileId)
Ejemplo n.º 3
0
 def remove_board(cls, teamId, board):
     Database.delete_one_from_array('teams', {"_id": teamId},
                                    {"boards": board})
Ejemplo n.º 4
0
 def remove_comment(self, commentId):
     query = {'_id': self._id}
     removeComment = {'comments': commentId}
     Database.delete_one_from_array(Card.collection, query, removeComment)
Ejemplo n.º 5
0
 def remove_checklist(self, checklistId):
     Database.delete_one_from_array('cards', {'_id': self._id},
                                    {'checklists': checklistId})