Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Remove api clients #1168

Draft
wants to merge 34 commits into
base: Pralishweb_hook_drive_strategy
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0b5a1cf
decouple api client from api namespaces
Pralish Oct 6, 2022
2419930
Merge branch 'master' of github.com:restarone/violet_rails into web_h…
Pralish Oct 18, 2022
df3b95f
stripe verification method
Pralish Oct 18, 2022
b6f0a17
update external api form to accept webhook drive strategy
Pralish Oct 18, 2022
2c5f8ef
webhook verification method
Pralish Oct 18, 2022
0143a18
chore(): decouple api client as api keys from api namespace
Pralish Oct 19, 2022
1c88ab9
use api keys to authenticate api
Pralish Oct 19, 2022
f9bd56f
test api keys controller
Pralish Oct 19, 2022
642cf82
fix test cases
Pralish Oct 19, 2022
29a2bbb
install stripe
Pralish Oct 19, 2022
d09ede7
test webhook api
Pralish Oct 19, 2022
3736fc9
test verification services
Pralish Oct 19, 2022
395d50c
fix tests
Pralish Oct 20, 2022
a1b3462
should not delete webhook verification method if require_webhook_veri…
Pralish Oct 20, 2022
292cdc0
test webhook enpoint
Pralish Oct 20, 2022
62de7cb
add webhhok details
Pralish Oct 20, 2022
69e2bf8
remove Api client
Pralish Oct 20, 2022
e158dfc
fix test cases
Pralish Oct 20, 2022
5b51453
Merge branch 'web_hook_drive_strategy' into remove-api-clients
Pralish Oct 20, 2022
be7c42e
drop api client
Pralish Oct 20, 2022
29c8a90
check if model exist before migration
Pralish Oct 20, 2022
18616a4
fix tests
Pralish Oct 20, 2022
68c53ac
add hint test
Pralish Oct 20, 2022
c600c46
Merge branch 'web_hook_drive_strategy' into remove-api-clients
Pralish Oct 20, 2022
e9920c4
merged with base
Pralish Dec 22, 2022
070f18a
revert change
Pralish Dec 22, 2022
35dffc7
fix migration
Pralish Dec 22, 2022
e690cf2
fix migration
Pralish Dec 22, 2022
1aeb350
fix migration
Pralish Dec 22, 2022
2daa8fc
revert migration
Pralish Dec 22, 2022
aae0524
remove api clients
Pralish Dec 22, 2022
24ac5fa
code cleanup
Pralish Dec 22, 2022
97be39f
Merge branch 'Pralishweb_hook_drive_strategy' of github.com:restarone…
Pralish Dec 22, 2022
492e658
remove reference to api_clients
Pralish Dec 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ DEPENDENCIES
will_paginate

RUBY VERSION
ruby 3.0.0p0
ruby 3.0.0p0

BUNDLED WITH
2.1.4
3 changes: 0 additions & 3 deletions app/assets/stylesheets/api_clients.scss

This file was deleted.

76 changes: 0 additions & 76 deletions app/controllers/comfy/admin/api_clients_controller.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create
respond_to do |format|
if @external_api_client.save
format.html { redirect_to api_namespace_external_api_client_path(api_namespace_id: @api_namespace.id, id: @external_api_client.id), notice: "Api client was successfully created." }
format.json { render :show, status: :created, location: @api_client }
format.json { render :show, status: :created, location: @external_api_client }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @external_api_client.errors, status: :unprocessable_entity }
Expand All @@ -46,7 +46,7 @@ def update
format.json { render :show, status: :ok, location: @external_api_client }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @api_client.errors, status: :unprocessable_entity }
format.json { render json: @external_api_client.errors, status: :unprocessable_entity }
end
end
end
Expand Down
14 changes: 0 additions & 14 deletions app/controllers/subdomains/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,6 @@ def ensure_authority_for_full_access_for_external_api_connections_only_in_api
end
end

def ensure_authority_for_read_api_clients_only_in_api
unless user_authorized_for_api_accessibility?(ApiNamespace::API_ACCESSIBILITIES[:read_api_clients_only])
flash.alert = "You do not have the permission to do that. Only users with full_access or full_read_access or full_access_for_api_clients_only or read_api_clients_only are allowed to perform that action."
redirect_back(fallback_location: root_url)
end
end

def ensure_authority_for_full_access_for_api_clients_only_in_api
unless user_authorized_for_api_accessibility?(ApiNamespace::API_ACCESSIBILITIES[:full_access_for_api_clients_only])
flash.alert = "You do not have the permission to do that. Only users with full_access or full_access_for_api_clients_only are allowed to perform that action."
redirect_back(fallback_location: root_url)
end
end

def ensure_authority_for_full_access_for_api_form_only_in_api
unless user_authorized_for_api_accessibility?(ApiNamespace::API_ACCESSIBILITIES[:full_access_for_api_form_only])
flash.alert = "You do not have the permission to do that. Only users with full_access or full_access_for_api_form_only are allowed to perform that action."
Expand Down
2 changes: 0 additions & 2 deletions app/helpers/api_clients_helper.rb

This file was deleted.

21 changes: 0 additions & 21 deletions app/models/api_client.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/models/api_namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ class ApiNamespace < ApplicationRecord
has_one :api_form, dependent: :destroy
accepts_nested_attributes_for :api_form

has_many :api_clients, dependent: :destroy
accepts_nested_attributes_for :api_clients

has_many :external_api_clients, dependent: :destroy

has_many :non_primitive_properties, dependent: :destroy
Expand Down Expand Up @@ -75,8 +72,6 @@ class ApiNamespace < ApplicationRecord
full_access_for_api_actions_only: ['full_access', 'full_access_for_api_actions_only'],
read_external_api_connections_only: ['full_access', 'full_read_access', 'full_access_for_external_api_connections_only', 'read_external_api_connections_only'],
full_access_for_external_api_connections_only: ['full_access', 'full_access_for_external_api_connections_only'],
read_api_clients_only: ['full_access', 'full_read_access', 'full_access_for_api_clients_only', 'read_api_clients_only'],
full_access_for_api_clients_only: ['full_access', 'full_access_for_api_clients_only'],
full_access_for_api_form_only: ['full_access', 'full_access_for_api_form_only'],
read_api_keys_only: ['full_access', 'delete_access', 'read_access'],
full_access_for_api_keys_only: ['full_access'],
Expand Down
2 changes: 0 additions & 2 deletions app/views/comfy/admin/api_clients/_api_client.json.jbuilder

This file was deleted.

18 changes: 0 additions & 18 deletions app/views/comfy/admin/api_clients/_form.html.haml

This file was deleted.

7 changes: 0 additions & 7 deletions app/views/comfy/admin/api_clients/edit.html.haml

This file was deleted.

25 changes: 0 additions & 25 deletions app/views/comfy/admin/api_clients/index.html.haml

This file was deleted.

1 change: 0 additions & 1 deletion app/views/comfy/admin/api_clients/index.json.jbuilder

This file was deleted.

5 changes: 0 additions & 5 deletions app/views/comfy/admin/api_clients/new.html.haml

This file was deleted.

18 changes: 0 additions & 18 deletions app/views/comfy/admin/api_clients/show.html.haml

This file was deleted.

1 change: 0 additions & 1 deletion app/views/comfy/admin/api_clients/show.json.jbuilder

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/comfy/admin/api_forms/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- action = @api_form.persisted? ? :put : :post
- path = @api_form.persisted? ? api_namespace_api_form_path(api_namespace_id: @api_form.api_namespace.id, id: @api_form.id) : api_namespace_api_forms_path(api_namespace_id: @api_client.api_namespace.id)
- path = @api_form.persisted? ? api_namespace_api_form_path(api_namespace_id: @api_form.api_namespace.id, id: @api_form.id) : api_namespace_api_forms_path(api_namespace_id: @api_form.api_namespace.id)
- properties = @api_form.properties

= form_for @api_form, url: path, method: action do |f|
Expand Down
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def self.matches?(request)
end

resources :resources, except: [:index], controller: 'comfy/admin/api_resources'
resources :api_clients, controller: 'comfy/admin/api_clients'
resources :external_api_clients, controller: 'comfy/admin/external_api_clients' do
member do
get 'start'
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20221222155625_drop_api_clients.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class DropApiClients < ActiveRecord::Migration[6.1]
def up
drop_table :api_clients
end

def down
fail ActiveRecord::IrreversibleMigration
end
end
15 changes: 1 addition & 14 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading