ToolJet/app/controllers/apps_controller.rb

33 lines
782 B
Ruby
Raw Normal View History

2021-04-01 10:59:27 +00:00
class AppsController < ApplicationController
2021-04-05 07:49:48 +00:00
def index
authorize App
2021-04-12 06:31:44 +00:00
@apps = App.where(organization: @current_user.organization).order("created_at desc")
2021-04-05 07:49:48 +00:00
end
2021-04-02 11:09:35 +00:00
2021-04-01 10:59:27 +00:00
def create
authorize App
2021-04-12 14:05:52 +00:00
@app = App.create({
name: 'Untitled app',
organization: @current_user.organization,
current_version: AppVersion.new(name: 'v0')
})
2021-04-01 10:59:27 +00:00
end
2021-04-02 11:09:35 +00:00
def show
2021-04-02 11:09:35 +00:00
@app = App.find params[:id]
authorize @app
2021-04-02 11:09:35 +00:00
end
def update
authorize App
2021-04-05 12:07:29 +00:00
@app = App.find params[:id]
2021-04-25 09:07:00 +00:00
@app.update(params["app"].permit("name", "current_version_id"))
2021-04-02 11:09:35 +00:00
end
2021-04-12 04:12:00 +00:00
def users
@app = App.find params[:app_id]
@app_users = AppUser.where(app: @app).includes(:user)
end
2021-04-01 10:59:27 +00:00
end