コード例 #1
0
ファイル: service.py プロジェクト: gabrgomes/mongo_inventory
 def change_status(self, id):
     """
     Change Status to Active
     :return:
     """
     payload = update_timestamp()
     payload["meta.is_archived"], payload["meta.is_deleted"] = False, False
     base_obj.update(COLLECTIONS['INVENTORIES'], {"_id": ObjectId(id)},
                     {"$set": payload})
コード例 #2
0
ファイル: service.py プロジェクト: gabrgomes/mongo_inventory
 def archive_inventory(self, id):
     """
     Archive inventory
     :return:
     """
     payload = update_timestamp()
     payload["meta.is_archived"], payload["meta.is_deleted"] = True, False
     base_obj.update(COLLECTIONS['INVENTORIES'], {"_id": ObjectId(id)},
                     {"$set": payload})
コード例 #3
0
ファイル: service.py プロジェクト: gabrgomes/mongo_inventory
 def delete_inventory(self, id):
     """
     Delete inventory
     :return:
     """
     count, records = base_obj.get(COLLECTIONS['INVENTORIES'],
                                   {"_id": ObjectId(id)})
     if count != 1:
         abort(400, "inventory Already Deleted")
     payload = update_timestamp()
     payload["meta.is_archived"], payload["meta.is_deleted"] = False, True
     base_obj.update(COLLECTIONS['INVENTORIES'], {"_id": ObjectId(id)},
                     {"$set": payload})
コード例 #4
0
ファイル: service.py プロジェクト: nosqlly/Todo-App
 def change_status(self, id):
     """
     Change Status to Active
     :param id:
     :return:
     """
     payload = update_timestamp()
     email = get_jwt_identity()
     payload["meta.is_archived"], payload["meta.is_deleted"] = False, False
     result = base_obj.update(COLLECTIONS['ROOMS'], {
         "_id": ObjectId(id),
         "meta.created_by": email
     }, {"$set": payload})
     if not result.modified_count:
         abort(401, "Unauthorized")
コード例 #5
0
 def archive_task(self, taskroom_id, task_id):
     """
     Update the task id with payload
     :param taskroom_id:
     :param task_id:
     :param payload:
     :return:
     """
     email = get_jwt_identity()
     payload = update_timestamp(prefix="tasks.$")
     payload["tasks.$.meta.is_archived"], payload[
         "tasks.$.meta.is_deleted"] = True, False
     result = base_obj.update(
         COLLECTIONS['ROOMS'], {
             '_id': ObjectId(taskroom_id),
             "tasks._id": ObjectId(task_id),
             "users": email
         }, {"$set": payload})
     print(payload, result)