2021-04-01 10:59:27 +00:00
|
|
|
class AppsController < ApplicationController
|
2021-04-05 07:49:48 +00:00
|
|
|
|
|
|
|
|
def index
|
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
|
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
|
|
|
|
|
@app = App.find params[:id]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def update
|
2021-04-05 12:07:29 +00:00
|
|
|
@app = App.find params[:id]
|
2021-04-12 10:29:53 +00:00
|
|
|
@app.update(definition: params[:definition], name: params[:name], current_version_id: params['currentVersion'])
|
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
|