scinote-web/app/controllers/client_api/notifications_controller.rb

29 lines
774 B
Ruby

module ClientApi
class NotificationsController < ApplicationController
def recent_notifications
respond_to do |format|
format.json do
render template: '/client_api/notifications/index',
status: :ok,
locals: {
notifications:
UserNotification.recent_notifications(current_user)
}
end
end
# clean the unseen notifications
UserNotification.seen_by_user(current_user)
end
def unreaded_notifications_number
respond_to do |format|
format.json do
render json: {
count: UserNotification.unseen_notification_count(current_user)
}, status: :ok
end
end
end
end
end