-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
107 changed files
with
2,585 additions
and
930 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
app/controllers/internal_api/v1/companies/purge_logo_controller.rb
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
class InternalApi::V1::Companies::PurgeLogoController < InternalApi::V1::ApplicationController | ||
def destroy | ||
authorize current_company, :purge_logo? | ||
current_company.logo.destroy | ||
render json: { notice: I18n.t("companies.purge_logo.destroy.success") }, status: :ok | ||
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,36 @@ | ||
# frozen_string_literal: true | ||
|
||
class InternalApi::V1::CompaniesController < InternalApi::V1::ApplicationController | ||
def index | ||
authorize current_company | ||
render json: { company: current_company } | ||
end | ||
|
||
def create | ||
authorize Company | ||
company = Company.new(company_params) | ||
if company.save! | ||
current_user.companies << company | ||
current_user.current_workspace_id = company.id | ||
current_user.add_role(:owner, company) | ||
current_user.save! | ||
render json: { notice: I18n.t("companies.create.success") } | ||
end | ||
end | ||
|
||
def update | ||
authorize current_company | ||
if current_company.update!(company_params) | ||
render json: { notice: I18n.t("companies.update.success") } | ||
end | ||
end | ||
|
||
private | ||
|
||
def company_params | ||
params.require(:company).permit( | ||
:name, :address, :business_phone, :country, :timezone, :base_currency, | ||
:standard_price, :fiscal_year_end, :date_format | ||
) | ||
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
Oops, something went wrong.