Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 7b33c01

Browse files
stream browser resource
1 parent 91c182a commit 7b33c01

4 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/SqlStreamStore.HAL/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static class Streams
7272
public static PathString AllStreamPath = new PathString($"/{All}");
7373
public static PathString StreamsPath = new PathString($"/{Stream}");
7474
public static PathString IndexPath = new PathString("/");
75-
public static PathString StreamBrowserPath = AllStreamPath.Add("/list");
75+
public static PathString StreamBrowserPath = AllStreamPath.Add("/browser");
7676
}
7777

7878
public static class ReadDirection

src/SqlStreamStore.HAL/LinksExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ public static Links Find(this Links links)
99
=> links.Add(Constants.Relations.Find, "streams/{streamId}", "Find a Stream");
1010

1111
public static Links Browse(this Links links)
12-
=> links.Add(Constants.Relations.Browse, "stream/browse{?p,t,m}", "Browse Streams");
12+
=> links.Add(Constants.Relations.Browse, "stream/browser{?p,t,m}", "Browse Streams");
1313
}
1414
}

src/SqlStreamStore.HAL/StreamBrowser/ListStreamsMiddleware.cs renamed to src/SqlStreamStore.HAL/StreamBrowser/StreamBrowserMiddleware.cs

File renamed without changes.

src/SqlStreamStore.HAL/StreamBrowser/StreamBrowserResource.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,22 @@ public async Task<Response> Get(ListStreamsOperation operation, CancellationToke
2323
{
2424
listStreamsPage.ContinuationToken
2525
})
26+
.AddLinks(
27+
Links
28+
.FromOperation(operation)
29+
.Index()
30+
.Find()
31+
.StreamBrowserNavigation(listStreamsPage, operation))
2632
.AddEmbeddedCollection(
2733
Constants.Relations.Feed,
2834
Array.ConvertAll(
2935
listStreamsPage.StreamIds,
30-
streamId =>
31-
{
32-
return new HALResponse(null)
33-
.AddLinks(
34-
Links
35-
.FromOperation(operation)
36-
.Index()
37-
.Find()
38-
.StreamBrowserNavigation(listStreamsPage, operation));
39-
}
40-
)));
36+
streamId => new HALResponse(null)
37+
.AddLinks(
38+
Links
39+
.FromOperation(operation)
40+
.Add(Constants.Relations.Feed, $"{Constants.Streams.Stream}/{streamId}", streamId)
41+
.Self()))));
4142
}
4243
}
4344
}

0 commit comments

Comments
 (0)