Add GetBotByUserIdAndNameAsync method to IBotService and BotService
- Implemented GetBotByUserIdAndNameAsync in IBotService and BotService to retrieve a bot by user ID and name. - Updated GetUserStrategyCommandHandler to utilize the new method for fetching strategies based on user ID. - Added corresponding method in IBotRepository and PostgreSqlBotRepository for database access.
This commit is contained in:
@@ -162,6 +162,17 @@ public class PostgreSqlBotRepository : IBotRepository
|
||||
return PostgreSqlMappers.Map(entity);
|
||||
}
|
||||
|
||||
public async Task<Bot> GetBotByUserIdAndNameAsync(int userId, string name)
|
||||
{
|
||||
var entity = await _context.Bots
|
||||
.AsNoTracking()
|
||||
.Include(m => m.User)
|
||||
.Include(m => m.MasterBotUser)
|
||||
.FirstOrDefaultAsync(b => b.UserId == userId && b.Name == name)
|
||||
.ConfigureAwait(false);
|
||||
return PostgreSqlMappers.Map(entity);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Bot>> GetBotsByIdsAsync(IEnumerable<Guid> identifiers)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user