From 5b9eeb2f832e6eb0ae43a4177a97f37a1207a908 Mon Sep 17 00:00:00 2001 From: OluwatobiAwe Date: Wed, 18 Jun 2025 09:13:24 +0100 Subject: [PATCH] TD-5501 Route fix for GetallbyParent Bookmark dual endpoint --- .../Controllers/BookmarkController.cs | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/BookmarkController.cs b/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/BookmarkController.cs index c0bb7d4a2..867f295f6 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/BookmarkController.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/BookmarkController.cs @@ -24,18 +24,6 @@ public BookmarkController(IBookmarkService bookmarkService) this.bookmarkService = bookmarkService; } - /// - /// - /// Gets all bookmarks by parent. - /// - /// Bookmarks. - [HttpGet] - [Route("GetAllByParent")] - public async Task> GetAllByParent() - { - return await this.bookmarkService.GetAllByParent(this.TokenWithoutBearer); - } - /// /// The GetAllByParent. /// @@ -43,14 +31,21 @@ public async Task> GetAllByParent() /// The all. /// The . [HttpGet] + [Route("GetAllByParent")] [Route("GetAllByParent/{parentId?}")] public async Task GetAllByParent(int? parentId, bool? all = false) { - var bookmarks = await this.bookmarkService.GetAllByParent(this.CurrentUserId.GetValueOrDefault(), parentId, all); - return this.Ok(bookmarks); + if (this.CurrentUserId.GetValueOrDefault() != null) + { + var bookmarks = await this.bookmarkService.GetAllByParent(this.CurrentUserId.GetValueOrDefault(), parentId, all); + return this.Ok(bookmarks); + } + else + { + return this.Ok(await this.bookmarkService.GetAllByParent(this.TokenWithoutBearer)); + } } - /// /// The Create. ///