mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-06 06:48:21 +00:00
31 lines
761 B
Ruby
31 lines
761 B
Ruby
class AppsController < ApplicationController
|
|
def index
|
|
authorize App
|
|
@apps = App.where(organization: @current_user.organization).order('created_at desc')
|
|
end
|
|
|
|
def create
|
|
authorize App
|
|
@app = App.create({
|
|
name: 'Untitled app',
|
|
organization: @current_user.organization,
|
|
current_version: AppVersion.new(name: 'v0')
|
|
})
|
|
end
|
|
|
|
def show
|
|
@app = App.find params[:id]
|
|
authorize @app
|
|
end
|
|
|
|
def update
|
|
authorize App
|
|
@app = App.find params[:id]
|
|
@app.update(params['app'].permit('name', 'current_version_id'))
|
|
end
|
|
|
|
def users
|
|
@app = App.find params[:app_id]
|
|
@app_users = AppUser.where(app: @app).includes(:user)
|
|
end
|
|
end
|