From db8d25bb90e1a624185ebe04ef16db811ad5fef7 Mon Sep 17 00:00:00 2001
From: tmn21 <tmn21@inf.ufpr.br>
Date: Thu, 22 Jun 2023 14:05:43 +0000
Subject: [PATCH] Issue/49 add restart streaks to schedule

---
 Gemfile                                          | 4 ++++
 app/controllers/v1/user_progresses_controller.rb | 2 ++
 app/mailers/user_mailer.rb                       | 4 ++--
 app/models/view.rb                               | 2 +-
 config/application.rb                            | 1 +
 config/database.yml                              | 4 ++--
 config/env_vars.sh                               | 3 ++-
 config/routes.rb                                 | 4 ++--
 config/schedule.rb                               | 4 ++++
 env_vars.txt                                     | 4 +++-
 lib/tasks/email_sender.rake                      | 2 +-
 11 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/Gemfile b/Gemfile
index bbf2035ff..b60365f7d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -11,6 +11,7 @@ gem 'sdoc', '>= 0.4.0', group: :doc
 # Use ActiveModel has_secure_password
 gem 'bcrypt', '>= 3.1.7'
 
+
 # memcached
 gem 'dalli'
 
@@ -181,4 +182,7 @@ gem 'faraday-net_http_persistent', '~> 2.0'
 
 gem 'elasticsearch', '~> 8.6' 
 
+gem 'multipart-post', '~> 2.0'
+
+gem 'faraday-multipart', '~> 1.0', '>= 1.0.4'
 
diff --git a/app/controllers/v1/user_progresses_controller.rb b/app/controllers/v1/user_progresses_controller.rb
index 74d28ace7..76076cd2a 100644
--- a/app/controllers/v1/user_progresses_controller.rb
+++ b/app/controllers/v1/user_progresses_controller.rb
@@ -30,4 +30,6 @@ class V1::UserProgressesController < ApplicationController
         render json: all_progresses_paginate
     end
 
+
+
 end
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index 07c423966..6748a5d79 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -1,7 +1,7 @@
 class UserMailer < ActionMailer::Base
 
     #set the default email sender
-    default from: 'portalmec_tec@inf.ufpr.br'
+    default from: 'integrada.contato@mec.gov.br'
 
     #function to send email to user when he/she is created through the admin panel
     def welcome_email (user)
@@ -17,7 +17,7 @@ class UserMailer < ActionMailer::Base
 
     def users_email_sender (email, subject, body)
         @body = body
-        mail(to: email, subject: subject)
+        mail(from: "integrada.contato@mec.gov.br", to: email, subject: subject)
     end
 
 end
diff --git a/app/models/view.rb b/app/models/view.rb
index 3aedbb486..f6f56d051 100644
--- a/app/models/view.rb
+++ b/app/models/view.rb
@@ -70,4 +70,4 @@ class View < ApplicationRecord
       user.complete_action(Action.find_by_name("Visualizar uma Coleção")) if viewable_type == "Collection"
     end
   end
-end
+end
\ No newline at end of file
diff --git a/config/application.rb b/config/application.rb
index a045b9cac..552d3f5ce 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -91,6 +91,7 @@ module Portalmec
 
     # api mode
     config.api_only = true
+    
 
     #TODO fix ugly code when omniauth is fixed
     # Only loads a smaller set of middleware suitable for API only apps.
diff --git a/config/database.yml b/config/database.yml
index 4a6887cbb..20ae345b0 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -7,7 +7,7 @@ development:
   encoding: unicode
   database: portalmecapi
   username: postgres
-  password: luanmatheus
+  password: 123mudar
   host: localhost
 
 test:
@@ -15,7 +15,7 @@ test:
   encoding: unicode
   database: portalmecapi
   username: postgres
-  password: luanmatheus
+  password: 123mudar
   host: localhost
 
 production:
diff --git a/config/env_vars.sh b/config/env_vars.sh
index b140ed101..fdef16e80 100644
--- a/config/env_vars.sh
+++ b/config/env_vars.sh
@@ -38,7 +38,8 @@ export PORTALMEC_DSPACE_HOST=mecdb4.c3sl.ufpr.br
 export PORTALMEC_ELASTICSEARCH_LOGIN=elastic
 export PORTALMEC_ELASTICSEARCH_PASSWORD=123mudar
 export PORTALMEC_ELASTICSEARCH_PORT=9200
-export PORTALMEC_ELASTICSEARCH_HOST=localhost
+#export PORTALMEC_ELASTICSEARCH_HOST=localhost
+export PORTALMEC_ELASTICSEARCH_HOST=elasticsearchupgrade
 #export PORTALMEC_ELASTICSEARCH_HOST=elasticsearchprod
 
 ### Cache
diff --git a/config/routes.rb b/config/routes.rb
index 5238f976d..39b68f8a5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -19,8 +19,8 @@
 
 Rails.application.routes.draw do
 
-  # require 'sidekiq/web'
-  # mount Sidekiq::Web, at: '/sidekiq'
+  require 'sidekiq/web'
+  mount Sidekiq::Web, at: '/sidekiq'
 
   concern :deletable do
     collection do
diff --git a/config/schedule.rb b/config/schedule.rb
index 3ed49087f..5937de491 100644
--- a/config/schedule.rb
+++ b/config/schedule.rb
@@ -56,3 +56,7 @@ end
 every 5.days do
   rake 'delete_production_log:delete_log'
 end
+
+every 1.days, at: '12am' do
+  rake 'user:restart_streaks'
+end
\ No newline at end of file
diff --git a/env_vars.txt b/env_vars.txt
index a4548a941..facd3d528 100644
--- a/env_vars.txt
+++ b/env_vars.txt
@@ -7,8 +7,10 @@ PORTALMEC_DSPACE_LOGIN=admin@mecdb3.c3sl.ufpr.br
 PORTALMEC_DSPACE_PASSWORD=admin
 PORTALMEC_DSPACE_PORT=8443
 PORTALMEC_DSPACE_HOST=mecdb4.c3sl.ufpr.br
+PORTALMEC_ELASTICSEARCH_LOGIN=elastic
+PORTALMEC_ELASTICSEARCH_PASSWORD=123mudar
 PORTALMEC_ELASTICSEARCH_PORT=9200
-PORTALMEC_ELASTICSEARCH_HOST=localhost
+PORTALMEC_ELASTICSEARCH_HOST=elasticsearchupgrade
 MEMCACHE_SERVERS=localhost
 ACTION_MAILER_HOST=api.portalmectest.c3sl.ufpr.br
 SMTP_ADDRESS=urquell.c3sl.ufpr.br
diff --git a/lib/tasks/email_sender.rake b/lib/tasks/email_sender.rake
index 40ad9cdab..4a3bec31a 100644
--- a/lib/tasks/email_sender.rake
+++ b/lib/tasks/email_sender.rake
@@ -5,4 +5,4 @@ namespace :email_users do
         UserMailer.users_email_sender(@user).deliver_now
     end
 
-end
\ No newline at end of file
+end
-- 
GitLab