Skip to content

Commit

Permalink
allow updates of deleted providers
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 30, 2021
1 parent 586a2a1 commit 8a88cb1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
24 changes: 17 additions & 7 deletions app/controllers/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,23 @@ def set_include
end

def set_provider
@provider =
Provider.unscoped.where(
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_DEV')",
).
where(deleted_at: nil).
where(symbol: params[:id]).
first
if params[:include_deleted]
@provider =
Provider.unscoped.where(
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_DEV')",
).
where(symbol: params[:id]).
first
else
@provider =
Provider.unscoped.where(
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_DEV')",
).
where(deleted_at: nil).
where(symbol: params[:id]).
first
end

fail ActiveRecord::RecordNotFound if @provider.blank?
end

Expand Down
24 changes: 17 additions & 7 deletions app/controllers/v3/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,23 @@ def set_include
end

def set_provider
@provider =
Provider.unscoped.where(
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_DEV')",
).
where(deleted_at: nil).
where(symbol: params[:id]).
first
if params[:include_deleted]
@provider =
Provider.unscoped.where(
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_DEV')",
).
where(symbol: params[:id]).
first
else
@provider =
Provider.unscoped.where(
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_DEV')",
).
where(deleted_at: nil).
where(symbol: params[:id]).
first
end

fail ActiveRecord::RecordNotFound if @provider.blank?
end

Expand Down

0 comments on commit 8a88cb1

Please sign in to comment.