From a15ba945fd343c9cf09c10bfc60e9455c97f59e7 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 5 Jun 2020 17:56:17 -0500 Subject: [PATCH] do it --- admin/app/controllers/arses_controller.rb | 8 +++++++- admin/app/controllers/artifacts_controller.rb | 12 ++++++------ db/up/find_sessions_2020.sql | 10 ++++++++-- pb/src/client_container.proto | 3 +++ ruby/lib/jam_ruby/message_factory.rb | 4 +++- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/admin/app/controllers/arses_controller.rb b/admin/app/controllers/arses_controller.rb index 2c0fcc8b6..9e1559d35 100644 --- a/admin/app/controllers/arses_controller.rb +++ b/admin/app/controllers/arses_controller.rb @@ -7,6 +7,9 @@ class ArsesController < ApplicationController name = params[:name] provider = params[:provider] active = params[:active] + ip = params[:ip] + username = params[:username] + password = params[:password] ars = Ars.find_by_name(name) if ars.nil? @@ -16,12 +19,15 @@ class ArsesController < ApplicationController ars.provider = provider ars.active = active + ars.ip = ip + ars.password = password + ars.username = username ars.save @ars = ars unless @ars.errors.any? @ars = Ars.find_by_name(name) - render :json => {id_int: @ars.id_int, id: @ars.id, name: @ars.name, provider: @ars.provider, active: @ars.active}, :status => :ok + render :json => {id_int: @ars.id_int, id: @ars.id, name: @ars.name, provider: @ars.provider, active: @ars.active, ip: @ars.ip}, :status => :ok else response.status = :unprocessable_entity respond_with @ars diff --git a/admin/app/controllers/artifacts_controller.rb b/admin/app/controllers/artifacts_controller.rb index 88699cd80..dea8f478d 100644 --- a/admin/app/controllers/artifacts_controller.rb +++ b/admin/app/controllers/artifacts_controller.rb @@ -26,12 +26,12 @@ class ArtifactsController < ApplicationController end end - unless @artifact.errors.any? - render :json => {}, :status => :ok - else - response.status = :unprocessable_entity - respond_with @artifact - end + unless @artifact.errors.any? + render :json => {}, :status => :ok + else + response.status = :unprocessable_entity + respond_with @artifact + end end end \ No newline at end of file diff --git a/db/up/find_sessions_2020.sql b/db/up/find_sessions_2020.sql index 9447e9308..5ab50ce45 100644 --- a/db/up/find_sessions_2020.sql +++ b/db/up/find_sessions_2020.sql @@ -25,7 +25,7 @@ alter table music_sessions add column music_session_id_int int not null default CREATE TABLE arses ( id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), - name VARCHAR(20) NOT NULL UNIQUE NOT NULL, + name VARCHAR(200) NOT NULL UNIQUE NOT NULL, id_int SMALLINT UNIQUE NOT NULL, ip VARCHAR(200) UNIQUE NOT NULL, active BOOLEAN DEFAULT TRUE, @@ -33,6 +33,7 @@ CREATE TABLE arses ( updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); +alter table arses alter column name TYPE varchar(200); ALTER TABLE arses DROP COLUMN ip; ALTER TABLE arses DROP COLUMN id_int; --ALTER TABLE arses DROP COLUMN provider; @@ -42,7 +43,12 @@ ALTER TABLE arses ADD COLUMN provider varchar(20) NOT NULL default 'gcp'; create sequence arses_id_int_seq; alter table arses add column id_int int not null default nextval('arses_id_int_seq'); +ALTER TABLE arses ADD COLUMN ip VARCHAR(200); +ALTER TABLE arses ADD COLUMN username VARCHAR(200) default 'jamjam'; +ALTER TABLE arses ADD COLUMN password VARCHAR(200) default 'blueberryjam'; +ALTER TABLE arses ADD COLUMN port int default 3478; ------ -ALTER TABLE generic_state ADD COLUMN top_message VARCHAR(100000); \ No newline at end of file +ALTER TABLE generic_state ADD COLUMN top_message VARCHAR(100000); + diff --git a/pb/src/client_container.proto b/pb/src/client_container.proto index 0e4c66582..db747dac8 100644 --- a/pb/src/client_container.proto +++ b/pb/src/client_container.proto @@ -813,6 +813,9 @@ message Ars { optional int32 id = 1; optional string ip = 2; optional string name = 3; + optional string username = 4; + optional string password = 5; + optional int32 port = 6; } // target: client diff --git a/ruby/lib/jam_ruby/message_factory.rb b/ruby/lib/jam_ruby/message_factory.rb index 365e94062..687a0fba1 100644 --- a/ruby/lib/jam_ruby/message_factory.rb +++ b/ruby/lib/jam_ruby/message_factory.rb @@ -83,7 +83,9 @@ module JamRuby arses << Jampb::Ars.new( :id => ars.id_int, :ip => ars.ip, - :name => ars.name + :username => ars.username, + :password => ars.password, + :port => ars.port ) end if ars_list