mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Add badges to locked domains
This commit is contained in:
parent
7ce092dff2
commit
faeeb55bc7
8 changed files with 80 additions and 7 deletions
|
@ -0,0 +1,37 @@
|
|||
module Api
|
||||
module V1
|
||||
module Registrant
|
||||
class RegistryLocksController < BaseController
|
||||
before_action :set_domain
|
||||
|
||||
def create
|
||||
if @domain.apply_registry_lock
|
||||
render json: @domain
|
||||
else
|
||||
render json: { errors: [{ base: 'Domain cannot be locked' }] },
|
||||
status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if @domain.remove_registry_lock
|
||||
render json: @domain
|
||||
else
|
||||
render json: { errors: [{ base: 'Domain cannot be unlocked' }] },
|
||||
status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_domain
|
||||
@domain = Domain.find_by(uuid: params[:domain_uuid])
|
||||
|
||||
return if @domain
|
||||
render json: { errors: [{ base: ['Domain not found'] }] },
|
||||
status: :not_found and return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue