changed login flow to support 2 phase program selection login.

This commit is contained in:
2026-02-21 15:40:04 -08:00
parent d90eefacdd
commit 043ff337c1
14 changed files with 280 additions and 44 deletions
@@ -11,6 +11,7 @@ public class AuthRepository
public async Task<Guid?> CreateRefreshTokenAsync(
Guid refreshTokenId,
Guid userId,
Guid programId,
string tokenHash,
string tokenSalt,
int expiresInSeconds,
@@ -24,6 +25,7 @@ public class AuthRepository
{
p_id_refresh_token = refreshTokenId.ToString(),
p_id_user = userId.ToString(),
p_id_program = programId.ToString(),
p_token_hash = tokenHash,
p_token_salt = tokenSalt,
p_expires_in_seconds = expiresInSeconds,
@@ -57,6 +59,7 @@ public class AuthRepository
Guid oldTokenId,
Guid newTokenId,
Guid userId,
Guid programId,
string tokenHash,
string tokenSalt,
int expiresInSeconds,
@@ -71,6 +74,7 @@ public class AuthRepository
p_old_token_id = oldTokenId.ToString(),
p_id_refresh_token = newTokenId.ToString(),
p_id_user = userId.ToString(),
p_id_program = programId.ToString(),
p_token_hash = tokenHash,
p_token_salt = tokenSalt,
p_expires_in_seconds = expiresInSeconds,
@@ -25,4 +25,22 @@ public class UserRepository
new { p_id_user = idUser.ToString() },
commandType: CommandType.StoredProcedure);
}
public async Task<dbProgramUser?> GetByIdWithProgramAsync(Guid idUser, Guid idProgram)
{
using var db = Connection;
return await db.QuerySingleOrDefaultAsync<dbProgramUser>(
"sp_User_GetById_WithProgram",
new { p_id_user = idUser.ToString(), p_id_program = idProgram.ToString() },
commandType: CommandType.StoredProcedure);
}
public async Task<IEnumerable<dbUserProgram>> GetProgramsForUserIdAsync(Guid idUser)
{
using var db = Connection;
return await db.QueryAsync<dbUserProgram>(
"sp_UserPrograms_GetByUserId",
new { p_id_user = idUser.ToString() },
commandType: CommandType.StoredProcedure);
}
}