fix: 修复编译错误

- PortfolioRepository: Date -> NavDate 属性名修正
- MarketDataRepository: 修复 TiingoTicker.Ticker 空引用警告
This commit is contained in:
OpenClaw Agent 2026-03-15 13:07:40 +00:00
parent 33392c4524
commit 625bfa1624
2 changed files with 6 additions and 5 deletions

View File

@ -86,8 +86,9 @@ public class MarketDataRepository : IMarketDataRepository
public async Task<List<TiingoTicker>> SearchTiingoTickersAsync(string keyword, int limit) public async Task<List<TiingoTicker>> SearchTiingoTickersAsync(string keyword, int limit)
{ {
var keywordUpper = keyword.ToUpper();
return await _db.Queryable<TiingoTicker>() return await _db.Queryable<TiingoTicker>()
.Where(t => t.Ticker.Contains(keyword.ToUpper()) || .Where(t => t.Ticker != null && t.Ticker.Contains(keywordUpper) ||
(t.Name != null && t.Name.Contains(keyword))) (t.Name != null && t.Name.Contains(keyword)))
.Take(limit) .Take(limit)
.ToListAsync(); .ToListAsync();

View File

@ -131,20 +131,20 @@ public class PortfolioRepository : IPortfolioRepository
if (startDate.HasValue) if (startDate.HasValue)
{ {
query = query.Where(n => n.Date >= startDate.Value.Date); query = query.Where(n => n.NavDate >= startDate.Value.Date);
} }
if (endDate.HasValue) if (endDate.HasValue)
{ {
query = query.Where(n => n.Date <= endDate.Value.Date); query = query.Where(n => n.NavDate <= endDate.Value.Date);
} }
return await query.OrderBy(n => n.Date).ToListAsync(); return await query.OrderBy(n => n.NavDate).ToListAsync();
} }
public async Task<int> DeleteNavHistoryAfterDateAsync(string portfolioId, DateTime date) public async Task<int> DeleteNavHistoryAfterDateAsync(string portfolioId, DateTime date)
{ {
return await _db.Deleteable<PortfolioNavHistory>() return await _db.Deleteable<PortfolioNavHistory>()
.Where(n => n.PortfolioId == portfolioId && n.Date >= date.Date) .Where(n => n.PortfolioId == portfolioId && n.NavDate >= date.Date)
.ExecuteCommandAsync(); .ExecuteCommandAsync();
} }