fix(strava): clear the backfill markers when the connection is removed

Disconnecting Strava, or deleting its credentials, cleared the tokens
and the athlete but kept stravaBackfillCompletedAt and
stravaBackfillResumeBefore. A later connection inherited them: a
completed marker kept its history from being read, and a resume point
started its first walk below the previous account's oldest activity.
Both paths now clear one shared set of columns.
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 11:02:50 +02:00
1 parent 742705eadd
commit bd00845be3
5 files changed
+95 -13

No files matched your search

+16
View File
@@ -70,6 +70,22 @@ export async function clearStravaClientCredentials(
});
}
/**
* The `User` columns a removed Strava connection leaves behind: no tokens, no
* athlete, and no backfill state. The backfill markers belong to the account
* that was connected. Left standing, a later connection inherited them: a
* completed marker kept its history from ever being read, and a resume point
* made its first run start below the old account's oldest activity, so
* everything newer was never asked for.
*/
export const STRAVA_DISCONNECTED = {
stravaAccessTokenEncrypted: null,
stravaRefreshTokenEncrypted: null,
stravaAthleteId: null,
stravaBackfillCompletedAt: null,
stravaBackfillResumeBefore: null,
} as const;
export interface StravaConnection {
accessToken: string;
refreshToken: string;