Fix update AgentName
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user