From 15b9d93ed729d430a6499a213042b9ec5a62823a Mon Sep 17 00:00:00 2001 From: vmg192 <110127704+vmg192@users.noreply.github.com> Date: Mon, 8 Dec 2025 15:01:24 -0300 Subject: [PATCH] =?UTF-8?q?Revert=20"Implementa=C3=A7=C3=A3o=20Issues=20#3?= =?UTF-8?q?6=20e=20#37"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 - Gemfile | 4 +- Gemfile.lock | 11 -- Procfile.dev | 2 - app/assets/builds/.keep | 0 app/assets/tailwind/application.css | 11 -- app/controllers/home_controller.rb | 4 - app/helpers/home_helper.rb | 2 - app/mailers/user_mailer.rb | 7 - app/models/MatriculaTurma.rb | 4 - app/models/modelo.rb | 5 - app/models/pergunta.rb | 6 - app/models/turma.rb | 6 - app/models/user.rb | 14 -- app/services/sigaa_import_service.rb | 142 ------------------ app/views/home/index.html.erb | 4 - app/views/layouts/application.html.erb | 19 +-- bin/dev | 18 +-- config/environments/development.rb | 14 +- config/environments/test.rb | 4 +- config/initializers/inflections.rb | 7 +- config/routes.rb | 3 +- config/tailwind.config.js | 27 ---- db/migrate/20231026000001_create_turmas.rb | 11 -- .../20231026000002_create_matricula_turmas.rb | 11 -- db/migrate/20251207024056_create_usuarios.rb | 19 --- db/migrate/20251207035036_create_modelos.rb | 10 -- db/migrate/20251207041731_create_perguntas.rb | 12 -- db/schema.rb | 47 ------ lib/tasks/cucumber.rake | 43 +++--- test/controllers/home_controller_test.rb | 8 - test/fixtures/modelos.yml | 9 -- test/fixtures/perguntas.yml | 13 -- test/fixtures/usuarios.yml | 19 --- test/mailers/application_mailer_test.rb | 7 - test/mailers/user_mailer_test.rb | 7 - test/models/MatriculaTurma_test.rb | 7 - test/models/modelo_test.rb | 7 - test/models/pergunta_test.rb | 7 - test/models/turma_test.rb | 7 - test/models/usuario_test.rb | 21 --- test/services/sigaa_import_service_test.rb | 65 -------- 42 files changed, 46 insertions(+), 603 deletions(-) delete mode 100644 Procfile.dev delete mode 100644 app/assets/builds/.keep delete mode 100644 app/assets/tailwind/application.css delete mode 100644 app/controllers/home_controller.rb delete mode 100644 app/helpers/home_helper.rb delete mode 100644 app/mailers/user_mailer.rb delete mode 100644 app/models/MatriculaTurma.rb delete mode 100644 app/models/modelo.rb delete mode 100644 app/models/pergunta.rb delete mode 100644 app/models/turma.rb delete mode 100644 app/models/user.rb delete mode 100644 app/services/sigaa_import_service.rb delete mode 100644 app/views/home/index.html.erb delete mode 100644 config/tailwind.config.js delete mode 100644 db/migrate/20231026000001_create_turmas.rb delete mode 100644 db/migrate/20231026000002_create_matricula_turmas.rb delete mode 100644 db/migrate/20251207024056_create_usuarios.rb delete mode 100644 db/migrate/20251207035036_create_modelos.rb delete mode 100644 db/migrate/20251207041731_create_perguntas.rb delete mode 100644 db/schema.rb delete mode 100644 test/controllers/home_controller_test.rb delete mode 100644 test/fixtures/modelos.yml delete mode 100644 test/fixtures/perguntas.yml delete mode 100644 test/fixtures/usuarios.yml delete mode 100644 test/mailers/application_mailer_test.rb delete mode 100644 test/mailers/user_mailer_test.rb delete mode 100644 test/models/MatriculaTurma_test.rb delete mode 100644 test/models/modelo_test.rb delete mode 100644 test/models/pergunta_test.rb delete mode 100644 test/models/turma_test.rb delete mode 100644 test/models/usuario_test.rb delete mode 100644 test/services/sigaa_import_service_test.rb diff --git a/.gitignore b/.gitignore index c1e5e466bd..f92525ca5e 100644 --- a/.gitignore +++ b/.gitignore @@ -32,8 +32,3 @@ # Ignore master key for decrypting credentials and more. /config/master.key - -/app/assets/builds/* -!/app/assets/builds/.keep - -.idea/ diff --git a/Gemfile b/Gemfile index eba5cf4b46..8066f79fb4 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ gem "stimulus-rails" gem "jbuilder" # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] -gem "bcrypt", "~> 3.1.7" +# gem "bcrypt", "~> 3.1.7" # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem "tzinfo-data", platforms: %i[ windows jruby ] @@ -63,5 +63,3 @@ group :test do gem "database_cleaner" gem "selenium-webdriver" end - -gem "tailwindcss-rails", "~> 4.4" diff --git a/Gemfile.lock b/Gemfile.lock index d13b318d1e..2858d1707c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -76,7 +76,6 @@ GEM public_suffix (>= 2.0.2, < 7.0) ast (2.4.3) base64 (0.3.0) - bcrypt (3.1.20) bcrypt_pbkdf (1.1.1) benchmark (0.5.0) bigdecimal (3.3.1) @@ -369,14 +368,6 @@ GEM sys-uname (1.4.1) ffi (~> 1.1) memoist3 (~> 1.0.0) - tailwindcss-rails (4.4.0) - railties (>= 7.0.0) - tailwindcss-ruby (~> 4.0) - tailwindcss-ruby (4.1.16) - tailwindcss-ruby (4.1.16-aarch64-linux-gnu) - tailwindcss-ruby (4.1.16-aarch64-linux-musl) - tailwindcss-ruby (4.1.16-x86_64-linux-gnu) - tailwindcss-ruby (4.1.16-x86_64-linux-musl) thor (1.4.0) thruster (0.1.16) thruster (0.1.16-aarch64-linux) @@ -418,7 +409,6 @@ PLATFORMS x86_64-linux-musl DEPENDENCIES - bcrypt (~> 3.1.7) bootsnap brakeman capybara @@ -438,7 +428,6 @@ DEPENDENCIES solid_queue sqlite3 (>= 2.1) stimulus-rails - tailwindcss-rails (~> 4.4) thruster turbo-rails tzinfo-data diff --git a/Procfile.dev b/Procfile.dev deleted file mode 100644 index da151fee94..0000000000 --- a/Procfile.dev +++ /dev/null @@ -1,2 +0,0 @@ -web: bin/rails server -css: bin/rails tailwindcss:watch diff --git a/app/assets/builds/.keep b/app/assets/builds/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/assets/tailwind/application.css b/app/assets/tailwind/application.css deleted file mode 100644 index 1fd5734650..0000000000 --- a/app/assets/tailwind/application.css +++ /dev/null @@ -1,11 +0,0 @@ -@import "tailwindcss"; -@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap'); - -@theme { - --font-roboto: "Roboto", sans-serif; - - --color-project-purple: #6C2365; - --color-project-green: #22C55E; - --color-project-secondary-green: #86EFAC; - --color-project-background-gray: #DBDBDB; -} \ No newline at end of file diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb deleted file mode 100644 index 95f29929ca..0000000000 --- a/app/controllers/home_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class HomeController < ApplicationController - def index - end -end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb deleted file mode 100644 index 23de56ac60..0000000000 --- a/app/helpers/home_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module HomeHelper -end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb deleted file mode 100644 index 7470851785..0000000000 --- a/app/mailers/user_mailer.rb +++ /dev/null @@ -1,7 +0,0 @@ -class UserMailer < ApplicationMailer - def definicao_senha(user) - @user = user - @url = "http://localhost:3000/definicao_senha" #ajustar conforme o necessario - mail(to: @user.email, subject: 'Definição de Senha - Sistema de Gestão') - end -end diff --git a/app/models/MatriculaTurma.rb b/app/models/MatriculaTurma.rb deleted file mode 100644 index 359884ac7e..0000000000 --- a/app/models/MatriculaTurma.rb +++ /dev/null @@ -1,4 +0,0 @@ -class MatriculaTurma < ApplicationRecord - belongs_to :usuario - belongs_to :turma -end diff --git a/app/models/modelo.rb b/app/models/modelo.rb deleted file mode 100644 index 1a058b998e..0000000000 --- a/app/models/modelo.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Modelo < ApplicationRecord - has_many :perguntas - - validates :titulo, presence: true -end diff --git a/app/models/pergunta.rb b/app/models/pergunta.rb deleted file mode 100644 index cbb26f0609..0000000000 --- a/app/models/pergunta.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Pergunta < ApplicationRecord - belongs_to :modelo - - validates :enunciado, presence: true - validates :tipo, presence: true -end diff --git a/app/models/turma.rb b/app/models/turma.rb deleted file mode 100644 index 80fa925bdd..0000000000 --- a/app/models/turma.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Turma < ApplicationRecord - validates :codigo, :nome, :semestre, presence: true - - has_many :matricula_turmas - has_many :usuarios, through: :matricula_turmas -end diff --git a/app/models/user.rb b/app/models/user.rb deleted file mode 100644 index 2e47818df0..0000000000 --- a/app/models/user.rb +++ /dev/null @@ -1,14 +0,0 @@ -class User < ApplicationRecord - has_secure_password - has_many :sessions, dependent: :destroy - has_many :matricula_turmas - has_many :turmas, through: :matricula_turmas - - validates :email_address, presence: true, uniqueness: true - validates :login, presence: true, uniqueness: true - validates :matricula, presence: true, uniqueness: true - validates :nome, presence: true - - normalizes :email_address, with: ->(e) { e.strip.downcase } - normalizes :login, with: ->(l) { l.strip.downcase } -end diff --git a/app/services/sigaa_import_service.rb b/app/services/sigaa_import_service.rb deleted file mode 100644 index ad82709c80..0000000000 --- a/app/services/sigaa_import_service.rb +++ /dev/null @@ -1,142 +0,0 @@ -require 'json' -require 'csv' - -class SigaaImportService - def initialize(file_path) - @file_path = file_path - @results = { - turmas_created: 0, - turmas_updated: 0, - usuarios_created: 0, - usuarios_updated: 0, - errors: [] - } - end - - def process - unless File.exist?(@file_path) - @results[:errors] << "Arquivo não encontrado: #{@file_path}" - return @results - end - - begin - ActiveRecord::Base.transaction do - case File.extname(@file_path).downcase - when '.json' - process_json - when '.csv' - process_csv - else - @results[:errors] << "Formato de arquivo não suportado: #{File.extname(@file_path)}" - end - - if @results[:errors].any? - raise ActiveRecord::Rollback - end - end - rescue JSON::ParserError - @results[:errors] << "Arquivo JSON inválido" - rescue ActiveRecord::StatementInvalid => e - @results[:errors] << "Erro de conexão com o banco de dados: #{e.message}" - rescue StandardError => e - @results[:errors] << "Erro inesperado: #{e.message}" - end - - @results - end - - private - - def process_json - file_content = File.read(@file_path) - data = JSON.parse(file_content) - data.each do |turma_data| - process_turma(turma_data) - end - end - - def process_csv - CSV.foreach(@file_path, headers: true, col_sep: ',') do |row| - # Assumindo estrutura do CSV - turma_data = { - 'codigo' => row['codigo_turma'], - 'nome' => row['nome_turma'], - 'semestre' => row['semestre'] - } - - turma = process_turma_record(turma_data) - - if turma&.persisted? - user_data = { - 'nome' => row['nome_usuario'], - 'email' => row['email'], - 'matricula' => row['matricula'], - 'papel' => row['papel'] - } - process_participante_single(turma, user_data) - end - end - end - - def process_turma(data) - turma = process_turma_record(data) - if turma&.persisted? - process_participantes(turma, data['participantes']) if data['participantes'] - end - end - - def process_turma_record(data) - turma = Turma.find_or_initialize_by(codigo: data['codigo'], semestre: data['semestre']) - - is_new_record = turma.new_record? - turma.nome = data['nome'] - - if turma.save - if is_new_record - @results[:turmas_created] += 1 - else - @results[:turmas_updated] += 1 - end - turma - else - @results[:errors] << "Erro ao salvar turma #{data['codigo']}: #{turma.errors.full_messages.join(', ')}" - nil - end - end - - def process_participantes(turma, participantes_data) - participantes_data.each do |p_data| - process_participante_single(turma, p_data) - end - end - - def process_participante_single(turma, p_data) - # Usuario identificado pela matrícula - user = User.find_or_initialize_by(matricula: p_data['matricula']) - - is_new_user = user.new_record? - user.nome = p_data['nome'] - user.email = p_data['email'] - - generated_password = nil - if is_new_user - generated_password = SecureRandom.hex(8) - user.password = generated_password - end - - if user.save - if is_new_user - @results[:usuarios_created] += 1 - UserMailer.cadastro_email(user, generated_password).deliver_now - else - @results[:usuarios_updated] += 1 - end - - matricula = MatriculaTurma.find_or_initialize_by(turma: turma, user: user) - matricula.papel = p_data['papel'] - matricula.save! - else - @results[:errors] << "Erro ao salvar usuário #{p_data['matricula']}: #{user.errors.full_messages.join(', ')}" - end - end -end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb deleted file mode 100644 index ea851aba58..0000000000 --- a/app/views/home/index.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -
Find me in app/views/home/index.html.erb
-