diff --git a/.gitignore b/.gitignore index dcd7bee..ca96dbb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ launchSettings.json .idea/ .DS_Store data/ -output/ \ No newline at end of file +output/ +*.DotSettings.user \ No newline at end of file diff --git a/src/MastodonConnectionHelper.cs b/src/MastodonConnectionHelper.cs index f1f1349..968eaa1 100644 --- a/src/MastodonConnectionHelper.cs +++ b/src/MastodonConnectionHelper.cs @@ -6,16 +6,16 @@ public static class MastodonConnectionHelper { public static async Task> GetFollowedTagsAsync() { - var res = new List(); - - if (Config.Instance == null) + if (Config.Instance == null) throw new Exception("Config object is not initialized"); + if (Config.Instance.MastodonPostgresConnectionString.IsNullOrEmpty()) { - throw new Exception("Config object is not initialized"); + throw new Exception("Missing mastodon postgres connection string"); } await using var conn = new NpgsqlConnection(Config.Instance.MastodonPostgresConnectionString); await conn.OpenAsync(); + var res = new List(); await using var cmd = new NpgsqlCommand("SELECT DISTINCT tags.name FROM tag_follows JOIN tags ON tag_id = tags.id ORDER BY tags.name ASC;", conn); await using var reader = await cmd.ExecuteReaderAsync(); while (await reader.ReadAsync())