change response message

This commit is contained in:
Oleg Hasjanov 2021-05-04 14:37:50 +03:00
parent d5af1a7fb6
commit 759254d954

View file

@ -22,6 +22,7 @@ module Repp
desc 'Get the all unread poll messages' desc 'Get the all unread poll messages'
def all_notifications def all_notifications
records = current_user.unread_notifications.order('created_at DESC').all records = current_user.unread_notifications.order('created_at DESC').all
@notification = records.limit(limit).offset(offset) @notification = records.limit(limit).offset(offset)
# rubocop:disable Style/AndOr # rubocop:disable Style/AndOr
render_success(data: nil) and return unless @notification render_success(data: nil) and return unless @notification
@ -29,7 +30,10 @@ module Repp
data = @notification.as_json(only: %i[id text attached_obj_id attached_obj_type]) data = @notification.as_json(only: %i[id text attached_obj_id attached_obj_type])
render_success(data: data) default_count = 200
message = "Command completed successfully. The total notifications are #{records.count}. Returns only #{@notification.count}. Limit by default is #{limit}. To change the amount of data returned, use the parameters limit and offset in url."
render_success(data: data, message: message)
end end
api :GET, '/repp/v1/registrar/notifications/:notification_id' api :GET, '/repp/v1/registrar/notifications/:notification_id'