refactor(api): use convenience methods

This commit is contained in:
Stevan Freeborn
2026-02-13 12:38:18 -06:00
parent 2fd55a55cd
commit 5192c06627
+2 -10
View File
@@ -34,20 +34,12 @@ internal static class Endpoint
if (user is null)
{
return Results.Problem(
statusCode: StatusCodes.Status401Unauthorized,
title: "Unauthorized",
detail: "You are not authorized to connect an institution. Please log in and try again."
);
return Results.Unauthorized();
}
if (user.Institutions.Any())
{
return Results.Problem(
statusCode: StatusCodes.Status409Conflict,
title: "Institution already connected",
detail: "The user has already connected an institution with the provided Plaid Institution Id."
);
return Results.Conflict();
}
var (itemId, accessToken) = await plaidService.ExchangeTokenAsync(request.PublicToken);