API for apps to register for push notifications
This commit is contained in:
parent
1992575d57
commit
3f075c7794
13 changed files with 112 additions and 2 deletions
18
app/controllers/api/v1/devices_controller.rb
Normal file
18
app/controllers/api/v1/devices_controller.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::DevicesController < ApiController
|
||||
before_action -> { doorkeeper_authorize! :read }
|
||||
before_action :require_user!
|
||||
|
||||
respond_to :json
|
||||
|
||||
def register
|
||||
Device.where(account: current_account, registration_id: params[:registration_id]).first_or_create!(account: current_account, registration_id: params[:registration_id])
|
||||
render_empty
|
||||
end
|
||||
|
||||
def unregister
|
||||
Device.where(account: current_account, registration_id: params[:registration_id]).delete_all
|
||||
render_empty
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue