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

View File

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

View File

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