added offers list to api

This commit is contained in:
2026-04-02 19:32:17 -04:00
parent 5a69ea627e
commit 9a6fcfb6de
2 changed files with 13 additions and 1 deletions

View File

@@ -24,6 +24,12 @@ public static class RtcEndpoints
await rtcCallService.WriteOfferAsync(request.ChannelId, request.Username, request.Sdp);
return Results.Ok();
});
// List all offers.
app.MapGet("/api/rtc/offers", async (RtcCallService rtcCallService) =>
{
return Results.Ok(await rtcCallService.GetOffersAsync());
});
// Return whether the specified channel currently has an active call.
app.MapGet("/api/rtc/active/{channelId}", async (string channelId, RtcCallService rtcCallService) =>
@@ -32,7 +38,7 @@ public static class RtcEndpoints
});
// Return the latest stored SDP offer for the specified channel.
app.MapGet("/api/rtc/offer/{channelId}", async (string channelId, RtcCallService rtcCallService) =>
app.MapGet("/api/rtc/offers/{channelId}", async (string channelId, RtcCallService rtcCallService) =>
{
var offer = await rtcCallService.GetOfferAsync(channelId);
return offer is null ? Results.NotFound() : Results.Ok(offer);

View File

@@ -279,4 +279,10 @@ public sealed class RtcCallService
await _db.Merge<RtcActiveCall, RtcActiveCall>(activeCall);
}
}
public async Task<object?> GetOffersAsync()
{
var offers = await _db.Select<RtcOffer>("rtc_offers");
return offers;
}
}