diff options
-rw-r--r-- | app/models/user_account.rb | 1 | ||||
-rw-r--r-- | config/routes.rb | 3 | ||||
-rw-r--r-- | spec/requests/addresses_controller/create_spec.rb (renamed from spec/requests/addresses_controller/create_addresses_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/addresses_controller/destroy_spec.rb (renamed from spec/requests/addresses_controller/destroy_addresses_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/addresses_controller/index_spec.rb (renamed from spec/requests/addresses_controller/index_addresses_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/addresses_controller/update_spec.rb (renamed from spec/requests/addresses_controller/update_addresses_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/cards_controller/index_spec.rb | 0 | ||||
-rw-r--r-- | spec/requests/companies_controller/create_spec.rb (renamed from spec/requests/companies_controller/create_companies_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/companies_controller/index_spec.rb (renamed from spec/requests/companies_controller/index_companies_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/companies_controller/show_spec.rb (renamed from spec/requests/companies_controller/show_companies_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/companies_controller/update_spec.rb (renamed from spec/requests/companies_controller/update_companies_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/products_controller/create_spec.rb (renamed from spec/requests/products_controller/create_products_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/products_controller/destroy_spec.rb (renamed from spec/requests/products_controller/destroy_products_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/products_controller/index_spec.rb (renamed from spec/requests/products_controller/index_products_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/products_controller/show_spec.rb (renamed from spec/requests/products_controller/show_products_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/products_controller/update_spec.rb (renamed from spec/requests/products_controller/update_products_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/refresh_tokens_controller/post_spec.rb (renamed from spec/requests/refresh_tokens_controller/post_refresh_tokens_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/sessions_controller/create_spec.rb (renamed from spec/requests/sessions_controller/create_sessions_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/sessions_controller/destroy_spec.rb (renamed from spec/requests/sessions_controller/destroy_sessions_controller_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/user_accounts_controller/create_spec.rb (renamed from spec/requests/user_accounts_controller/create_user_accounts_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/user_accounts_controller/show_spec.rb (renamed from spec/requests/user_accounts_controller/show_user_accounts_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/user_accounts_controller/update_spec.rb (renamed from spec/requests/user_accounts_controller/update_user_accounts_spec.rb) | 0 |
22 files changed, 4 insertions, 0 deletions
diff --git a/app/models/user_account.rb b/app/models/user_account.rb index ea6f9a6..23f7c5b 100644 --- a/app/models/user_account.rb +++ b/app/models/user_account.rb @@ -10,6 +10,7 @@ class UserAccount < ApplicationRecord has_secure_password validations: false has_many :user_account_addresses, dependent: :destroy has_many :addresses, through: :user_account_addresses + has_many :cards, dependent: :destroy validates :email, presence: true validates :email, uniqueness: true diff --git a/config/routes.rb b/config/routes.rb index 148abe2..ccf7b44 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,6 +14,9 @@ Rails.application.routes.draw do put '/account/addresses/:id', to: 'addresses#update' delete '/account/addresses/:id', to: 'addresses#destroy' get '/account/cards', to: 'cards#index' + post '/account/cards', to: 'cards#create' + put '/account/cards/:id', to: 'cards#update' + delete '/account/cards/:id', to: 'cards#destroy' put '/account', to: 'user_accounts#update' resources :companies, only: %i[index show create update] resources :products, only: %i[index show create update destroy] diff --git a/spec/requests/addresses_controller/create_addresses_controller_spec.rb b/spec/requests/addresses_controller/create_spec.rb index befb80b..befb80b 100644 --- a/spec/requests/addresses_controller/create_addresses_controller_spec.rb +++ b/spec/requests/addresses_controller/create_spec.rb diff --git a/spec/requests/addresses_controller/destroy_addresses_controller_spec.rb b/spec/requests/addresses_controller/destroy_spec.rb index df43329..df43329 100644 --- a/spec/requests/addresses_controller/destroy_addresses_controller_spec.rb +++ b/spec/requests/addresses_controller/destroy_spec.rb diff --git a/spec/requests/addresses_controller/index_addresses_controller_spec.rb b/spec/requests/addresses_controller/index_spec.rb index 63fc776..63fc776 100644 --- a/spec/requests/addresses_controller/index_addresses_controller_spec.rb +++ b/spec/requests/addresses_controller/index_spec.rb diff --git a/spec/requests/addresses_controller/update_addresses_controller_spec.rb b/spec/requests/addresses_controller/update_spec.rb index 0c3662e..0c3662e 100644 --- a/spec/requests/addresses_controller/update_addresses_controller_spec.rb +++ b/spec/requests/addresses_controller/update_spec.rb diff --git a/spec/requests/cards_controller/index_spec.rb b/spec/requests/cards_controller/index_spec.rb new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/spec/requests/cards_controller/index_spec.rb diff --git a/spec/requests/companies_controller/create_companies_controller_spec.rb b/spec/requests/companies_controller/create_spec.rb index 219868b..219868b 100644 --- a/spec/requests/companies_controller/create_companies_controller_spec.rb +++ b/spec/requests/companies_controller/create_spec.rb diff --git a/spec/requests/companies_controller/index_companies_controller_spec.rb b/spec/requests/companies_controller/index_spec.rb index c8fb439..c8fb439 100644 --- a/spec/requests/companies_controller/index_companies_controller_spec.rb +++ b/spec/requests/companies_controller/index_spec.rb diff --git a/spec/requests/companies_controller/show_companies_controller_spec.rb b/spec/requests/companies_controller/show_spec.rb index fc5bbd0..fc5bbd0 100644 --- a/spec/requests/companies_controller/show_companies_controller_spec.rb +++ b/spec/requests/companies_controller/show_spec.rb diff --git a/spec/requests/companies_controller/update_companies_controller_spec.rb b/spec/requests/companies_controller/update_spec.rb index fd23365..fd23365 100644 --- a/spec/requests/companies_controller/update_companies_controller_spec.rb +++ b/spec/requests/companies_controller/update_spec.rb diff --git a/spec/requests/products_controller/create_products_controller_spec.rb b/spec/requests/products_controller/create_spec.rb index 400fd18..400fd18 100644 --- a/spec/requests/products_controller/create_products_controller_spec.rb +++ b/spec/requests/products_controller/create_spec.rb diff --git a/spec/requests/products_controller/destroy_products_controller_spec.rb b/spec/requests/products_controller/destroy_spec.rb index 54a57d2..54a57d2 100644 --- a/spec/requests/products_controller/destroy_products_controller_spec.rb +++ b/spec/requests/products_controller/destroy_spec.rb diff --git a/spec/requests/products_controller/index_products_controller_spec.rb b/spec/requests/products_controller/index_spec.rb index a4decce..a4decce 100644 --- a/spec/requests/products_controller/index_products_controller_spec.rb +++ b/spec/requests/products_controller/index_spec.rb diff --git a/spec/requests/products_controller/show_products_controller_spec.rb b/spec/requests/products_controller/show_spec.rb index 9b2461c..9b2461c 100644 --- a/spec/requests/products_controller/show_products_controller_spec.rb +++ b/spec/requests/products_controller/show_spec.rb diff --git a/spec/requests/products_controller/update_products_controller_spec.rb b/spec/requests/products_controller/update_spec.rb index f916d6a..f916d6a 100644 --- a/spec/requests/products_controller/update_products_controller_spec.rb +++ b/spec/requests/products_controller/update_spec.rb diff --git a/spec/requests/refresh_tokens_controller/post_refresh_tokens_controller_spec.rb b/spec/requests/refresh_tokens_controller/post_spec.rb index 5d8f8f0..5d8f8f0 100644 --- a/spec/requests/refresh_tokens_controller/post_refresh_tokens_controller_spec.rb +++ b/spec/requests/refresh_tokens_controller/post_spec.rb diff --git a/spec/requests/sessions_controller/create_sessions_controller_spec.rb b/spec/requests/sessions_controller/create_spec.rb index cca04b1..cca04b1 100644 --- a/spec/requests/sessions_controller/create_sessions_controller_spec.rb +++ b/spec/requests/sessions_controller/create_spec.rb diff --git a/spec/requests/sessions_controller/destroy_sessions_controller_spec.rb b/spec/requests/sessions_controller/destroy_spec.rb index bc669fc..bc669fc 100644 --- a/spec/requests/sessions_controller/destroy_sessions_controller_spec.rb +++ b/spec/requests/sessions_controller/destroy_spec.rb diff --git a/spec/requests/user_accounts_controller/create_user_accounts_spec.rb b/spec/requests/user_accounts_controller/create_spec.rb index a45e02b..a45e02b 100644 --- a/spec/requests/user_accounts_controller/create_user_accounts_spec.rb +++ b/spec/requests/user_accounts_controller/create_spec.rb diff --git a/spec/requests/user_accounts_controller/show_user_accounts_spec.rb b/spec/requests/user_accounts_controller/show_spec.rb index 050fda0..050fda0 100644 --- a/spec/requests/user_accounts_controller/show_user_accounts_spec.rb +++ b/spec/requests/user_accounts_controller/show_spec.rb diff --git a/spec/requests/user_accounts_controller/update_user_accounts_spec.rb b/spec/requests/user_accounts_controller/update_spec.rb index fcfb28e..fcfb28e 100644 --- a/spec/requests/user_accounts_controller/update_user_accounts_spec.rb +++ b/spec/requests/user_accounts_controller/update_spec.rb |