Sha256: a0a4db5a33fd0a5236d81591fe8c70eb0d1b5dfd2c46484b44d62cb01865af6d

Contents?: true

Size: 1.03 KB

Versions: 90

Compression:

Stored size: 1.03 KB

Contents

module Comee
  module Core
    class NotificationsController < ApplicationController
      before_action :set_notification, only: %i[mark_as_read mark_as_unread]

      def index
        data = Comee::Core::Notification.messages(current_user.notifications.newest_first)
        render json: {success: true, data: data}
      end

      def read
        data = Notification.messages(current_user.notifications.read.newest_first)
        render json: {success: true, data: data}
      end

      def unread
        data = Notification.messages(current_user.notifications.unread.newest_first)
        render json: {success: true, data: data}
      end

      def mark_as_read
        @notification.mark_as_read!
        render json: {success: true, data: @notification.message}
      end

      def mark_as_unread
        @notification.mark_as_unread!
        render json: {success: true, data: @notification.message}
      end

      private

      def set_notification
        @notification = Notification.find(params[:id])
      end
    end
  end
end

Version data entries

90 entries across 90 versions & 1 rubygems

Version Path
comee_core-0.1.96 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.95 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.94 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.93 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.92 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.91 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.90 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.89 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.88 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.87 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.86 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.85 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.84 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.83 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.82 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.81 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.80 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.79 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.78 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.77 app/controllers/comee/core/notifications_controller.rb