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.19 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.18 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.17 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.16 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.15 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.14 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.13 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.12 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.11 app/controllers/comee/core/notifications_controller.rb
comee_core-0.1.10 app/controllers/comee/core/notifications_controller.rb