Compare commits

..

10 Commits

4 changed files with 8 additions and 7 deletions

View File

@ -149,7 +149,7 @@ public class CajetanApiService(IAuthService authService, IConfigService configSe
if (usersWithUnread.Contains(userId)) if (usersWithUnread.Contains(userId))
{ {
_eventHandler.OnMessage("Restoring unread state", "grey"); _eventHandler.OnMessage("Restoring unread state", "grey");
await MarkAsUnreadAsync($"chats/{userId}/mark-as-read"); await MarkAsUnreadAsync($"/chats/{userId}/mark-as-read");
} }
return messages; return messages;
@ -170,7 +170,7 @@ public class CajetanApiService(IAuthService authService, IConfigService configSe
public async Task<HashSet<long>> GetUsersWithUnreadMessagesAsync() public async Task<HashSet<long>> GetUsersWithUnreadMessagesAsync()
{ {
MessageDtos.ChatsDto unreadChats = await GetChatsAsync("", onlyUnread: true); MessageDtos.ChatsDto unreadChats = await GetChatsAsync("/chats", onlyUnread: true);
HashSet<long> userWithUnread = []; HashSet<long> userWithUnread = [];
foreach (MessageDtos.ChatItemDto chatItem in unreadChats.List) foreach (MessageDtos.ChatItemDto chatItem in unreadChats.List)

View File

@ -9,6 +9,7 @@ public class CajetanDbService(IConfigService configService)
{ {
await using SqliteConnection connection = new($"Data Source={Directory.GetCurrentDirectory()}/users.db"); await using SqliteConnection connection = new($"Data Source={Directory.GetCurrentDirectory()}/users.db");
connection.Open();
using (SqliteCommand cmdInfo = new("CREATE TABLE IF NOT EXISTS user_info (user_id INTEGER NOT NULL, name VARCHAR NOT NULL, about VARCHAR NULL, expires_on TIMESTAMP NULL, photo_count INT NOT NULL, video_count INT NOT NULL, PRIMARY KEY(user_id));", connection)) using (SqliteCommand cmdInfo = new("CREATE TABLE IF NOT EXISTS user_info (user_id INTEGER NOT NULL, name VARCHAR NOT NULL, about VARCHAR NULL, expires_on TIMESTAMP NULL, photo_count INT NOT NULL, video_count INT NOT NULL, PRIMARY KEY(user_id));", connection))
{ {

View File

@ -387,8 +387,6 @@ internal class Worker(IServiceProvider serviceProvider)
async Task FetchListsAsync() async Task FetchListsAsync()
{ {
Log.Information("Getting Lists"); Log.Information("Getting Lists");
AnsiConsole.Markup($"[green]Getting Lists\n[/]");
result.Lists = await _apiService.GetLists("/lists") ?? []; result.Lists = await _apiService.GetLists("/lists") ?? [];
} }

View File

@ -200,9 +200,11 @@ public class FileNameService(IAuthService authService) : IFileNameService
object? value = source; object? value = source;
foreach (string propertyName in propertyPath.Split('.')) foreach (string propertyName in propertyPath.Split('.'))
{ {
PropertyInfo property = value?.GetType().GetProperty(propertyName) ?? PropertyInfo? property = value?.GetType().GetProperty(propertyName);
throw new ArgumentException($"Property '{propertyName}' not found."); value = property?.GetValue(value);
value = property.GetValue(value);
if (value is null)
break;
} }
return value; return value;