in app/lambda/models.py [0:0]
def requestSession(self, partitionKey, sortKey, indexPartitionKey):
"""Request and get the specific session(s) from the database.
If both partition key and sort key are provided, return that single specific session.
if both index partition key and sort key are provided, return that single specific session.
if only partition key is provided, return sessions with that partition key.
if onyl index partition key is provided, return sessions with that index partition key.
Args:
partitionKey(str): partition key value of the session table
sortKey(str): sort key value of the session table
indexPartitionKey(str): index partition key value of the session table
Returns:
List of session(s) info
"""
if partitionKey and sortKey:
return self._sessionDataStore.queryByBothKeys(partitionKey, sortKey)
elif indexPartitionKey and sortKey:
return self._sessionDataStore.queryByIndexBothKeys(indexPartitionKey, sortKey)
elif partitionKey:
return self._sessionDataStore.queryByPartitionKey(partitionKey)
elif indexPartitionKey:
return self._sessionDataStore.queryByIndexPartitionKey(indexPartitionKey)
return {"Items": [], "status": "BAD", "message": "Wrong Way to Search."}