From ba1a695d533cd40240073b7b94b96c703395c854 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Fri, 5 Jul 2024 04:16:19 +0200 Subject: [PATCH] [backend/api] Refactor FollowRequestResponse --- .../Controllers/Web/FollowRequestController.cs | 2 +- Iceshrimp.Shared/Schemas/Web/FollowRequestResponse.cs | 7 +++++++ Iceshrimp.Shared/Schemas/Web/PaginationWrapper.cs | 4 +--- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 Iceshrimp.Shared/Schemas/Web/FollowRequestResponse.cs diff --git a/Iceshrimp.Backend/Controllers/Web/FollowRequestController.cs b/Iceshrimp.Backend/Controllers/Web/FollowRequestController.cs index f4e781ce..22ca88a8 100644 --- a/Iceshrimp.Backend/Controllers/Web/FollowRequestController.cs +++ b/Iceshrimp.Backend/Controllers/Web/FollowRequestController.cs @@ -40,7 +40,7 @@ public class FollowRequestController( var users = await userRenderer.RenderMany(requests.Select(p => p.Follower)); var res = requests.Select(p => new FollowRequestResponse { - Id = p.Id, Entity = users.First(u => u.Id == p.Follower.Id) + Id = p.Id, User = users.First(u => u.Id == p.Follower.Id) }); return Ok(res.ToList()); } diff --git a/Iceshrimp.Shared/Schemas/Web/FollowRequestResponse.cs b/Iceshrimp.Shared/Schemas/Web/FollowRequestResponse.cs new file mode 100644 index 00000000..004c3722 --- /dev/null +++ b/Iceshrimp.Shared/Schemas/Web/FollowRequestResponse.cs @@ -0,0 +1,7 @@ +namespace Iceshrimp.Shared.Schemas.Web; + +public class FollowRequestResponse +{ + public required string Id { get; set; } + public required UserResponse User { get; set; } +} \ No newline at end of file diff --git a/Iceshrimp.Shared/Schemas/Web/PaginationWrapper.cs b/Iceshrimp.Shared/Schemas/Web/PaginationWrapper.cs index 6f29600a..eebfa5b0 100644 --- a/Iceshrimp.Shared/Schemas/Web/PaginationWrapper.cs +++ b/Iceshrimp.Shared/Schemas/Web/PaginationWrapper.cs @@ -4,6 +4,4 @@ public class PaginationWrapper { public required string Id { get; set; } public required T Entity { get; set; } -} - -public class FollowRequestResponse : PaginationWrapper; \ No newline at end of file +} \ No newline at end of file