mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 13:44:47 +02:00
* Extract frequently used country_code and ident methods * Refactor domain query * Add contact query method * Add adminstrated_domains query method. Name will most likely change in the future developments * Change registry locks integration test name
38 lines
1,008 B
Ruby
38 lines
1,008 B
Ruby
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 destroy
|
|
if @domain.remove_registry_lock
|
|
render json: @domain
|
|
else
|
|
render json: { errors: [{ base: ['Domain is not locked'] }] },
|
|
status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def set_domain
|
|
domain_pool = current_user.administrated_domains
|
|
@domain = domain_pool.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
|