Using OutboundP2PMessage's from /lib.
Depends on D12079
Paths
| Differential D12080 Authored by kamil on May 16 2024, 10:18 AM.
Details Summary Using OutboundP2PMessage's from /lib. Depends on D12079 Test Plan Added some messages from C++ code: OutboundP2PMessage msg1 = { "message_001", "device_01", "user_01", "1609459200", "Hello, world!", "SGVsbG8sIHdvcmxkIQ==", "encrypted" }; OutboundP2PMessage msg2 = { "message_002", "device_01", "user_02", "1609459201", "Goodbye, world!", "R29vZGJ5ZSwgd29ybGQh", "encrypted"}; OutboundP2PMessage msg3 = { "message_003", "device_03", "user_03", "1609459202", "Hello again, world!", "SGVsbG8gYWdhaW4sIHdvcmxkIQ==", "encrypted"}; const std::vector<OutboundP2PMessage> messages = {msg1, msg2, msg3}; static std::string addMessage = "REPLACE INTO outbound_p2p_messages (" " message_id, device_id, user_id, timestamp, plaintext, ciphertext, " "status" ") " "VALUES (?, ?, ?, ?, ?, ?, ?);"; for (const OutboundP2PMessage &clientMessage : messages) { SQLiteOutboundP2PMessage message = clientMessage.toSQLiteOutboundP2PMessage(); replaceEntity<SQLiteOutboundP2PMessage>( SQLiteQueryExecutor::getConnection(), addMessage, message); } Execute this code from /lib: const m1 = await sqliteAPI.getAllOutboundP2PMessage(); console.log(m1); const msg: OutboundP2PMessage = m1[1]; await sqliteAPI.markOutboundP2PMessageAsSent(msg.messageID, msg.deviceID); const m2 = await sqliteAPI.getAllOutboundP2PMessage(); console.log(m2); await sqliteAPI.removeOutboundP2PMessagesOlderThan( msg.messageID, msg.deviceID, ); const m3 = await sqliteAPI.getAllOutboundP2PMessage(); console.log(m3); And verify results on both web and native
Diff Detail
Event Timelinekamil held this revision as a draft. Herald added a subscriber: ashoat. · View Herald TranscriptMay 16 2024, 10:18 AM2024-05-16 10:18:27 (UTC-7) Harbormaster completed remote builds in B28995: Diff 40299.May 16 2024, 10:33 AM2024-05-16 10:33:38 (UTC-7) kamil edited the test plan for this revision. (Show Details)May 17 2024, 3:25 AM2024-05-17 03:25:07 (UTC-7) This revision is now accepted and ready to land.May 17 2024, 6:36 AM2024-05-17 06:36:47 (UTC-7) Closed by commit rCOMM5ef4977af924: [lib] implement Outbound P2P Messages API in `SQLiteAPI` (authored by kamil). · Explain WhyMay 23 2024, 9:02 AM2024-05-23 09:02:28 (UTC-7) This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 40299 lib/types/sqlite-types.js
lib/utils/__mocks__/config.js
native/database/sqlite-api.js
web/database/sqlite-api.js
|