Private
Public Access
1
0

Add Re-sync button for SimpleFIN connections

Resets LastSyncAt on all linked accounts so the next sync
re-fetches the full 90-day transaction window. Duplicate
detection prevents re-importing existing transactions.

- POST /api/bank-sync/connections/{id}/reset-sync endpoint
- Re-sync button shown only on SimpleFIN connection cards

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Catherine Renelle
2026-02-09 19:29:15 -05:00
parent 8b2f5aad56
commit 5811588698
5 changed files with 53 additions and 0 deletions
@@ -74,6 +74,13 @@ public class BankSyncController : ControllerBase
public async Task<ActionResult<LinkedAccountResponse>> UpdateLinkedAccount(Guid id, UpdateLinkedAccountRequest request)
=> Ok(await _bankSyncService.UpdateLinkedAccountAsync(UserId, id, request));
[HttpPost("connections/{id}/reset-sync")]
public async Task<IActionResult> ResetSync(Guid id)
{
await _bankSyncService.ResetSyncDatesAsync(UserId, id);
return NoContent();
}
[HttpPost("connections/{id}/sync-now")]
public IActionResult SyncNow(Guid id)
{
@@ -311,6 +311,23 @@ public class BankSyncService : IBankSyncService
// --- Sync ---
public async Task ResetSyncDatesAsync(Guid userId, Guid connectionId)
{
var connection = await _db.SyncConnections
.Include(c => c.LinkedAccounts)
.FirstOrDefaultAsync(c => c.Id == connectionId && c.UserId == userId)
?? throw new KeyNotFoundException("Connection not found");
foreach (var la in connection.LinkedAccounts)
{
la.LastSyncAt = null;
}
connection.LastSyncAt = null;
connection.UpdatedAt = DateTime.UtcNow;
await _db.SaveChangesAsync();
}
public async Task<SyncResultResponse> SyncNowAsync(Guid userId, Guid connectionId)
{
var connection = await _db.SyncConnections
@@ -28,6 +28,7 @@ public interface IBankSyncService
// Sync
Task<SyncResultResponse> SyncNowAsync(Guid userId, Guid connectionId);
Task ResetSyncDatesAsync(Guid userId, Guid connectionId);
Task<SyncResultResponse> SyncAllAsync(Guid userId);
// Logs