fix failed expired api-key recovery route preservation (#421)

This commit is contained in:
Cita
2026-04-05 17:41:35 +08:00
committed by GitHub
parent 9045a488f0
commit afbbc4c79a
2 changed files with 31 additions and 2 deletions
+10 -1
View File
@@ -17,6 +17,11 @@ type AccountUpdateWorkflowInput = {
};
export async function applyAccountUpdateWorkflow(input: AccountUpdateWorkflowInput) {
const isExpiredApiKeyRecoveryFlow = Boolean(
input.preserveExpiredStatus
&& input.allowInactiveModelRefresh
&& input.reactivateAfterSuccessfulModelRefresh,
);
const persistedUpdates: Partial<typeof schema.accounts.$inferInsert> = {
...input.updates,
...(input.preserveExpiredStatus ? { status: 'expired' } : {}),
@@ -51,7 +56,11 @@ export async function applyAccountUpdateWorkflow(input: AccountUpdateWorkflowInp
.run();
}
await rebuildRoutesBestEffort();
const shouldRebuildRoutes = !isExpiredApiKeyRecoveryFlow
|| convergence.modelRefreshResult?.status === 'success';
if (shouldRebuildRoutes) {
await rebuildRoutesBestEffort();
}
const account = await db.select()
.from(schema.accounts)