From 5ec8d895637bf97d649277fb6e75d62b3f660934 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 9 Sep 2025 00:09:37 +0800 Subject: [PATCH] :sparkles: Able to only remove automated status --- DysonNetwork.Pass/Account/AccountCurrentController.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DysonNetwork.Pass/Account/AccountCurrentController.cs b/DysonNetwork.Pass/Account/AccountCurrentController.cs index 19e71d1..63a80e2 100644 --- a/DysonNetwork.Pass/Account/AccountCurrentController.cs +++ b/DysonNetwork.Pass/Account/AccountCurrentController.cs @@ -276,15 +276,21 @@ public class AccountCurrentController( } [HttpDelete("statuses")] - public async Task DeleteStatus() + public async Task DeleteStatus([FromQuery] string? app) { if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var now = SystemClock.Instance.GetCurrentInstant(); - var status = await db.AccountStatuses + var queryable = db.AccountStatuses .Where(s => s.AccountId == currentUser.Id) .Where(s => s.ClearedAt == null || s.ClearedAt > now) .OrderByDescending(s => s.CreatedAt) + .AsQueryable(); + + if (string.IsNullOrWhiteSpace(app)) + queryable = queryable.Where(s => s.IsAutomated && s.AppIdentifier == app); + + var status = await queryable .FirstOrDefaultAsync(); if (status is null) return NotFound();