def assign_board(self, boardId): curentTeamId = self._id query = {"_id": curentTeamId} addBoard = {"boards": boardId} Database.update_push('teams', query, addBoard)
def add_item(self, item): itemDict = Item(**item).dict_from_class() query = {'_id': self._id} newItem = {'items': itemDict} Database.update_push(Checklist.collection, query, newItem) updatedClass = Checklist.get_by_id(self._id).dict_from_class() return updatedClass
def add_label(self, label): Database.update_one('cards', {'_id': self._id}, {"labels": []}) if type(label) is dict: Database.update_push('cards', {'_id': self._id}, {"labels": label}) elif type(label) is list: [ Database.update_push('cards', {'_id': self._id}, {"labels": lebl}) for lebl in label ]
def add_attachment(self, file, content_type, file_name): filedId = FS.put(file, content_type, file_name) query = {'_id': self._id} if len(self.attachments['files']) == 0: Database.update_one(Card.collection, query, {'attachments.assigned': filedId}) Database.update_push(Card.collection, query, {'attachments.files': filedId}) _, cursorCard = Card.get_card_by_id(self._id) return cursorCard, filedId
def add_checklist(self, newChecklist): checklistId = Checklist(**newChecklist).save() updatedCardId = Database.update_push('cards', {'_id': self._id}, {'checklists': checklistId}) justCreatedCheckList = Checklist.get_by_id( checklistId).dict_from_class() return justCreatedCheckList
def assign_list_to_board(cls, listId): print("The assign_list_to_board — {}".format(cls._id)) Database.update_push('boards', {'_id': cls._id}, {"lists": listId})
def assign_board(self, boardId): Database.update_push('users', {"_id": self._id}, {"boards": boardId})
def add_comment(self, commentId): Database.update_push('users', {'_id' : self._id}, {'comments': commentId})
def save_card_for_list(self, cardId): cursorList = Database.find_one('lists', { '_id': self._id }) Database.update_push('lists', { '_id' : self._id }, {'cards': cardId})