def get_all(data, db_session, username=None): logger.info(LogMsg.START) if data.get('sort') is None: data['sort'] = ['creation_date-'] if username is not None: permissions, presses = get_user_permissions(username, db_session) has_permission([Permissions.ORDER_ITEM_GET_PREMIUM], permissions) logger.debug(LogMsg.PERMISSION_VERIFIED) result = OrderItem.mongoquery( db_session.query(OrderItem)).query(**data).end().all() res = [] for item in result: res.append(item_to_dict(item, db_session)) logger.debug(LogMsg.GET_SUCCESS, res) logger.info(LogMsg.END) return res
def get_all(data, db_session, username=None): logger.info(LogMsg.START) if data.get('sort') is None: data['sort'] = ['creation_date-'] if username is not None: logger.debug(LogMsg.PERMISSION_CHECK, username) validate_permissions_and_access(username, db_session, 'ORDER_ITEM_GET', access_level=Access_level.Premium) logger.debug(LogMsg.PERMISSION_VERIFIED, username) result = OrderItem.mongoquery( db_session.query(OrderItem)).query( **data).end().all() res = [] for item in result: res.append(item_to_dict(item, db_session)) logger.debug(LogMsg.GET_SUCCESS, res) logger.info(LogMsg.END) return res