Fix update AgentName

This commit is contained in:
2025-09-24 11:35:40 +07:00
parent 68350e3c24
commit 44846a1817
6 changed files with 65 additions and 0 deletions

View File

@@ -297,4 +297,25 @@ public class AgentSummaryRepository : IAgentSummaryRepository
return agentSummaries.Select(MapToDomain);
}
public async Task UpdateAgentNameAsync(int userId, string agentName)
{
var entity = await _context.AgentSummaries
.FirstOrDefaultAsync(a => a.UserId == userId);
if (entity != null)
{
entity.AgentName = agentName;
entity.UpdatedAt = DateTime.UtcNow;
await _context.SaveChangesAsync();
_logger.LogInformation("Agent name updated for user {UserId} to {AgentName}", userId, agentName);
}
else
{
_logger.LogWarning("No AgentSummary found for user {UserId} when trying to update agent name to {AgentName}",
userId, agentName);
}
}
}