33 lines
875 B
Ruby
33 lines
875 B
Ruby
class ArtifactsController < ApplicationController
|
|
|
|
respond_to :json
|
|
|
|
# create or update a client_artifact row
|
|
def update_artifacts
|
|
|
|
product = params[:product]
|
|
version = params[:version]
|
|
uri = params[:uri]
|
|
file = params[:file]
|
|
environment = params[:environment]
|
|
|
|
ArtifactUpdate.transaction do
|
|
# VRFS-1071: Postpone client update notification until installer is available for download
|
|
ArtifactUpdate.connection.execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED')
|
|
@artifact = ArtifactUpdate.find_or_create_by_product_and_environment(product, environment)
|
|
|
|
@artifact.version = version
|
|
@artifact.uri = file
|
|
|
|
@artifact.save
|
|
end
|
|
|
|
unless @artifact.errors.any?
|
|
render :json => {}, :status => :ok
|
|
else
|
|
response.status = :unprocessable_entity
|
|
respond_with @artifact
|
|
end
|
|
end
|
|
|
|
end |