Chore: FCM Push Fixes (#934)

This commit is contained in:
Sojan Jose
2020-06-09 17:42:18 +05:30
committed by GitHub
parent 40481f6462
commit 8b022311c0
6 changed files with 92 additions and 21 deletions

View File

@@ -4,8 +4,13 @@ class Api::V1::Accounts::NotificationsController < Api::V1::Accounts::BaseContro
before_action :fetch_notification, only: [:update]
def index
@notifications = current_user.notifications.where(account_id: Current.account.id)
render json: @notifications
@unread_count = current_user.notifications.where(account_id: current_account.id, read_at: nil).count
@notifications = current_user.notifications.where(account_id: current_account.id).page params[:page]
end
def read_all
current_user.notifications.where(account_id: current_account.id, read_at: nil).update(read_at: DateTime.now.utc)
head :ok
end
def update