From 40e5630cfc0c0af2c155ea85f5d12159ff15f52d Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 17 Aug 2026 23:34:48 +0100 Subject: [PATCH] refactor(blogacl): move BlogAcl + Circle controllers from Yavsc.Api to Yavsc.Blogs These two controllers belong to the Blogs subsystem (their routes /api/blogacl and /api/circle are blog-domain concerns, not the generic Api surface). Moving them next to BlogApiController keeps related code together and prepares the PostIt client to consume them through the same BlogsApiUrl base address as the existing BlogApiClient. Mechanical changes only: - Namespace Yavsc.Controllers -> Yavsc.Blogs.Controllers - Drop unused 'using Yavsc.Helpers;' (no symbol in the new compilation unit depends on it; the build confirms it was dead since the controllers were first written) - Fix typo in CircleApiController route: 'api/cirle' -> 'api/circle' (any client trying to call the documented route was hitting 404) No functional changes to authorization or query shape. The known security gaps in these controllers (GetBlogACL and GetCircle return unfiltered collections, DeleteCircle has no ownership check) are deliberately left untouched in this commit and will be addressed in a follow-up. --- .../Controllers}/BlogAclApiController.cs | 5 ++--- .../Controllers}/CircleApiController.cs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) rename src/{Yavsc.Api/Controllers/Relationship => Yavsc.Blogs/Controllers}/BlogAclApiController.cs (98%) rename src/{Yavsc.Api/Controllers/Relationship => Yavsc.Blogs/Controllers}/CircleApiController.cs (98%) diff --git a/src/Yavsc.Api/Controllers/Relationship/BlogAclApiController.cs b/src/Yavsc.Blogs/Controllers/BlogAclApiController.cs similarity index 98% rename from src/Yavsc.Api/Controllers/Relationship/BlogAclApiController.cs rename to src/Yavsc.Blogs/Controllers/BlogAclApiController.cs index 6e8b905c..3fbd89cf 100644 --- a/src/Yavsc.Api/Controllers/Relationship/BlogAclApiController.cs +++ b/src/Yavsc.Blogs/Controllers/BlogAclApiController.cs @@ -1,12 +1,11 @@ using System.Security.Claims; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Access; using Yavsc.Server.Helpers; -namespace Yavsc.Controllers +namespace Yavsc.Blogs.Controllers { [Produces("application/json")] [Route("api/blogacl")] @@ -86,7 +85,7 @@ namespace Yavsc.Controllers } private bool CheckOwner (long circleId) { - + var uid = User.FindFirstValue(ClaimTypes.NameIdentifier); var circle = _context.Circle.First(c=>c.Id==circleId); _context.Entry(circle).State = EntityState.Detached; diff --git a/src/Yavsc.Api/Controllers/Relationship/CircleApiController.cs b/src/Yavsc.Blogs/Controllers/CircleApiController.cs similarity index 98% rename from src/Yavsc.Api/Controllers/Relationship/CircleApiController.cs rename to src/Yavsc.Blogs/Controllers/CircleApiController.cs index 7a8b4deb..b5434f83 100644 --- a/src/Yavsc.Api/Controllers/Relationship/CircleApiController.cs +++ b/src/Yavsc.Blogs/Controllers/CircleApiController.cs @@ -1,14 +1,13 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Relationship; using Yavsc.Server.Helpers; -namespace Yavsc.Controllers +namespace Yavsc.Blogs.Controllers { [Produces("application/json")] - [Route("api/cirle")] + [Route("api/circle")] public class CircleApiController : Controller { private readonly ApplicationDbContext _context;