mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-10-20 13:21:59 +00:00
fix(observers): preserve advert pages with missing origin keys (#138)
* test(observers): cover adverts with a missing origin key * fix(observers): preserve advert pages with missing origin keys
This commit is contained in:
@@ -151,6 +151,7 @@ type Querier interface {
|
||||
ListObservationsForPacket(ctx context.Context, packetHash []byte) ([]ListObservationsForPacketRow, error)
|
||||
// Returns advert packets (payload_type=4) heard by a specific observer.
|
||||
// Pass cursor=0 to start from the beginning, or the last seen id for pagination.
|
||||
// Keep missing-origin adverts; the generated key field expects a string, not NULL.
|
||||
ListObserverAdverts(ctx context.Context, arg ListObserverAdvertsParams) ([]ListObserverAdvertsRow, error)
|
||||
// Pass cursor=0 to start from the beginning, or the last seen observer's rownum for pagination.
|
||||
// Note: observers use UUID PKs so we order by last_seen and use a keyset on last_seen+id.
|
||||
|
||||
@@ -2860,7 +2860,7 @@ SELECT
|
||||
po.snr,
|
||||
po.hop_count,
|
||||
n.name AS node_name,
|
||||
encode(p.origin_pubkey, 'hex') AS node_public_key
|
||||
COALESCE(encode(p.origin_pubkey, 'hex'), '')::text AS node_public_key
|
||||
FROM packet_observations po
|
||||
JOIN packets p ON p.packet_hash = po.packet_hash
|
||||
LEFT JOIN nodes n ON n.public_key = p.origin_pubkey
|
||||
@@ -2892,6 +2892,7 @@ type ListObserverAdvertsRow struct {
|
||||
|
||||
// Returns advert packets (payload_type=4) heard by a specific observer.
|
||||
// Pass cursor=0 to start from the beginning, or the last seen id for pagination.
|
||||
// Keep missing-origin adverts; the generated key field expects a string, not NULL.
|
||||
func (q *Queries) ListObserverAdverts(ctx context.Context, arg ListObserverAdvertsParams) ([]ListObserverAdvertsRow, error) {
|
||||
rows, err := q.db.Query(ctx, listObserverAdverts, arg.ObserverID, arg.Column2, arg.Limit)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user