diff --git a/app/controllers/api/v1/system_notifications_controller.rb b/app/controllers/api/v1/system_notifications_controller.rb new file mode 100644 index 000000000..711722fe6 --- /dev/null +++ b/app/controllers/api/v1/system_notifications_controller.rb @@ -0,0 +1,8 @@ +class Api::V1::SystemNotificationsController < Api::V1::BaseController + + def index + @system_notifications = SystemNotification.where(is_top: true) + @system_notifications = kaminary_select_paginate(@system_notifications) + end + +end \ No newline at end of file diff --git a/app/views/api/v1/system_notifications/index.json.jbuilder b/app/views/api/v1/system_notifications/index.json.jbuilder new file mode 100644 index 000000000..11b4d726a --- /dev/null +++ b/app/views/api/v1/system_notifications/index.json.jbuilder @@ -0,0 +1,4 @@ +json.total_count @system_notifications.total_count +json.system_notifications @system_notifications.each do |notification| + json.(notification, :id, :subject, :sub_subject, :content, :is_top) +end \ No newline at end of file diff --git a/config/routes/api.rb b/config/routes/api.rb index 7bf4a6b66..ffa39557f 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -266,6 +266,7 @@ defaults format: :json do end + resources :system_notifications, only: [:index] resources :projects, only: [:index] resources :project_topics, only: [:index, :create, :destroy] resources :project_datasets, only: [:index]