feat(app): clean architecture with typed repositories, DTO models and calendar event logos

This commit is contained in:
2026-08-15 01:03:22 +02:00
parent f08fecde23
commit 15f8f7896e
34 changed files with 1435 additions and 1420 deletions
@@ -23,6 +23,8 @@ class NewsRepository {
String? symbol,
String? isin,
String? date,
String? query,
bool? hasSentiment,
}) async {
try {
final Map<String, dynamic> queryParams = {
@@ -33,17 +35,21 @@ class NewsRepository {
if (symbol != null && symbol.isNotEmpty) queryParams['symbol'] = symbol;
if (isin != null && isin.isNotEmpty) queryParams['isin'] = isin;
if (date != null && date.isNotEmpty) queryParams['date'] = date;
if (query != null && query.isNotEmpty) queryParams['query'] = query;
if (hasSentiment == true) queryParams['hasSentiment'] = true;
final response = await apiClient.get('/api/v1/news', queryParameters: queryParams);
if (response.statusCode == 200) {
if (response.statusCode == 200 && response.data is List) {
final List<dynamic> data = response.data;
return data.map((json) => NewsArticleModel.fromJson(json)).toList();
return data
.whereType<Map<String, dynamic>>()
.map((json) => NewsArticleModel.fromJson(json))
.toList();
}
return [];
} catch (e) {
print('Error fetching news: $e');
throw Exception('Failed to load news');
throw Exception('Failed to load news: $e');
}
}