Enforce schema matching

Ensure all Lambdas and tests follow the current db schema
This commit is contained in:
NMerz 2020-10-06 21:54:04 -04:00
parent 56c9a3f99d
commit a43776e5dc
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.time.Instant;
import java.time.ZoneOffset;
import java.util.HashMap;
@ -25,7 +26,7 @@ public class ListEntryAdder implements CallHandler {
statement.setInt(1, (Integer) bodyMap.get("productID"));
statement.setInt(2, (Integer) bodyMap.get("listID"));
statement.setInt(3, (Integer) bodyMap.get("quantity"));
statement.setObject(4, Instant.now().atZone(ZoneOffset.UTC).toLocalDateTime());
statement.setTimestamp(4, Timestamp.from(Instant.now()));
statement.setBoolean(5, (Boolean) bodyMap.get("purchased"));
System.out.println(statement);
statement.executeUpdate();

View File

@ -84,7 +84,7 @@ public class MainActivity extends AppCompatActivity {
//The name is the only part of this that is used, the rest is generated by the Lambda.
List testList = new List(-1, "New List", "user filled by lambda", Instant.now().toEpochMilli());
//Everything except addedDate is used for ItemEntry
ListEntry entry = new ListEntry(1, 1, new Random().nextInt(), Instant.now().toEpochMilli(),false);
ListEntry entry = new ListEntry(1, 4, Math.abs(new Random().nextInt()), Instant.now().toEpochMilli(),false);
SynchronousReceiver<Integer> idReceiver = new SynchronousReceiver<>();
try {
requestor.postObject(testList, idReceiver, idReceiver);