[backend] Code cleanup
This commit is contained in:
parent
c290c546f4
commit
d0eaf13b6b
4 changed files with 12 additions and 16 deletions
|
@ -8,7 +8,6 @@ using Iceshrimp.Backend.Core.Database;
|
||||||
using Iceshrimp.Backend.Core.Database.Tables;
|
using Iceshrimp.Backend.Core.Database.Tables;
|
||||||
using Iceshrimp.Backend.Core.Extensions;
|
using Iceshrimp.Backend.Core.Extensions;
|
||||||
using Iceshrimp.Backend.Core.Middleware;
|
using Iceshrimp.Backend.Core.Middleware;
|
||||||
using Iceshrimp.Backend.Core.Services;
|
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.RateLimiting;
|
using Microsoft.AspNetCore.RateLimiting;
|
||||||
|
@ -23,7 +22,7 @@ namespace Iceshrimp.Backend.Controllers.Mastodon;
|
||||||
[EnableRateLimiting("sliding")]
|
[EnableRateLimiting("sliding")]
|
||||||
[EnableCors("mastodon")]
|
[EnableCors("mastodon")]
|
||||||
[Produces(MediaTypeNames.Application.Json)]
|
[Produces(MediaTypeNames.Application.Json)]
|
||||||
public class TimelineController(DatabaseContext db, NoteRenderer noteRenderer, CacheService cache) : ControllerBase
|
public class TimelineController(DatabaseContext db, NoteRenderer noteRenderer) : ControllerBase
|
||||||
{
|
{
|
||||||
[Authorize("read:statuses")]
|
[Authorize("read:statuses")]
|
||||||
[HttpGet("home")]
|
[HttpGet("home")]
|
||||||
|
|
|
@ -7,7 +7,6 @@ using Iceshrimp.Backend.Core.Database;
|
||||||
using Iceshrimp.Backend.Core.Database.Tables;
|
using Iceshrimp.Backend.Core.Database.Tables;
|
||||||
using Iceshrimp.Backend.Core.Extensions;
|
using Iceshrimp.Backend.Core.Extensions;
|
||||||
using Iceshrimp.Backend.Core.Middleware;
|
using Iceshrimp.Backend.Core.Middleware;
|
||||||
using Iceshrimp.Backend.Core.Services;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.RateLimiting;
|
using Microsoft.AspNetCore.RateLimiting;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
@ -19,7 +18,7 @@ namespace Iceshrimp.Backend.Controllers;
|
||||||
[EnableRateLimiting("sliding")]
|
[EnableRateLimiting("sliding")]
|
||||||
[Route("/api/iceshrimp/timelines")]
|
[Route("/api/iceshrimp/timelines")]
|
||||||
[Produces(MediaTypeNames.Application.Json)]
|
[Produces(MediaTypeNames.Application.Json)]
|
||||||
public class TimelineController(DatabaseContext db, CacheService cache, NoteRenderer noteRenderer) : ControllerBase
|
public class TimelineController(DatabaseContext db, NoteRenderer noteRenderer) : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet("home")]
|
[HttpGet("home")]
|
||||||
[Authenticate]
|
[Authenticate]
|
||||||
|
|
|
@ -9,7 +9,6 @@ using Iceshrimp.Backend.Controllers.Schemas;
|
||||||
using Iceshrimp.Backend.Core.Database;
|
using Iceshrimp.Backend.Core.Database;
|
||||||
using Iceshrimp.Backend.Core.Database.Tables;
|
using Iceshrimp.Backend.Core.Database.Tables;
|
||||||
using Iceshrimp.Backend.Core.Middleware;
|
using Iceshrimp.Backend.Core.Middleware;
|
||||||
using Iceshrimp.Backend.Core.Services;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
@ -592,7 +591,7 @@ public static class QueryableExtensions
|
||||||
return query.FilterByPublicTimelineRequest(request);
|
return query.FilterByPublicTimelineRequest(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable CS8602 // Dereference of a possibly null reference.
|
#pragma warning disable CS8602 // Dereference of a possibly null reference.
|
||||||
// Justification: in the context of nullable EF navigation properties, null values are ignored and therefore irrelevant.
|
// Justification: in the context of nullable EF navigation properties, null values are ignored and therefore irrelevant.
|
||||||
// Source: https://learn.microsoft.com/en-us/ef/core/miscellaneous/nullable-reference-types#navigating-and-including-nullable-relationships
|
// Source: https://learn.microsoft.com/en-us/ef/core/miscellaneous/nullable-reference-types#navigating-and-including-nullable-relationships
|
||||||
|
|
||||||
|
@ -643,5 +642,5 @@ public static class QueryableExtensions
|
||||||
.Include(p => p.FollowRequest.Followee.UserProfile);
|
.Include(p => p.FollowRequest.Followee.UserProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning restore CS8602 // Dereference of a possibly null reference.
|
#pragma warning restore CS8602 // Dereference of a possibly null reference.
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
using Iceshrimp.Backend.Core.Database;
|
using Iceshrimp.Backend.Core.Database;
|
||||||
using Iceshrimp.Backend.Core.Database.Tables;
|
using Iceshrimp.Backend.Core.Database.Tables;
|
||||||
using Iceshrimp.Backend.Core.Middleware;
|
using Iceshrimp.Backend.Core.Middleware;
|
||||||
using Iceshrimp.Backend.Core.Queues;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
Loading…
Add table
Reference in a new issue