♻️ No idea, but errors all gone
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
			
		||||
using System.ComponentModel.DataAnnotations;
 | 
			
		||||
using DysonNetwork.Shared.Services;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
 | 
			
		||||
@@ -6,7 +7,7 @@ namespace DysonNetwork.Sphere.Connection;
 | 
			
		||||
 | 
			
		||||
[ApiController]
 | 
			
		||||
[Route("completion")]
 | 
			
		||||
public class AutoCompletionController(AppDatabase db)
 | 
			
		||||
public class AutoCompletionController(IAccountService accounts, AppDatabase db)
 | 
			
		||||
    : ControllerBase
 | 
			
		||||
{
 | 
			
		||||
    [HttpPost]
 | 
			
		||||
@@ -38,19 +39,15 @@ public class AutoCompletionController(AppDatabase db)
 | 
			
		||||
 | 
			
		||||
    private async Task<List<CompletionItem>> GetAccountCompletions(string searchTerm)
 | 
			
		||||
    {
 | 
			
		||||
        return await db.Accounts
 | 
			
		||||
            .Where(a => EF.Functions.ILike(a.Name, $"%{searchTerm}%"))
 | 
			
		||||
            .OrderBy(a => a.Name)
 | 
			
		||||
            .Take(10)
 | 
			
		||||
            .Select(a => new CompletionItem
 | 
			
		||||
            {
 | 
			
		||||
                Id = a.Id.ToString(),
 | 
			
		||||
                DisplayName = a.Name,
 | 
			
		||||
                SecondaryText = a.Nick,
 | 
			
		||||
                Type = "account",
 | 
			
		||||
                Data = a
 | 
			
		||||
            })
 | 
			
		||||
            .ToListAsync();
 | 
			
		||||
        var data = await accounts.SearchAccountsAsync(searchTerm);
 | 
			
		||||
        return data.Select(a => new CompletionItem
 | 
			
		||||
        {
 | 
			
		||||
            Id = a.Id.ToString(),
 | 
			
		||||
            DisplayName = a.Name,
 | 
			
		||||
            SecondaryText = a.Nick,
 | 
			
		||||
            Type = "account",
 | 
			
		||||
            Data = a
 | 
			
		||||
        }).ToList();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task<List<CompletionItem>> GetStickerCompletions(string searchTerm)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
using System.ComponentModel.DataAnnotations;
 | 
			
		||||
using System.ComponentModel.DataAnnotations.Schema;
 | 
			
		||||
using System.Text.Json.Serialization;
 | 
			
		||||
using DysonNetwork.Shared.Models;
 | 
			
		||||
 | 
			
		||||
namespace DysonNetwork.Sphere.Connection.WebReader;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
using DysonNetwork.Sphere.Permission;
 | 
			
		||||
using DysonNetwork.Shared.Permission;
 | 
			
		||||
using Microsoft.AspNetCore.Authorization;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
using Microsoft.AspNetCore.RateLimiting;
 | 
			
		||||
@@ -59,7 +59,7 @@ public class WebReaderController(WebReaderService reader, ILogger<WebReaderContr
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [HttpDelete("link/cache")]
 | 
			
		||||
    [Authorize]
 | 
			
		||||
    [RequiredPermissionAttribute("maintenance", "cache.scrap")]
 | 
			
		||||
    [DysonNetwork.Shared.Permission.RequiredPermission("maintenance", "cache.scrap")]
 | 
			
		||||
    public async Task<IActionResult> InvalidateCache([FromQuery] string url)
 | 
			
		||||
    {
 | 
			
		||||
        if (string.IsNullOrEmpty(url))
 | 
			
		||||
@@ -76,7 +76,7 @@ public class WebReaderController(WebReaderService reader, ILogger<WebReaderContr
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [HttpDelete("cache/all")]
 | 
			
		||||
    [Authorize]
 | 
			
		||||
    [RequiredPermissionAttribute("maintenance", "cache.scrap")]
 | 
			
		||||
    [DysonNetwork.Shared.Permission.RequiredPermission("maintenance", "cache.scrap")]
 | 
			
		||||
    public async Task<IActionResult> InvalidateAllCache()
 | 
			
		||||
    {
 | 
			
		||||
        await reader.InvalidateAllCachedPreviewsAsync();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user