-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update rails to 7.1.3 * Update bullet gem version to 7.1.6 * prepare app for admin panels * add versioning to app routes * reword routes comment * use rails built in healthcheck controller * rename healthcheck spec file
- Loading branch information
Showing
24 changed files
with
129 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module Api | ||
module V1 | ||
module Users | ||
class ConfirmationsController < Devise::ConfirmationsController | ||
respond_to :json | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
module Api | ||
module V1 | ||
module Users | ||
class PasswordsController < Devise::PasswordsController | ||
include FakeSession | ||
respond_to :json | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Api | ||
module V1 | ||
module Users | ||
class RegistrationsController < Devise::RegistrationsController | ||
include FakeSession | ||
|
||
def respond_with(resource, _opts = {}) | ||
if resource.persisted? | ||
render json: UserSerializer.render(resource), status: :created | ||
else | ||
render json: resource.errors, status: :unprocessable_entity | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
module Api | ||
module V1 | ||
module Users | ||
class SessionsController < Devise::SessionsController | ||
def create | ||
super do |user| | ||
render json: UserSerializer.render(user), status: :created | ||
|
||
return | ||
end | ||
end | ||
|
||
private | ||
|
||
def respond_to_on_destroy | ||
current_user ? log_out_success : log_out_failure | ||
end | ||
|
||
def log_out_success | ||
head :no_content | ||
end | ||
|
||
def log_out_failure | ||
render json: { error: 'You need to sign in or sign up before continuing.' }, status: :unauthorized | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
Rails.application.routes.draw do | ||
scope module: 'api', defaults: { format: :json } do | ||
devise_for :users, controllers: { | ||
confirmations: 'api/users/confirmations', | ||
sessions: 'api/users/sessions', | ||
registrations: 'api/users/registrations', | ||
passwords: 'api/users/passwords' | ||
} | ||
get 'up' => 'rails/health#show', as: :rails_health_check | ||
|
||
defaults format: :html do | ||
mount Sidekiq::Web => '/sidekiq' | ||
|
||
# Uncomment when using AdminUser devise model for authenticated admin panels | ||
# devise_for :admin_users, only: %i[sessions password], controllers: { | ||
# sessions: 'admin_users/sessions', | ||
# passwords: 'admin_users/passwords' | ||
# } | ||
# root to: '/admin' | ||
end | ||
|
||
get '/healthcheck', to: ->(_env) { [200, {}, ['OK']] } | ||
devise_for :users, path: 'api/v1/users', defaults: { format: :json }, controllers: { | ||
confirmations: 'api/v1/users/confirmations', | ||
sessions: 'api/v1/users/sessions', | ||
registrations: 'api/v1/users/registrations', | ||
passwords: 'api/v1/users/passwords' | ||
} | ||
|
||
mount Sidekiq::Web => '/sidekiq' | ||
namespace :api, defaults: { format: :json } do | ||
namespace :v1 do | ||
# Your api routes go here | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'GET /up', type: :request do | ||
subject { get '/up' } | ||
|
||
it 'returns a 200 status code' do | ||
subject | ||
expect(response).to have_http_status(:ok) | ||
expect(response.body).to eq('<!DOCTYPE html><html><body style="background-color: green"></body></html>') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters