mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2026-03-11 02:55:04 +00:00
Try storing serialized search object
Does not seem to be the best solution (https://stackoverflow.com/questions/17662236/java-write-object-to-mysql-each-field-or-serialized-byte-array) and does not entirely work, but saving it for posterity because there are some interesting changes here
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import com.amazonaws.services.lambda.AWSLambdaClientBuilder;
|
||||
import com.amazonaws.services.lambda.model.InvokeRequest;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@@ -18,13 +21,22 @@ public class ItemSearcher implements CallHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object conductAction(Map<String, Object> body, HashMap<String, String> queryParams, String s) throws SQLException {
|
||||
public Object conductAction(Map<String, Object> body, HashMap<String, String> queryParams, String cognitoID) throws SQLException {
|
||||
PreparedStatement getItemMatches = connection.prepareStatement(GET_ITEM_MATCHES);
|
||||
getItemMatches.setString(1, "%" + queryParams.get("id") + "%");
|
||||
System.out.println(getItemMatches);
|
||||
ResultSet searchResults = getItemMatches.executeQuery();
|
||||
ItemSearch searchResultsObject = new ItemSearch(searchResults);
|
||||
System.out.println(searchResultsObject);
|
||||
InvokeRequest invokeRequest = new InvokeRequest();
|
||||
invokeRequest.setFunctionName("SearchHistoryUpdate");
|
||||
invokeRequest.setPayload("{" +
|
||||
" \"newSearch\": \"" + queryParams.get("id") + "\"," +
|
||||
" \"cognitoID\": \""+ cognitoID + "\"" +
|
||||
"}");
|
||||
invokeRequest.setInvocationType("Event");
|
||||
System.out.println(invokeRequest);
|
||||
AWSLambdaClientBuilder.defaultClient().invoke(invokeRequest);
|
||||
return searchResultsObject;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user