Sha256: 06c878c000e2ed3d7517a273a85fbaf7ec02c000c8d744cac43cbf0e7d6834c1
Contents?: true
Size: 937 Bytes
Versions: 54
Compression:
Stored size: 937 Bytes
Contents
# frozen_string_literal: true module Motor class NotificationsController < ApiBaseController wrap_parameters :data, except: %i[include fields] load_and_authorize_resource :notification def index @notifications = Motor::ApiQuery.call(@notifications.where(recipient: current_user).order(created_at: :desc), params) render json: { data: Motor::ApiQuery::BuildJson.call(@notifications, params, current_ability), meta: Motor::ApiQuery::BuildMeta.call(@notifications, params) } end def update @notification.update!(notification_params) Motor::NotificationsChannel.broadcast_to(current_user, ['update', @notification.as_json(include: %i[record])]) render json: { data: Motor::ApiQuery::BuildJson.call(@notification, params, current_ability) } end private def notification_params params.require(:data).permit(:status) end end end
Version data entries
54 entries across 54 versions & 6 rubygems