👔 Update the automated status logic

This commit is contained in:
2025-09-09 00:01:56 +08:00
parent ab2bdcc7ca
commit 0eeafb5352

View File

@@ -239,7 +239,7 @@ public class AccountCurrentController(
.Where(s => s.ClearedAt == null || s.ClearedAt > now) .Where(s => s.ClearedAt == null || s.ClearedAt > now)
.OrderByDescending(s => s.CreatedAt) .OrderByDescending(s => s.CreatedAt)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (existingStatus is not null) if (existingStatus is not null && existingStatus.IsAutomated)
if (existingStatus.IsAutomated && request.AppIdentifier == existingStatus.AppIdentifier) if (existingStatus.IsAutomated && request.AppIdentifier == existingStatus.AppIdentifier)
{ {
existingStatus.Attitude = request.Attitude; existingStatus.Attitude = request.Attitude;
@@ -256,6 +256,8 @@ public class AccountCurrentController(
db.Update(existingStatus); db.Update(existingStatus);
await db.SaveChangesAsync(); await db.SaveChangesAsync();
} }
else if (existingStatus is not null)
return Ok(existingStatus); // Do not override manually set status with automated ones
} }
var status = new Status var status = new Status