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.39 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.38 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.37 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.36 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.35 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.34 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.33 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.32 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.31 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.30 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.29 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.28 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.27 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.26 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.25 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.24 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.23 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.22 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.21 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.20 app/controllers/comee/core/notifications_controller.rb