Skip to content

Commit 5b9eeb2

Browse files
committed
TD-5501 Route fix for GetallbyParent Bookmark dual endpoint
1 parent caac5f1 commit 5b9eeb2

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

OpenAPI/LearningHub.Nhs.OpenApi/Controllers/BookmarkController.cs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,28 @@ public BookmarkController(IBookmarkService bookmarkService)
2424
this.bookmarkService = bookmarkService;
2525
}
2626

27-
/// <summary>
28-
/// <summary>
29-
/// Gets all bookmarks by parent.
30-
/// </summary>
31-
/// <returns>Bookmarks.</returns>
32-
[HttpGet]
33-
[Route("GetAllByParent")]
34-
public async Task<IEnumerable<UserBookmarkViewModel>> GetAllByParent()
35-
{
36-
return await this.bookmarkService.GetAllByParent(this.TokenWithoutBearer);
37-
}
38-
3927
/// <summary>
4028
/// The GetAllByParent.
4129
/// </summary>
4230
/// <param name="parentId">The parentId.</param>
4331
/// <param name="all">The all.</param>
4432
/// <returns>The <see cref="Task{IActionResult}"/>.</returns>
4533
[HttpGet]
34+
[Route("GetAllByParent")]
4635
[Route("GetAllByParent/{parentId?}")]
4736
public async Task<IActionResult> GetAllByParent(int? parentId, bool? all = false)
4837
{
49-
var bookmarks = await this.bookmarkService.GetAllByParent(this.CurrentUserId.GetValueOrDefault(), parentId, all);
50-
return this.Ok(bookmarks);
38+
if (this.CurrentUserId.GetValueOrDefault() != null)
39+
{
40+
var bookmarks = await this.bookmarkService.GetAllByParent(this.CurrentUserId.GetValueOrDefault(), parentId, all);
41+
return this.Ok(bookmarks);
42+
}
43+
else
44+
{
45+
return this.Ok(await this.bookmarkService.GetAllByParent(this.TokenWithoutBearer));
46+
}
5147
}
5248

53-
5449
/// <summary>
5550
/// The Create.
5651
/// </summary>

0 commit comments

Comments
 (0)