From eda7804f9fa5ff467ee1037257c8a0899854c4b3 Mon Sep 17 00:00:00 2001 From: Veljko Tosic Date: Wed, 18 Feb 2026 20:21:05 +0100 Subject: [PATCH 1/4] For getting whiteboard info --- .../Query/GetWhiteboard/GetWhiteboardQuery.cs | 5 ++++ .../GetWhiteboardQueryHandler.cs | 23 +++++++++++++++++++ .../Controllers/WhiteboardController.cs | 15 +++++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 dotnet/AipsCore/Application/Models/Whiteboard/Query/GetWhiteboard/GetWhiteboardQuery.cs create mode 100644 dotnet/AipsCore/Application/Models/Whiteboard/Query/GetWhiteboard/GetWhiteboardQueryHandler.cs diff --git a/dotnet/AipsCore/Application/Models/Whiteboard/Query/GetWhiteboard/GetWhiteboardQuery.cs b/dotnet/AipsCore/Application/Models/Whiteboard/Query/GetWhiteboard/GetWhiteboardQuery.cs new file mode 100644 index 0000000..f7bf3e6 --- /dev/null +++ b/dotnet/AipsCore/Application/Models/Whiteboard/Query/GetWhiteboard/GetWhiteboardQuery.cs @@ -0,0 +1,5 @@ +using AipsCore.Application.Abstract.Query; + +namespace AipsCore.Application.Models.Whiteboard.Query.GetWhiteboard; + +public record GetWhiteboardQuery(string WhiteboardId) : IQuery; \ No newline at end of file diff --git a/dotnet/AipsCore/Application/Models/Whiteboard/Query/GetWhiteboard/GetWhiteboardQueryHandler.cs b/dotnet/AipsCore/Application/Models/Whiteboard/Query/GetWhiteboard/GetWhiteboardQueryHandler.cs new file mode 100644 index 0000000..af3cc85 --- /dev/null +++ b/dotnet/AipsCore/Application/Models/Whiteboard/Query/GetWhiteboard/GetWhiteboardQueryHandler.cs @@ -0,0 +1,23 @@ +using AipsCore.Application.Abstract.Query; +using AipsCore.Infrastructure.Persistence.Db; +using Microsoft.EntityFrameworkCore; + +namespace AipsCore.Application.Models.Whiteboard.Query.GetWhiteboard; + +public class GetWhiteboardQueryHandler + : IQueryHandler +{ + private readonly AipsDbContext _context; + + public GetWhiteboardQueryHandler(AipsDbContext context) + { + _context = context; + } + + public async Task Handle(GetWhiteboardQuery query, CancellationToken cancellationToken = default) + { + return await _context.Whiteboards + .Where(w => w.Id.ToString() == query.WhiteboardId) + .FirstOrDefaultAsync(cancellationToken); + } +} \ No newline at end of file diff --git a/dotnet/AipsWebApi/Controllers/WhiteboardController.cs b/dotnet/AipsWebApi/Controllers/WhiteboardController.cs index 44467bd..0bbc8d3 100644 --- a/dotnet/AipsWebApi/Controllers/WhiteboardController.cs +++ b/dotnet/AipsWebApi/Controllers/WhiteboardController.cs @@ -1,6 +1,7 @@ using AipsCore.Application.Abstract; using AipsCore.Application.Models.Whiteboard.Command.CreateWhiteboard; using AipsCore.Application.Models.Whiteboard.Query.GetRecentWhiteboards; +using AipsCore.Application.Models.Whiteboard.Query.GetWhiteboard; using AipsCore.Application.Models.Whiteboard.Query.GetWhiteboardHistory; using AipsCore.Application.Models.WhiteboardMembership.Command.CreateWhiteboardMembership; using Microsoft.AspNetCore.Authorization; @@ -22,11 +23,23 @@ public class WhiteboardController : ControllerBase [Authorize] [HttpPost] - public async Task> CreateWhiteboard(CreateWhiteboardCommand command, CancellationToken cancellationToken) + public async Task> CreateWhiteboard(CreateWhiteboardCommand command, CancellationToken cancellationToken) { var whiteboardId = await _dispatcher.Execute(command, cancellationToken); return Ok(whiteboardId.IdValue); } + + [Authorize] + [HttpGet("{whiteboardId}")] + public async Task> GetWhiteboardById([FromRoute] string whiteboardId, CancellationToken cancellationToken) + { + var whiteboard = await _dispatcher.Execute(new GetWhiteboardQuery(whiteboardId), cancellationToken); + if (whiteboard == null) + { + return NotFound(); + } + return Ok(whiteboard); + } [Authorize] [HttpGet("history")] From 21d5322024787a0afc2aee85469d7371e474550f Mon Sep 17 00:00:00 2001 From: Veljko Tosic Date: Wed, 18 Feb 2026 20:22:05 +0100 Subject: [PATCH 2/4] RT not to open browser --- dotnet/AipsRT/Properties/launchSettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/AipsRT/Properties/launchSettings.json b/dotnet/AipsRT/Properties/launchSettings.json index 5d70556..e76400f 100644 --- a/dotnet/AipsRT/Properties/launchSettings.json +++ b/dotnet/AipsRT/Properties/launchSettings.json @@ -4,7 +4,7 @@ "http": { "commandName": "Project", "dotnetRunMessages": true, - "launchBrowser": true, + "launchBrowser": false, "applicationUrl": "http://localhost:5039", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" From 7bae0d4dd64a0da50b6c3b54c9c5a6828e228bc9 Mon Sep 17 00:00:00 2001 From: Veljko Tosic Date: Wed, 18 Feb 2026 20:22:58 +0100 Subject: [PATCH 3/4] RT would not work for me without this --- .../DI/UserContextRegistrationExtension.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dotnet/AipsCore/Infrastructure/DI/UserContextRegistrationExtension.cs b/dotnet/AipsCore/Infrastructure/DI/UserContextRegistrationExtension.cs index 76a3e13..adbae92 100644 --- a/dotnet/AipsCore/Infrastructure/DI/UserContextRegistrationExtension.cs +++ b/dotnet/AipsCore/Infrastructure/DI/UserContextRegistrationExtension.cs @@ -64,6 +64,23 @@ public static class UserContextRegistrationExtension IssuerSigningKey = new SymmetricSecurityKey( Encoding.UTF8.GetBytes(jwtSettings.Key)) }; + + options.Events = new JwtBearerEvents + { + OnMessageReceived = context => + { + var accessToken = context.Request.Query["access_token"]; + var path = context.HttpContext.Request.Path; + + if (!string.IsNullOrEmpty(accessToken) && + path.StartsWithSegments("/hubs")) + { + context.Token = accessToken; + } + + return Task.CompletedTask; + } + }; }); services.AddAuthorization(); From cae724f2d6ba5841317adb57b60f70194e8ed900 Mon Sep 17 00:00:00 2001 From: Veljko Tosic Date: Wed, 18 Feb 2026 20:24:27 +0100 Subject: [PATCH 4/4] Added creating new whiteboards from home screen, refactoring --- .../src/components/RecentWhiteboardsList.vue | 4 +-- .../src/components/WhiteboardHistoryList.vue | 4 +-- front/src/router/index.ts | 5 +++- front/src/services/api.ts | 4 --- front/src/services/whiteboardService.ts | 12 ++++++-- front/src/stores/auth.ts | 4 +-- front/src/stores/whiteboards.ts | 22 +++++++++++++- front/src/views/HomeView.vue | 30 ++++++++++++++++++- front/src/views/WhiteboardView.vue | 7 +++-- front/vite.config.ts | 2 +- 10 files changed, 76 insertions(+), 18 deletions(-) diff --git a/front/src/components/RecentWhiteboardsList.vue b/front/src/components/RecentWhiteboardsList.vue index ef287d0..0b4d38d 100644 --- a/front/src/components/RecentWhiteboardsList.vue +++ b/front/src/components/RecentWhiteboardsList.vue @@ -2,11 +2,11 @@ import { onMounted, computed } from 'vue' import { useRouter } from 'vue-router' -import { useWhiteboardStore } from '@/stores/whiteboards' +import { useWhiteboardsStore } from '@/stores/whiteboards' import RecentWhiteboardsItem from './RecentWhiteboardsItem.vue' const router = useRouter() -const store = useWhiteboardStore() +const store = useWhiteboardsStore() onMounted(() => { if (store.recentWhiteboards.length === 0) store.getRecentWhiteboards() diff --git a/front/src/components/WhiteboardHistoryList.vue b/front/src/components/WhiteboardHistoryList.vue index 08cf636..5097d4a 100644 --- a/front/src/components/WhiteboardHistoryList.vue +++ b/front/src/components/WhiteboardHistoryList.vue @@ -1,11 +1,11 @@