@@ -77,13 +77,8 @@ defmodule RealtimeWeb.TenantController do
7777 tenant = Api . get_tenant_by_external_id ( id )
7878
7979 case tenant do
80- % Tenant { } = tenant ->
81- render ( conn , "show.json" , tenant: tenant )
82-
83- nil ->
84- conn
85- |> put_status ( 404 )
86- |> render ( "not_found.json" , tenant: nil )
80+ % Tenant { } = tenant -> render ( conn , "show.json" , tenant: tenant )
81+ nil -> { :error , :not_found }
8782 end
8883 end
8984
@@ -201,7 +196,6 @@ defmodule RealtimeWeb.TenantController do
201196 send_resp ( conn , 204 , "" )
202197 else
203198 nil ->
204- log_error ( "TenantNotFound" , "Tenant not found" )
205199 send_resp ( conn , 204 , "" )
206200
207201 err ->
@@ -234,10 +228,7 @@ defmodule RealtimeWeb.TenantController do
234228 case Api . get_tenant_by_external_id ( tenant_id , use_replica?: false ) do
235229 nil ->
236230 log_error ( "TenantNotFound" , "Tenant not found" )
237-
238- conn
239- |> put_status ( 404 )
240- |> render ( "not_found.json" , tenant: nil )
231+ { :error , :not_found }
241232
242233 tenant ->
243234 PostgresCdc . stop_all ( tenant , @ stop_timeout )
@@ -271,14 +262,10 @@ defmodule RealtimeWeb.TenantController do
271262 case Api . get_tenant_by_external_id ( tenant_id , use_replica?: false ) do
272263 nil ->
273264 log_error ( "TenantNotFound" , "Tenant not found" )
274-
275- conn
276- |> put_status ( 404 )
277- |> render ( "not_found.json" , tenant: nil )
265+ { :error , :not_found }
278266
279267 tenant ->
280268 Connect . shutdown ( tenant . external_id )
281- SocketDisconnect . distributed_disconnect ( tenant . external_id )
282269 send_resp ( conn , 204 , "" )
283270 end
284271 end
@@ -313,10 +300,7 @@ defmodule RealtimeWeb.TenantController do
313300
314301 { :error , :tenant_not_found } ->
315302 log_error ( "TenantNotFound" , "Tenant not found" )
316-
317- conn
318- |> put_status ( 404 )
319- |> render ( "not_found.json" , tenant: nil )
303+ { :error , :not_found }
320304 end
321305 end
322306
0 commit comments