From c149606f2454e4eaa71baf3c146bc88f9248d8a3 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Tue, 1 Mar 2022 17:29:43 -0500 Subject: [PATCH] fix more sql --- internal/repository/postgres_watcher.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/repository/postgres_watcher.go b/internal/repository/postgres_watcher.go index 4aff173..d6f9462 100644 --- a/internal/repository/postgres_watcher.go +++ b/internal/repository/postgres_watcher.go @@ -94,8 +94,8 @@ func (p *postgresWatcherRepository) GetByID(ctx context.Context, id int64) (doma accounts.id, accounts.access_token, accounts.refresh_token, - subreddits.name AS subreddit_label, - users.name AS user_label + COALESCE(subreddits.name, '') AS subreddit_label, + COALESCE(users.name, '') AS user_label FROM watchers INNER JOIN devices ON watchers.device_id = devices.id INNER JOIN accounts ON watchers.account_id = accounts.id @@ -138,8 +138,8 @@ func (p *postgresWatcherRepository) GetByTypeAndWatcheeID(ctx context.Context, t accounts.id, accounts.access_token, accounts.refresh_token, - subreddits.name AS subreddit_label, - users.name AS user_label + COALESCE(subreddits.name, '') AS subreddit_label, + COALESCE(users.name, '') AS user_label FROM watchers INNER JOIN devices ON watchers.device_id = devices.id INNER JOIN accounts ON watchers.account_id = accounts.id @@ -186,8 +186,8 @@ func (p *postgresWatcherRepository) GetByDeviceAPNSTokenAndAccountRedditID(ctx c accounts.id, accounts.access_token, accounts.refresh_token, - subreddits.name AS subreddit_label, - users.name AS user_label + COALESCE(subreddits.name, '') AS subreddit_label, + COALESCE(users.name, '') AS user_label FROM watchers INNER JOIN accounts ON watchers.account_id = accounts.id INNER JOIN devices ON watchers.device_id = devices.id