Skip to content

Commit fe236d5

Browse files
davidortinauCopilot
andcommitted
fix: resolve post-merge build errors across WebApp and UI projects
- WebApp: AddMicrosoftIdentityWebApp requires AddAuthentication() first - WebApp: GetAccessTokenForUserAsync parameter name mismatch - UI/Vocabulary: stub unimplemented DuplicateGroup, BulkUpdateLemmas features - Shared: UpdateVocabularyWordTermsAsync takes string PK (not int) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent be5d233 commit fe236d5

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

src/SentenceStudio.Shared/Data/LearningResourceRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public async Task<bool> UpdateVocabularyWordAsync(VocabularyWord word)
744744
/// <summary>
745745
/// Updates vocabulary word terms by ID, avoiding context tracking issues
746746
/// </summary>
747-
public async Task<bool> UpdateVocabularyWordTermsAsync(int wordId, string targetTerm, string nativeTerm)
747+
public async Task<bool> UpdateVocabularyWordTermsAsync(string wordId, string targetTerm, string nativeTerm)
748748
{
749749
using var scope = _serviceProvider.CreateScope();
750750
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();

src/SentenceStudio.UI/Pages/Vocabulary.razor

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,10 @@ else
912912

913913
try
914914
{
915-
duplicateGroups = await ResourceRepo.GetDuplicateGroupsAsync();
916-
cleanupStatus = "";
915+
// TODO: Implement duplicate detection (#future)
916+
duplicateGroups = new List<DuplicateGroup>();
917+
cleanupStatus = "Duplicate detection not yet implemented.";
918+
await Task.CompletedTask;
917919
}
918920
catch (Exception ex)
919921
{
@@ -943,7 +945,7 @@ else
943945
var keeper = sorted.First();
944946
var deleteIds = sorted.Skip(1).Select(w => w.Word.Id).ToList();
945947

946-
int deleted = await ResourceRepo.MergeVocabularyWordsAsync(keeper.Word.Id, deleteIds);
948+
int deleted = 0; // TODO: Implement MergeVocabularyWordsAsync (#future)
947949
cleanupResults.Add($"Merged '{group.NormalizedTerm}': kept 1, removed {deleted}");
948950

949951
duplicateGroups.Remove(group);
@@ -986,7 +988,7 @@ else
986988
var keeper = sorted.First();
987989
var deleteIds = sorted.Skip(1).Select(w => w.Word.Id).ToList();
988990

989-
int deleted = await ResourceRepo.MergeVocabularyWordsAsync(keeper.Word.Id, deleteIds);
991+
int deleted = 0; // TODO: Implement MergeVocabularyWordsAsync (#future)
990992
totalMerged += deleted;
991993
}
992994
catch (Exception ex)
@@ -1090,7 +1092,7 @@ Return JSON like: {{""lemmas"": [{{""id"": 1, ""lemma"": ""dictionary form""}},
10901092

10911093
if (lemmaUpdates.Any())
10921094
{
1093-
int batchUpdated = await ResourceRepo.BulkUpdateLemmasAsync(lemmaUpdates);
1095+
int batchUpdated = 0; // TODO: Implement BulkUpdateLemmasAsync (#future)
10941096
updated += batchUpdated;
10951097
}
10961098
}
@@ -1312,4 +1314,8 @@ Return JSON like: {{""lemmas"": [{{""id"": 1, ""lemma"": ""dictionary form""}},
13121314
_ => "Unknown"
13131315
};
13141316
}
1317+
1318+
private record DuplicateWordInfo(VocabularyWord Word, int ResourceCount, double EncodingScore);
1319+
1320+
private record DuplicateGroup(string NormalizedTerm, List<DuplicateWordInfo> Words);
13151321
}

src/SentenceStudio.WebApp/Auth/AuthenticatedApiDelegatingHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected override async Task<HttpResponseMessage> SendAsync(
2929
?? throw new InvalidOperationException(
3030
"DownstreamApi:Scopes must be configured when Entra ID auth is active.");
3131

32-
var token = await _tokenAcquisition.GetAccessTokenForUserAsync(scopes, cancellationToken: cancellationToken);
32+
var token = await _tokenAcquisition.GetAccessTokenForUserAsync(scopes);
3333
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
3434

3535
return await base.SendAsync(request, cancellationToken);

src/SentenceStudio.WebApp/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using ElevenLabs;
22
using Microsoft.AspNetCore.Authentication;
3+
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
34
using Microsoft.Extensions.AI;
45
using Microsoft.Identity.Web;
56
using Microsoft.Identity.Web.UI;
@@ -62,7 +63,8 @@
6263
+ "Add a 'DownstreamApi:Scopes' array to appsettings.json or user-secrets.");
6364
}
6465

65-
builder.Services.AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"))
66+
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
67+
.AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"))
6668
.EnableTokenAcquisitionToCallDownstreamApi(downstreamScopes)
6769
.AddDistributedTokenCaches();
6870

0 commit comments

Comments
 (0)