mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-10 19:03:24 +00:00
Fix D1 storage: Insert service_id when creating offers
The createOffers function was not inserting the service_id column even though it was passed in the CreateOfferRequest. This caused all offers to have NULL service_id, making getOffersForService return empty results. Fixed: - Added service_id to INSERT statement in createOffers - Added serviceId to created offer objects - Added serviceId to rowToOffer mapping This resolves the 'No available offers' error when trying to connect to a published service.
This commit is contained in:
@@ -115,13 +115,14 @@ export class D1Storage implements Storage {
|
||||
const now = Date.now();
|
||||
|
||||
await this.db.prepare(`
|
||||
INSERT INTO offers (id, peer_id, sdp, created_at, expires_at, last_seen, secret)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
`).bind(id, offer.peerId, offer.sdp, now, offer.expiresAt, now, offer.secret || null).run();
|
||||
INSERT INTO offers (id, peer_id, service_id, sdp, created_at, expires_at, last_seen, secret)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`).bind(id, offer.peerId, offer.serviceId || null, offer.sdp, now, offer.expiresAt, now, offer.secret || null).run();
|
||||
|
||||
created.push({
|
||||
id,
|
||||
peerId: offer.peerId,
|
||||
serviceId: offer.serviceId,
|
||||
sdp: offer.sdp,
|
||||
createdAt: now,
|
||||
expiresAt: offer.expiresAt,
|
||||
@@ -565,6 +566,7 @@ export class D1Storage implements Storage {
|
||||
return {
|
||||
id: row.id,
|
||||
peerId: row.peer_id,
|
||||
serviceId: row.service_id || undefined,
|
||||
sdp: row.sdp,
|
||||
createdAt: row.created_at,
|
||||
expiresAt: row.expires_at,
|
||||
|
||||
Reference in New Issue
Block a user