Update registry lock controller to also return special serialization

This commit is contained in:
Maciej Szlosarczyk 2018-10-02 11:53:57 +03:00
parent ce8451d004
commit 5e5162e44e
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
5 changed files with 28 additions and 13 deletions

View file

@ -1,3 +1,5 @@
require 'serializers/registrant_api/domain'
module Api
module V1
module Registrant
@ -7,7 +9,8 @@ module Api
def create
if @domain.apply_registry_lock
render json: @domain
serializer = Serializers::RegistrantApi::Domain.new(@domain)
render json: serializer.to_json
else
render json: { errors: [{ base: ['Domain cannot be locked'] }] },
status: :unprocessable_entity
@ -16,7 +19,8 @@ module Api
def destroy
if @domain.remove_registry_lock
render json: @domain
serializer = Serializers::RegistrantApi::Domain.new(@domain)
render json: serializer.to_json
else
render json: { errors: [{ base: ['Domain is not locked'] }] },
status: :unprocessable_entity