From 9c06b60724f39d8d24ee415023f08f84b8dcd7d8 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Sun, 8 Sep 2024 13:47:34 -0400 Subject: [PATCH 01/83] Updated Welcome Message --- app/views/stations/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/stations/index.html.erb b/app/views/stations/index.html.erb index d211dda42..e8bda4665 100644 --- a/app/views/stations/index.html.erb +++ b/app/views/stations/index.html.erb @@ -1,7 +1,7 @@
- Welcome to ValetBike! + Welcome to ValetBike, we are happy to help!
<% if @stations.present? %> From d6a73a0fa661f6623929d6ec43d59d01ff8191ef Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Tue, 29 Oct 2024 16:26:21 -0400 Subject: [PATCH 02/83] Added name to README.md file --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 85f6c86ae..67e77833c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ +# MAGGIE # ValetBike - -Smith College CSC223: Software Engineering\ +Smith College CSC223: Software Engineering Starter App for ValetBike project ## Environment Configuration From a9943e00444027b39c95afdaaa5bb2de6586096c Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Tue, 29 Oct 2024 16:28:10 -0400 Subject: [PATCH 03/83] Fernanda Testing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85f6c86ae..c69220b0a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ValetBike - +Hello I am here! Smith College CSC223: Software Engineering\ Starter App for ValetBike project From 2f070cdb152bb222acedf85a5c8a7683ee6dc41a Mon Sep 17 00:00:00 2001 From: Nafisa Mohamed Date: Tue, 29 Oct 2024 16:41:20 -0400 Subject: [PATCH 04/83] name added to read me --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85f6c86ae..17f47e7ed 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ValetBike - +Name: Nafisa Mohamed Smith College CSC223: Software Engineering\ Starter App for ValetBike project From 87b5dab6fd9a39e503ee79a49008ea66713145c8 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Tue, 29 Oct 2024 17:05:46 -0400 Subject: [PATCH 05/83] Added new line --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b75c0d26..280cc4d06 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ValetBike -Smith College CSC223: Software Engineering +Smith College CSC223: Software Engineering\ Group Members: Maggie, Nafisa, Fernanda Starter App for ValetBike project From c94c5768e2e3646b85190480e2b2f40dbcc6ce71 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Tue, 29 Oct 2024 17:18:57 -0400 Subject: [PATCH 06/83] Testing branch --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 280cc4d06..0f0d7c265 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # ValetBike Smith College CSC223: Software Engineering\ +Testing Branch Group Members: Maggie, Nafisa, Fernanda Starter App for ValetBike project From 9c683a167022852f94607eac1758be1ccfd291ba Mon Sep 17 00:00:00 2001 From: Mackenzie Martin Date: Tue, 29 Oct 2024 17:30:36 -0400 Subject: [PATCH 07/83] added name to readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 280cc4d06..6af1b01fb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ValetBike Smith College CSC223: Software Engineering\ -Group Members: Maggie, Nafisa, Fernanda +Group Members: Maggie, Nafisa, Fernanda, Mackenzie Starter App for ValetBike project From ee9536f0daebd375e36837fc223a7a74ced7c909 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Tue, 29 Oct 2024 17:40:38 -0400 Subject: [PATCH 08/83] Showing Nafisa --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 0f0d7c265..280cc4d06 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # ValetBike Smith College CSC223: Software Engineering\ -Testing Branch Group Members: Maggie, Nafisa, Fernanda Starter App for ValetBike project From e2a965d69e8e2f6cd9798241c4a37489091b8598 Mon Sep 17 00:00:00 2001 From: Mackenzie Martin Date: Wed, 30 Oct 2024 16:13:54 -0400 Subject: [PATCH 09/83] Creating a stub for the station class. --- app/controllers/stations_controller.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/controllers/stations_controller.rb b/app/controllers/stations_controller.rb index 88090af16..36be0c090 100644 --- a/app/controllers/stations_controller.rb +++ b/app/controllers/stations_controller.rb @@ -3,5 +3,20 @@ class StationsController < ApplicationController def index @stations = Station.all.order(identifier: :asc) end - + + def has_bike(bike_id) + + end + + def checkout_bike(bike_id) + + end + + def return_bike(bike_id) + + end + + def get_list_of_bikes(station_id) + + end end From 65e73f36f66fb89bfbe0cc6eebbb821a3c32aa62 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Wed, 30 Oct 2024 16:33:40 -0400 Subject: [PATCH 10/83] Generated controller and views for Users class --- Gemfile.lock | 3 ++- app/controllers/users_controller.rb | 7 +++++++ app/helpers/users_helper.rb | 2 ++ app/views/users/delete_account.html.erb | 4 ++++ app/views/users/verify_account.html.erb | 4 ++++ config/routes.rb | 2 ++ test/controllers/users_controller_test.rb | 13 +++++++++++++ 7 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 app/controllers/users_controller.rb create mode 100644 app/helpers/users_helper.rb create mode 100644 app/views/users/delete_account.html.erb create mode 100644 app/views/users/verify_account.html.erb create mode 100644 test/controllers/users_controller_test.rb diff --git a/Gemfile.lock b/Gemfile.lock index c3e104938..f46d2760d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -132,7 +132,7 @@ GEM digest net-protocol timeout - nio4r (2.5.8) + nio4r (2.7.4) nokogiri (1.13.8-arm64-darwin) racc (~> 1.4) nokogiri (1.13.8-x86_64-linux) @@ -223,6 +223,7 @@ GEM PLATFORMS arm64-darwin-20 + arm64-darwin-23 x86_64-linux DEPENDENCIES diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 000000000..432ecf2f6 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,7 @@ +class UsersController < ApplicationController + def verify_account + end + + def delete_account + end +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 000000000..2310a240d --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/views/users/delete_account.html.erb b/app/views/users/delete_account.html.erb new file mode 100644 index 000000000..24571509c --- /dev/null +++ b/app/views/users/delete_account.html.erb @@ -0,0 +1,4 @@ +
+

Users#delete_account

+

Find me in app/views/users/delete_account.html.erb

+
diff --git a/app/views/users/verify_account.html.erb b/app/views/users/verify_account.html.erb new file mode 100644 index 000000000..9c8869d6a --- /dev/null +++ b/app/views/users/verify_account.html.erb @@ -0,0 +1,4 @@ +
+

Users#verify_account

+

Find me in app/views/users/verify_account.html.erb

+
diff --git a/config/routes.rb b/config/routes.rb index f1eb0a0d8..f3d3f59a3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ Rails.application.routes.draw do + get 'users/verify_account' + get 'users/delete_account' root to: "stations#index" end \ No newline at end of file diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb new file mode 100644 index 000000000..b140833c2 --- /dev/null +++ b/test/controllers/users_controller_test.rb @@ -0,0 +1,13 @@ +require "test_helper" + +class UsersControllerTest < ActionDispatch::IntegrationTest + test "should get verify_account" do + get users_verify_account_url + assert_response :success + end + + test "should get delete_account" do + get users_delete_account_url + assert_response :success + end +end From e756e402811dce31cd436cc4b0f20811a7df5494 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 31 Oct 2024 14:34:51 -0400 Subject: [PATCH 11/83] Created User Model and User Migration --- app/models/user.rb | 2 ++ db/migrate/20241031182235_create_users.rb | 10 ++++++++++ db/schema.rb | 10 +++++++++- test/fixtures/users.yml | 0 test/models/user_test.rb | 7 +++++++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 app/models/user.rb create mode 100644 db/migrate/20241031182235_create_users.rb create mode 100644 test/fixtures/users.yml create mode 100644 test/models/user_test.rb diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 000000000..379658a50 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,2 @@ +class User < ApplicationRecord +end diff --git a/db/migrate/20241031182235_create_users.rb b/db/migrate/20241031182235_create_users.rb new file mode 100644 index 000000000..508470ad0 --- /dev/null +++ b/db/migrate/20241031182235_create_users.rb @@ -0,0 +1,10 @@ +class CreateUsers < ActiveRecord::Migration[7.0] + def change + create_table :users do |t| + t.string :userName + t.string :password + t.boolean :loginStatus + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index b98268f0e..604e2c8d0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2022_08_31_090719) do +ActiveRecord::Schema[7.0].define(version: 2024_10_31_182235) do create_table "bikes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.integer "identifier" t.integer "current_station_id" @@ -26,4 +26,12 @@ t.datetime "updated_at", null: false end + create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "userName" + t.string "password" + t.boolean "loginStatus" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + end diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 000000000..e69de29bb diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 000000000..5c07f4900 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From c4c80af215ffc79b3ef1a0ae99547ed12f5a3f72 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Thu, 31 Oct 2024 15:55:50 -0400 Subject: [PATCH 12/83] Coded verify_account method within Users controller -- should not be final place --- app/controllers/users_controller.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 432ecf2f6..16a8df980 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,18 @@ class UsersController < ApplicationController - def verify_account + def verify_account(userName, password) + # if userName is not in database + if User.where(userName: userName).count == 0 + false + # userName is in database + else + # find user password associated + user = User.where(userName: userName)[0] + # if the password is not the same as the one in the database + if user.password != password + false + end + # if the userName is in the database and the password matches, then all good! + true end def delete_account From 0c53d5bb8ce260bf1b21c5a79dd9a8a9505d5f09 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sat, 2 Nov 2024 14:26:07 -0400 Subject: [PATCH 13/83] Create controller for Director class with methods login, register, and verify_email. --- app/controllers/directors_controller.rb | 10 ++++++++++ app/helpers/directors_helper.rb | 2 ++ app/views/directors/login.html.erb | 4 ++++ app/views/directors/register.html.erb | 4 ++++ app/views/directors/verify_email.html.erb | 4 ++++ config/routes.rb | 3 +++ test/controllers/directors_controller_test.rb | 18 ++++++++++++++++++ 7 files changed, 45 insertions(+) create mode 100644 app/controllers/directors_controller.rb create mode 100644 app/helpers/directors_helper.rb create mode 100644 app/views/directors/login.html.erb create mode 100644 app/views/directors/register.html.erb create mode 100644 app/views/directors/verify_email.html.erb create mode 100644 test/controllers/directors_controller_test.rb diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb new file mode 100644 index 000000000..af3ae64f8 --- /dev/null +++ b/app/controllers/directors_controller.rb @@ -0,0 +1,10 @@ +class DirectorsController < ApplicationController + def login + end + + def register + end + + def verify_email + end +end diff --git a/app/helpers/directors_helper.rb b/app/helpers/directors_helper.rb new file mode 100644 index 000000000..53a912e5e --- /dev/null +++ b/app/helpers/directors_helper.rb @@ -0,0 +1,2 @@ +module DirectorsHelper +end diff --git a/app/views/directors/login.html.erb b/app/views/directors/login.html.erb new file mode 100644 index 000000000..f5694ad98 --- /dev/null +++ b/app/views/directors/login.html.erb @@ -0,0 +1,4 @@ +
+

Directors#login

+

Find me in app/views/directors/login.html.erb

+
diff --git a/app/views/directors/register.html.erb b/app/views/directors/register.html.erb new file mode 100644 index 000000000..b28e30829 --- /dev/null +++ b/app/views/directors/register.html.erb @@ -0,0 +1,4 @@ +
+

Directors#register

+

Find me in app/views/directors/register.html.erb

+
diff --git a/app/views/directors/verify_email.html.erb b/app/views/directors/verify_email.html.erb new file mode 100644 index 000000000..affc874c6 --- /dev/null +++ b/app/views/directors/verify_email.html.erb @@ -0,0 +1,4 @@ +
+

Directors#verify_email

+

Find me in app/views/directors/verify_email.html.erb

+
diff --git a/config/routes.rb b/config/routes.rb index f3d3f59a3..5f22518da 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,7 @@ Rails.application.routes.draw do + get 'directors/login' + get 'directors/register' + get 'directors/verify_email' get 'users/verify_account' get 'users/delete_account' root to: "stations#index" diff --git a/test/controllers/directors_controller_test.rb b/test/controllers/directors_controller_test.rb new file mode 100644 index 000000000..37e7d5ad0 --- /dev/null +++ b/test/controllers/directors_controller_test.rb @@ -0,0 +1,18 @@ +require "test_helper" + +class DirectorsControllerTest < ActionDispatch::IntegrationTest + test "should get login" do + get directors_login_url + assert_response :success + end + + test "should get register" do + get directors_register_url + assert_response :success + end + + test "should get verify_email" do + get directors_verify_email_url + assert_response :success + end +end From 2cfee9ff14602520dd9610ac4ac8ba60436f32d0 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Sat, 2 Nov 2024 14:44:22 -0400 Subject: [PATCH 14/83] Created Customer database --- app/controllers/customers_controller.rb | 13 +++++++++++ app/helpers/customers_helper.rb | 2 ++ app/models/customer.rb | 2 ++ app/views/customers/end_trip.html.erb | 4 ++++ .../customers/past_trip_calculations.html.erb | 4 ++++ app/views/customers/start_trip.html.erb | 4 ++++ app/views/customers/update_profile.html.erb | 4 ++++ config/routes.rb | 4 ++++ db/migrate/20241102184317_create_customers.rb | 14 +++++++++++ db/schema.rb | 13 ++++++++++- test/controllers/customers_controller_test.rb | 23 +++++++++++++++++++ test/fixtures/customers.yml | 17 ++++++++++++++ test/models/customer_test.rb | 7 ++++++ 13 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 app/controllers/customers_controller.rb create mode 100644 app/helpers/customers_helper.rb create mode 100644 app/models/customer.rb create mode 100644 app/views/customers/end_trip.html.erb create mode 100644 app/views/customers/past_trip_calculations.html.erb create mode 100644 app/views/customers/start_trip.html.erb create mode 100644 app/views/customers/update_profile.html.erb create mode 100644 db/migrate/20241102184317_create_customers.rb create mode 100644 test/controllers/customers_controller_test.rb create mode 100644 test/fixtures/customers.yml create mode 100644 test/models/customer_test.rb diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb new file mode 100644 index 000000000..f95b9c5d8 --- /dev/null +++ b/app/controllers/customers_controller.rb @@ -0,0 +1,13 @@ +class CustomersController < ApplicationController + def update_profile + end + + def start_trip + end + + def end_trip + end + + def past_trip_calculations + end +end diff --git a/app/helpers/customers_helper.rb b/app/helpers/customers_helper.rb new file mode 100644 index 000000000..a07ce2943 --- /dev/null +++ b/app/helpers/customers_helper.rb @@ -0,0 +1,2 @@ +module CustomersHelper +end diff --git a/app/models/customer.rb b/app/models/customer.rb new file mode 100644 index 000000000..0b5277335 --- /dev/null +++ b/app/models/customer.rb @@ -0,0 +1,2 @@ +class Customer < ApplicationRecord +end diff --git a/app/views/customers/end_trip.html.erb b/app/views/customers/end_trip.html.erb new file mode 100644 index 000000000..b3d4eae84 --- /dev/null +++ b/app/views/customers/end_trip.html.erb @@ -0,0 +1,4 @@ +
+

Customers#end_trip

+

Find me in app/views/customers/end_trip.html.erb

+
diff --git a/app/views/customers/past_trip_calculations.html.erb b/app/views/customers/past_trip_calculations.html.erb new file mode 100644 index 000000000..20af0289f --- /dev/null +++ b/app/views/customers/past_trip_calculations.html.erb @@ -0,0 +1,4 @@ +
+

Customers#past_trip_calculations

+

Find me in app/views/customers/past_trip_calculations.html.erb

+
diff --git a/app/views/customers/start_trip.html.erb b/app/views/customers/start_trip.html.erb new file mode 100644 index 000000000..0aacaea1c --- /dev/null +++ b/app/views/customers/start_trip.html.erb @@ -0,0 +1,4 @@ +
+

Customers#start_trip

+

Find me in app/views/customers/start_trip.html.erb

+
diff --git a/app/views/customers/update_profile.html.erb b/app/views/customers/update_profile.html.erb new file mode 100644 index 000000000..4b279bcf1 --- /dev/null +++ b/app/views/customers/update_profile.html.erb @@ -0,0 +1,4 @@ +
+

Customers#update_profile

+

Find me in app/views/customers/update_profile.html.erb

+
diff --git a/config/routes.rb b/config/routes.rb index 5f22518da..ed910cb08 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,8 @@ Rails.application.routes.draw do + get 'customers/update_profile' + get 'customers/start_trip' + get 'customers/end_trip' + get 'customers/past_trip_calculations' get 'directors/login' get 'directors/register' get 'directors/verify_email' diff --git a/db/migrate/20241102184317_create_customers.rb b/db/migrate/20241102184317_create_customers.rb new file mode 100644 index 000000000..76d6f7e19 --- /dev/null +++ b/db/migrate/20241102184317_create_customers.rb @@ -0,0 +1,14 @@ +class CreateCustomers < ActiveRecord::Migration[7.0] + def change + create_table :customers do |t| + t.string :firstName + t.string :lastName + t.float :longitude + t.float :latitude + t.string :email + t.string :password + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 604e2c8d0..738641889 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_10_31_182235) do +ActiveRecord::Schema[7.0].define(version: 2024_11_02_184317) do create_table "bikes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.integer "identifier" t.integer "current_station_id" @@ -18,6 +18,17 @@ t.datetime "updated_at", null: false end + create_table "customers", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "firstName" + t.string "lastName" + t.float "longitude" + t.float "latitude" + t.string "email" + t.string "password" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "stations", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.integer "identifier" t.string "name" diff --git a/test/controllers/customers_controller_test.rb b/test/controllers/customers_controller_test.rb new file mode 100644 index 000000000..5d01496f1 --- /dev/null +++ b/test/controllers/customers_controller_test.rb @@ -0,0 +1,23 @@ +require "test_helper" + +class CustomersControllerTest < ActionDispatch::IntegrationTest + test "should get update_profile" do + get customers_update_profile_url + assert_response :success + end + + test "should get start_trip" do + get customers_start_trip_url + assert_response :success + end + + test "should get end_trip" do + get customers_end_trip_url + assert_response :success + end + + test "should get past_trip_calculations" do + get customers_past_trip_calculations_url + assert_response :success + end +end diff --git a/test/fixtures/customers.yml b/test/fixtures/customers.yml new file mode 100644 index 000000000..7ed02607e --- /dev/null +++ b/test/fixtures/customers.yml @@ -0,0 +1,17 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + firstName: MyString + lastName: MyString + longitude: 1.5 + latitude: 1.5 + email: MyString + password: MyString + +two: + firstName: MyString + lastName: MyString + longitude: 1.5 + latitude: 1.5 + email: MyString + password: MyString diff --git a/test/models/customer_test.rb b/test/models/customer_test.rb new file mode 100644 index 000000000..8c83c4d9a --- /dev/null +++ b/test/models/customer_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class CustomerTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 157ae09e6b243f21faa18fa3b58e2e1266445086 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Sat, 2 Nov 2024 15:08:39 -0400 Subject: [PATCH 15/83] Created directory database --- app/controllers/directors_controller.rb | 6 ++++-- app/models/directory.rb | 2 ++ db/migrate/20241102190659_create_directories.rb | 8 ++++++++ db/schema.rb | 7 ++++++- test/fixtures/directories.yml | 11 +++++++++++ test/models/directory_test.rb | 7 +++++++ 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 app/models/directory.rb create mode 100644 db/migrate/20241102190659_create_directories.rb create mode 100644 test/fixtures/directories.yml create mode 100644 test/models/directory_test.rb diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index af3ae64f8..b275b9d13 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -5,6 +5,8 @@ def login def register end - def verify_email + def verify_email(email:string) + #Checks Customer database and returns true if it exits otherwise false + inDatabase = Customer.where(email: email).first != nil ? true : false + inDatabase end -end diff --git a/app/models/directory.rb b/app/models/directory.rb new file mode 100644 index 000000000..8273cd5c2 --- /dev/null +++ b/app/models/directory.rb @@ -0,0 +1,2 @@ +class Directory < ApplicationRecord +end diff --git a/db/migrate/20241102190659_create_directories.rb b/db/migrate/20241102190659_create_directories.rb new file mode 100644 index 000000000..6e51b0610 --- /dev/null +++ b/db/migrate/20241102190659_create_directories.rb @@ -0,0 +1,8 @@ +class CreateDirectories < ActiveRecord::Migration[7.0] + def change + create_table :directories do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 738641889..0ae4f13c4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_11_02_184317) do +ActiveRecord::Schema[7.0].define(version: 2024_11_02_190659) do create_table "bikes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.integer "identifier" t.integer "current_station_id" @@ -29,6 +29,11 @@ t.datetime "updated_at", null: false end + create_table "directories", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "stations", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.integer "identifier" t.string "name" diff --git a/test/fixtures/directories.yml b/test/fixtures/directories.yml new file mode 100644 index 000000000..d7a332924 --- /dev/null +++ b/test/fixtures/directories.yml @@ -0,0 +1,11 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the "{}" from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/models/directory_test.rb b/test/models/directory_test.rb new file mode 100644 index 000000000..394f4df63 --- /dev/null +++ b/test/models/directory_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class DirectoryTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 5e6ed11b7d13d483a7ba416527a9a1f1adaa9974 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Sat, 2 Nov 2024 15:12:00 -0400 Subject: [PATCH 16/83] Changed directory db name --- db/migrate/20241102190659_create_directories.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20241102190659_create_directories.rb b/db/migrate/20241102190659_create_directories.rb index 6e51b0610..eb9323351 100644 --- a/db/migrate/20241102190659_create_directories.rb +++ b/db/migrate/20241102190659_create_directories.rb @@ -1,6 +1,6 @@ -class CreateDirectories < ActiveRecord::Migration[7.0] +class CreateDirectors < ActiveRecord::Migration[7.0] def change - create_table :directories do |t| + create_table :directors do |t| t.timestamps end From 78d4f8eff3e31e50d239554249c9a9d7bb1a3d2e Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Sat, 2 Nov 2024 15:14:52 -0400 Subject: [PATCH 17/83] updated the nameof file for directory db --- db/migrate/20241102190659_create_directors.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 db/migrate/20241102190659_create_directors.rb diff --git a/db/migrate/20241102190659_create_directors.rb b/db/migrate/20241102190659_create_directors.rb new file mode 100644 index 000000000..eb9323351 --- /dev/null +++ b/db/migrate/20241102190659_create_directors.rb @@ -0,0 +1,8 @@ +class CreateDirectors < ActiveRecord::Migration[7.0] + def change + create_table :directors do |t| + + t.timestamps + end + end +end From d5152ee02ae13f436c8774dab04969d6e696cd33 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Sat, 2 Nov 2024 15:20:10 -0400 Subject: [PATCH 18/83] Updated name for contoller to director --- app/models/director.rb | 2 ++ app/models/directory.rb | 2 -- db/migrate/20241102190659_create_directories.rb | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-) create mode 100644 app/models/director.rb delete mode 100644 app/models/directory.rb delete mode 100644 db/migrate/20241102190659_create_directories.rb diff --git a/app/models/director.rb b/app/models/director.rb new file mode 100644 index 000000000..36af2491c --- /dev/null +++ b/app/models/director.rb @@ -0,0 +1,2 @@ +class Director < ApplicationRecord +end diff --git a/app/models/directory.rb b/app/models/directory.rb deleted file mode 100644 index 8273cd5c2..000000000 --- a/app/models/directory.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Directory < ApplicationRecord -end diff --git a/db/migrate/20241102190659_create_directories.rb b/db/migrate/20241102190659_create_directories.rb deleted file mode 100644 index eb9323351..000000000 --- a/db/migrate/20241102190659_create_directories.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateDirectors < ActiveRecord::Migration[7.0] - def change - create_table :directors do |t| - - t.timestamps - end - end -end From 9d0e616159cd189705b2b24a5cd2e82762ada3b3 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sat, 2 Nov 2024 15:21:31 -0400 Subject: [PATCH 19/83] Changed model name to Director --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 0ae4f13c4..7621a6019 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -29,7 +29,7 @@ t.datetime "updated_at", null: false end - create_table "directories", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "directors", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false end From 36f18ddbc29f42fb18c04a70669e96799e5a5307 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sat, 2 Nov 2024 16:05:04 -0400 Subject: [PATCH 20/83] Continued Model changes, files that weren't added before. --- db/migrate/20241102194244_create_directors.rb | 8 ++++++++ test/fixtures/directors.yml | 11 +++++++++++ test/models/director_test.rb | 7 +++++++ 3 files changed, 26 insertions(+) create mode 100644 db/migrate/20241102194244_create_directors.rb create mode 100644 test/fixtures/directors.yml create mode 100644 test/models/director_test.rb diff --git a/db/migrate/20241102194244_create_directors.rb b/db/migrate/20241102194244_create_directors.rb new file mode 100644 index 000000000..eb9323351 --- /dev/null +++ b/db/migrate/20241102194244_create_directors.rb @@ -0,0 +1,8 @@ +class CreateDirectors < ActiveRecord::Migration[7.0] + def change + create_table :directors do |t| + + t.timestamps + end + end +end diff --git a/test/fixtures/directors.yml b/test/fixtures/directors.yml new file mode 100644 index 000000000..d7a332924 --- /dev/null +++ b/test/fixtures/directors.yml @@ -0,0 +1,11 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the "{}" from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/models/director_test.rb b/test/models/director_test.rb new file mode 100644 index 000000000..26462875c --- /dev/null +++ b/test/models/director_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class DirectorTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From ba40762f24b08eb58f9dc67b3c416355a5a19dd5 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sat, 2 Nov 2024 16:06:52 -0400 Subject: [PATCH 21/83] Deleted additional director migration file. --- db/migrate/20241102190659_create_directors.rb | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 db/migrate/20241102190659_create_directors.rb diff --git a/db/migrate/20241102190659_create_directors.rb b/db/migrate/20241102190659_create_directors.rb deleted file mode 100644 index eb9323351..000000000 --- a/db/migrate/20241102190659_create_directors.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateDirectors < ActiveRecord::Migration[7.0] - def change - create_table :directors do |t| - - t.timestamps - end - end -end From d635dcbf45fba05dcbbbcdad992c2915af204f0f Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Sat, 2 Nov 2024 16:19:40 -0400 Subject: [PATCH 22/83] changes to schema --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 7621a6019..4ac05efc7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_11_02_190659) do +ActiveRecord::Schema[7.0].define(version: 2024_11_02_194244) do create_table "bikes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.integer "identifier" t.integer "current_station_id" From 626288a5f01330388addc7d6a015a438d30c81ab Mon Sep 17 00:00:00 2001 From: mariaigartua Date: Fri, 1 Nov 2024 14:13:42 -0400 Subject: [PATCH 23/83] Added my name to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6af1b01fb..b4e81f297 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ValetBike Smith College CSC223: Software Engineering\ -Group Members: Maggie, Nafisa, Fernanda, Mackenzie +Group Members: Maggie, Nafisa, Fernanda, Mackenzie, Maria Starter App for ValetBike project From e9967de4e1b9fd4602fc678e79956367976bda84 Mon Sep 17 00:00:00 2001 From: mariaigartua Date: Sat, 2 Nov 2024 16:22:30 -0400 Subject: [PATCH 24/83] Added my name to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4e81f297..9981654ee 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ValetBike Smith College CSC223: Software Engineering\ -Group Members: Maggie, Nafisa, Fernanda, Mackenzie, Maria +Group Members: Maggie, Nafisa, Fernanda, Mackenzie, Maria Jose Starter App for ValetBike project From e2138eeae869dd389439e4d6a8d68c44f703b51c Mon Sep 17 00:00:00 2001 From: mariaigartua Date: Sat, 2 Nov 2024 16:49:49 -0400 Subject: [PATCH 25/83] Created Bike class and getters --- app/controllers/bike_controller.rb | 13 +++++++++++ app/helpers/bike_helper.rb | 2 ++ .../bike/get_battery_percentage.html.erb | 4 ++++ app/views/bike/get_bike_id.html.erb | 4 ++++ app/views/bike/get_station_id.html.erb | 4 ++++ app/views/bike/get_station_name.html.erb | 4 ++++ config/routes.rb | 4 ++++ exit | 8 +++++++ exit.pub | 1 + test/controllers/bike_controller_test.rb | 23 +++++++++++++++++++ 10 files changed, 67 insertions(+) create mode 100644 app/controllers/bike_controller.rb create mode 100644 app/helpers/bike_helper.rb create mode 100644 app/views/bike/get_battery_percentage.html.erb create mode 100644 app/views/bike/get_bike_id.html.erb create mode 100644 app/views/bike/get_station_id.html.erb create mode 100644 app/views/bike/get_station_name.html.erb create mode 100644 exit create mode 100644 exit.pub create mode 100644 test/controllers/bike_controller_test.rb diff --git a/app/controllers/bike_controller.rb b/app/controllers/bike_controller.rb new file mode 100644 index 000000000..75c9043b6 --- /dev/null +++ b/app/controllers/bike_controller.rb @@ -0,0 +1,13 @@ +class BikeController < ApplicationController + def get_bike_id + end + + def get_station_id + end + + def get_station_name + end + + def get_battery_percentage + end +end diff --git a/app/helpers/bike_helper.rb b/app/helpers/bike_helper.rb new file mode 100644 index 000000000..554085ae5 --- /dev/null +++ b/app/helpers/bike_helper.rb @@ -0,0 +1,2 @@ +module BikeHelper +end diff --git a/app/views/bike/get_battery_percentage.html.erb b/app/views/bike/get_battery_percentage.html.erb new file mode 100644 index 000000000..e378a7236 --- /dev/null +++ b/app/views/bike/get_battery_percentage.html.erb @@ -0,0 +1,4 @@ +
+

Bike#get_battery_percentage

+

Find me in app/views/bike/get_battery_percentage.html.erb

+
diff --git a/app/views/bike/get_bike_id.html.erb b/app/views/bike/get_bike_id.html.erb new file mode 100644 index 000000000..9fbcdb47a --- /dev/null +++ b/app/views/bike/get_bike_id.html.erb @@ -0,0 +1,4 @@ +
+

Bike#get_bike_id

+

Find me in app/views/bike/get_bike_id.html.erb

+
diff --git a/app/views/bike/get_station_id.html.erb b/app/views/bike/get_station_id.html.erb new file mode 100644 index 000000000..cae7ac057 --- /dev/null +++ b/app/views/bike/get_station_id.html.erb @@ -0,0 +1,4 @@ +
+

Bike#get_station_id

+

Find me in app/views/bike/get_station_id.html.erb

+
diff --git a/app/views/bike/get_station_name.html.erb b/app/views/bike/get_station_name.html.erb new file mode 100644 index 000000000..2c675de7b --- /dev/null +++ b/app/views/bike/get_station_name.html.erb @@ -0,0 +1,4 @@ +
+

Bike#get_station_name

+

Find me in app/views/bike/get_station_name.html.erb

+
diff --git a/config/routes.rb b/config/routes.rb index ed910cb08..bdf1454fd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,10 @@ get 'directors/login' get 'directors/register' get 'directors/verify_email' + get 'bike/get_bike_id' + get 'bike/get_station_id' + get 'bike/get_station_name' + get 'bike/get_battery_percentage' get 'users/verify_account' get 'users/delete_account' root to: "stations#index" diff --git a/exit b/exit new file mode 100644 index 000000000..44b3fb35d --- /dev/null +++ b/exit @@ -0,0 +1,8 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABA732zqj5 +c94ku9T0Z8fFb1AAAAGAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAINTYtnYrSbxf2ioi +yzD0Bq/wfF5Mscag5vRysmOP2f5XAAAAoDt8AMIH4UcbKaXtvMf17W3mBI4p8tgISpbRZZ +Ij3WruqB9gGDArTjRpsVP8N67OAAMIglkqZwr19ai0vbQJvwwK/RSWNQW8ATbWmD/xFsvu +YevSnKP0pWwqf6+HK4nLIsgBpExk1eTIcv+Dr4qn/E/RmtEQUTUy+nt9ME3bdb3GIpeVrS +Ag+UxuSg+yseL9pu46+brdHkCkcdboEkoAe78= +-----END OPENSSH PRIVATE KEY----- diff --git a/exit.pub b/exit.pub new file mode 100644 index 000000000..83bc53556 --- /dev/null +++ b/exit.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINTYtnYrSbxf2ioiyzD0Bq/wfF5Mscag5vRysmOP2f5X mariajoseigxrtux@gmail.com diff --git a/test/controllers/bike_controller_test.rb b/test/controllers/bike_controller_test.rb new file mode 100644 index 000000000..3d9ccd81d --- /dev/null +++ b/test/controllers/bike_controller_test.rb @@ -0,0 +1,23 @@ +require "test_helper" + +class BikeControllerTest < ActionDispatch::IntegrationTest + test "should get get_bike_id" do + get bike_get_bike_id_url + assert_response :success + end + + test "should get get_station_id" do + get bike_get_station_id_url + assert_response :success + end + + test "should get get_station_name" do + get bike_get_station_name_url + assert_response :success + end + + test "should get get_battery_percentage" do + get bike_get_battery_percentage_url + assert_response :success + end +end From f006613fedfdf88cdace08787b1b8164eefdb3a8 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sat, 2 Nov 2024 16:56:21 -0400 Subject: [PATCH 26/83] Deleted get_battery_percentage --- app/controllers/bike_controller.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/controllers/bike_controller.rb b/app/controllers/bike_controller.rb index 75c9043b6..e76591d53 100644 --- a/app/controllers/bike_controller.rb +++ b/app/controllers/bike_controller.rb @@ -7,7 +7,4 @@ def get_station_id def get_station_name end - - def get_battery_percentage - end end From b6b564feca207dec678563b99449a21f9b503dd7 Mon Sep 17 00:00:00 2001 From: mariaigartua Date: Sat, 2 Nov 2024 17:03:04 -0400 Subject: [PATCH 27/83] Updated Bike class and getters --- app/controllers/bike_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/bike_controller.rb b/app/controllers/bike_controller.rb index e76591d53..40f1ac5cb 100644 --- a/app/controllers/bike_controller.rb +++ b/app/controllers/bike_controller.rb @@ -1,10 +1,13 @@ class BikeController < ApplicationController def get_bike_id + self.bike_id end def get_station_id + self.station_id end def get_station_name + self.station end end From 9084d8a1720312e3b24bd174871afd9d9de4d0cf Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sat, 2 Nov 2024 14:26:07 -0400 Subject: [PATCH 28/83] Create controller for Director class with methods login, register, and verify_email. --- config/routes.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index bdf1454fd..7277dc1ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,6 +10,9 @@ get 'bike/get_station_id' get 'bike/get_station_name' get 'bike/get_battery_percentage' + get 'directors/login' + get 'directors/register' + get 'directors/verify_email' get 'users/verify_account' get 'users/delete_account' root to: "stations#index" From 1c88dd0328f2045ff651f219d5d0e8946e6ecf0b Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Sat, 2 Nov 2024 14:44:22 -0400 Subject: [PATCH 29/83] Created Customer database --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 4ac05efc7..b9def3929 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_11_02_194244) do +ActiveRecord::Schema[7.0].define(version: 2024_10_31_182235) do create_table "bikes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.integer "identifier" t.integer "current_station_id" From 39297f498d620a4b835d4eedca72c0abdd0e9e27 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Sun, 3 Nov 2024 10:35:30 -0500 Subject: [PATCH 30/83] Created draft for login method --- app/controllers/directors_controller.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index b275b9d13..1b438b8f7 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -1,5 +1,16 @@ class DirectorsController < ApplicationController - def login + def login(email:string, password:string) + if verify_email(email) + user = User.where(email:email) + if user.password == password + user.loginStatus = true + true + else + puts "Password is not correct" + false + else + puts "Email not registered" + false end def register From df5d78c15fd04fcd5821bffa1ddbf009c7afbf75 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sun, 3 Nov 2024 10:56:34 -0500 Subject: [PATCH 31/83] Edited verify_email function. --- app/controllers/directors_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index 1b438b8f7..aa6c7f059 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -19,5 +19,5 @@ def register def verify_email(email:string) #Checks Customer database and returns true if it exits otherwise false inDatabase = Customer.where(email: email).first != nil ? true : false - inDatabase end +end \ No newline at end of file From 0ef7e8bba59321ec6a541a9eceac61b82653ac3a Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sun, 3 Nov 2024 11:01:59 -0500 Subject: [PATCH 32/83] Deleted specification of parameters in functions --- app/controllers/directors_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index aa6c7f059..1b6305b6a 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -1,5 +1,5 @@ class DirectorsController < ApplicationController - def login(email:string, password:string) + def login (email, password) if verify_email(email) user = User.where(email:email) if user.password == password @@ -16,7 +16,7 @@ def login(email:string, password:string) def register end - def verify_email(email:string) + def verify_email(email) #Checks Customer database and returns true if it exits otherwise false inDatabase = Customer.where(email: email).first != nil ? true : false end From 6be5c5d7a9a83ea445f29ca7c4fd15ab4c2662eb Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sun, 3 Nov 2024 11:03:09 -0500 Subject: [PATCH 33/83] changed name of verify_email to email_in_database for readability --- app/controllers/directors_controller.rb | 4 ++-- .../{verify_email.html.erb => email_in_database.html.erb} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename app/views/directors/{verify_email.html.erb => email_in_database.html.erb} (100%) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index 1b6305b6a..f83ef631e 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -1,6 +1,6 @@ class DirectorsController < ApplicationController def login (email, password) - if verify_email(email) + if email_in_database(email) user = User.where(email:email) if user.password == password user.loginStatus = true @@ -16,7 +16,7 @@ def login (email, password) def register end - def verify_email(email) + def email_in_database(email) #Checks Customer database and returns true if it exits otherwise false inDatabase = Customer.where(email: email).first != nil ? true : false end diff --git a/app/views/directors/verify_email.html.erb b/app/views/directors/email_in_database.html.erb similarity index 100% rename from app/views/directors/verify_email.html.erb rename to app/views/directors/email_in_database.html.erb From 3644f05537c448c43300def9785fe2e89f5f1041 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sun, 3 Nov 2024 11:08:18 -0500 Subject: [PATCH 34/83] Created base for register method and added comments to login method --- app/controllers/directors_controller.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index f83ef631e..f71a4f567 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -13,11 +13,27 @@ def login (email, password) false end - def register + def register(firstName, lastName, email, password) + # Check if the email is in the database + if email_in_database(email) + puts "Customer already registered" + false + end + # Email is not already in database + else + # Create new Customer + # To do: Check validity of first name + # To do: Check validity of last name + # To do: Check validity of email + # To do: Check validity of password + Customer.create(firstName: firstName, lastName: lastName, email: email, password: password) + # Return true because the registration was successful + true + end end def email_in_database(email) - #Checks Customer database and returns true if it exits otherwise false + # Checks Customer database and returns true if it exits otherwise false inDatabase = Customer.where(email: email).first != nil ? true : false end end \ No newline at end of file From 425e51e4308ab91b869f60b4f559929815ab907e Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sun, 3 Nov 2024 11:08:27 -0500 Subject: [PATCH 35/83] Added comments to login --- app/controllers/directors_controller.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index f71a4f567..35aec1443 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -1,16 +1,23 @@ class DirectorsController < ApplicationController def login (email, password) + # Check if email is in database if email_in_database(email) - user = User.where(email:email) - if user.password == password - user.loginStatus = true + # Find Costumer with associated email + costumer = Customer.where(email:email) + # Check if the password matches + if costumer.password == password + # Set login status + costumer.loginStatus = true true + # If the password is incorrect else puts "Password is not correct" false - else - puts "Email not registered" - false + # Email is not in database + else + puts "Email not registered" + false + end end def register(firstName, lastName, email, password) From 98434ec5f7bb7116aa98d1cca7343047b83021f1 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Sat, 2 Nov 2024 14:26:07 -0400 Subject: [PATCH 36/83] Create controller for Director class with methods login, register, and verify_email. --- app/views/directors/verify_email.html.erb | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 app/views/directors/verify_email.html.erb diff --git a/app/views/directors/verify_email.html.erb b/app/views/directors/verify_email.html.erb new file mode 100644 index 000000000..affc874c6 --- /dev/null +++ b/app/views/directors/verify_email.html.erb @@ -0,0 +1,4 @@ +
+

Directors#verify_email

+

Find me in app/views/directors/verify_email.html.erb

+
From 4bd64c1a3bea387165b494491d4eb3be22a8a132 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Sat, 2 Nov 2024 14:44:22 -0400 Subject: [PATCH 37/83] Created Customer database --- config/routes.rb | 4 ++++ db/schema.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 7277dc1ee..6b1b69444 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,6 +10,10 @@ get 'bike/get_station_id' get 'bike/get_station_name' get 'bike/get_battery_percentage' + get 'customers/update_profile' + get 'customers/start_trip' + get 'customers/end_trip' + get 'customers/past_trip_calculations' get 'directors/login' get 'directors/register' get 'directors/verify_email' diff --git a/db/schema.rb b/db/schema.rb index b9def3929..046c104dc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_10_31_182235) do +ActiveRecord::Schema[7.0].define(version: 2024_11_02_184317) do create_table "bikes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.integer "identifier" t.integer "current_station_id" From 926d97eef58c9864e83b9ff0bb30c8ef11666b00 Mon Sep 17 00:00:00 2001 From: mariaigartua Date: Sat, 2 Nov 2024 16:49:49 -0400 Subject: [PATCH 38/83] Created Bike class and getters --- config/routes.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index 6b1b69444..ca22dcc64 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,6 +17,10 @@ get 'directors/login' get 'directors/register' get 'directors/verify_email' + get 'bike/get_bike_id' + get 'bike/get_station_id' + get 'bike/get_station_name' + get 'bike/get_battery_percentage' get 'users/verify_account' get 'users/delete_account' root to: "stations#index" From 9b157b09af0198952d5812105c379965a6ba836f Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Mon, 4 Nov 2024 17:06:34 -0500 Subject: [PATCH 39/83] Created new method to start homepage and changed the root website --- app/controllers/directors_controller.rb | 3 +++ app/views/directors/new.html.erb | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 app/views/directors/new.html.erb diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index 35aec1443..282564670 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -1,4 +1,7 @@ class DirectorsController < ApplicationController + + def new + end def login (email, password) # Check if email is in database if email_in_database(email) diff --git a/app/views/directors/new.html.erb b/app/views/directors/new.html.erb new file mode 100644 index 000000000..c76e8f381 --- /dev/null +++ b/app/views/directors/new.html.erb @@ -0,0 +1,2 @@ +
+

Welcome to ValetBike

From e5f05d9d11aff636e62f7c1d32ac43e59acd2b9b Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Mon, 4 Nov 2024 17:06:54 -0500 Subject: [PATCH 40/83] Update the website root path --- config/routes.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index ca22dcc64..10e0b758a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -23,5 +23,6 @@ get 'bike/get_battery_percentage' get 'users/verify_account' get 'users/delete_account' - root to: "stations#index" + #root to: "stations#index" + root to: "directors#new" end \ No newline at end of file From aeab05c86881004caee219d8e89c96af14a8ba14 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Mon, 4 Nov 2024 17:19:52 -0500 Subject: [PATCH 41/83] Commented out old methods and created a skeleton for loginpage --- app/controllers/directors_controller.rb | 84 ++++++++++++------------- app/views/directors/new.html.erb | 20 ++++++ 2 files changed, 62 insertions(+), 42 deletions(-) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index 282564670..7b464f5a3 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -2,48 +2,48 @@ class DirectorsController < ApplicationController def new end - def login (email, password) - # Check if email is in database - if email_in_database(email) - # Find Costumer with associated email - costumer = Customer.where(email:email) - # Check if the password matches - if costumer.password == password - # Set login status - costumer.loginStatus = true - true - # If the password is incorrect - else - puts "Password is not correct" - false - # Email is not in database - else - puts "Email not registered" - false - end - end + # def login (email, password) + # # Check if email is in database + # if email_in_database(email) + # # Find Costumer with associated email + # costumer = Customer.where(email:email) + # # Check if the password matches + # if costumer.password == password + # # Set login status + # costumer.loginStatus = true + # true + # # If the password is incorrect + # else + # puts "Password is not correct" + # false + # # Email is not in database + # else + # puts "Email not registered" + # false + # end + # end - def register(firstName, lastName, email, password) - # Check if the email is in the database - if email_in_database(email) - puts "Customer already registered" - false - end - # Email is not already in database - else - # Create new Customer - # To do: Check validity of first name - # To do: Check validity of last name - # To do: Check validity of email - # To do: Check validity of password - Customer.create(firstName: firstName, lastName: lastName, email: email, password: password) - # Return true because the registration was successful - true - end - end + # def register(firstName, lastName, email, password) + # # Check if the email is in the database + # if email_in_database(email) + # puts "Customer already registered" + # false + # end + # # Email is not already in database + # else + # # Create new Customer + # # To do: Check validity of first name + # # To do: Check validity of last name + # # To do: Check validity of email + # # To do: Check validity of password + # Customer.create(firstName: firstName, lastName: lastName, email: email, password: password) + # # Return true because the registration was successful + # true + # end + # end - def email_in_database(email) - # Checks Customer database and returns true if it exits otherwise false - inDatabase = Customer.where(email: email).first != nil ? true : false - end + # def email_in_database(email) + # # Checks Customer database and returns true if it exits otherwise false + # inDatabase = Customer.where(email: email).first != nil ? true : false + # end end \ No newline at end of file diff --git a/app/views/directors/new.html.erb b/app/views/directors/new.html.erb index c76e8f381..f8aedf839 100644 --- a/app/views/directors/new.html.erb +++ b/app/views/directors/new.html.erb @@ -1,2 +1,22 @@

Welcome to ValetBike

+ +

Testing Login

+<%= form_tag(directors_login_path) do %> + + + + + + + + + +
<%= label_tag(:userName) %><%= text_field_tag(:userName, params[:userName]) %>
<%= label_tag(:password) %><%= password_field_tag(:password) %>
+ +
+ <%= submit_tag("Log In") %> +
+ <%end%> +
+ From 815d5b5f02832724a92214154945e6ab99e36535 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Mon, 4 Nov 2024 17:28:40 -0500 Subject: [PATCH 42/83] updating email_in_database method --- app/controllers/directors_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index 7b464f5a3..db4327dd3 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -1,6 +1,10 @@ class DirectorsController < ApplicationController def new + end + + def email_in_database + end # def login (email, password) # # Check if email is in database From 0e5868b39093fc0db73dd5b356cc58f6c72568c2 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Mon, 4 Nov 2024 17:50:54 -0500 Subject: [PATCH 43/83] deleted email_in_database method --- app/controllers/directors_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index db4327dd3..41922cb44 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -3,9 +3,7 @@ class DirectorsController < ApplicationController def new end - def email_in_database - - end + # def login (email, password) # # Check if email is in database # if email_in_database(email) From f98124ea3d99858f9be1e42f24f5a93232db2c26 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 21:55:59 -0500 Subject: [PATCH 44/83] added validations to the Customer model --- app/models/customer.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/models/customer.rb b/app/models/customer.rb index 0b5277335..df618fc87 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -1,2 +1,16 @@ class Customer < ApplicationRecord + EMAIL_REGEX = /\A[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}\Z/i + + validates_presence_of :identifier, + :firstName, + :lastName, + :email, + :password + validates_uniqueness_of :identifier, + :email + validates :email, presence: true, + length: { maximum: 100 }, + uniqueness: true, + format: { with: EMAIL_REGEX }, + confirmation: true end From f1aaa1f99173efee22f715675e9dcd00656778d9 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 21:57:45 -0500 Subject: [PATCH 45/83] added comments to the validations --- app/models/customer.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/customer.rb b/app/models/customer.rb index df618fc87..68ab8d96a 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -1,13 +1,17 @@ class Customer < ApplicationRecord + # email format -- not tested yet EMAIL_REGEX = /\A[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}\Z/i + # ensures that the Customer has each of these data points validates_presence_of :identifier, :firstName, :lastName, :email, :password + # ensures that a customer cannot register if email already exists in database validates_uniqueness_of :identifier, :email + # ensures that the email is in the correct format -- not tested yet validates :email, presence: true, length: { maximum: 100 }, uniqueness: true, From b6be99204e604ff19715014efd13608672b7df50 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 21:59:33 -0500 Subject: [PATCH 46/83] added methods for registering a new Customer --- app/controllers/directors_controller.rb | 48 +++---------------------- 1 file changed, 4 insertions(+), 44 deletions(-) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index 41922cb44..680081365 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -1,51 +1,11 @@ class DirectorsController < ApplicationController + # the view for this action displays the form to register def new end + # this action intakes the parameters from the form to create a new Customer + def create + end - # def login (email, password) - # # Check if email is in database - # if email_in_database(email) - # # Find Costumer with associated email - # costumer = Customer.where(email:email) - # # Check if the password matches - # if costumer.password == password - # # Set login status - # costumer.loginStatus = true - # true - # # If the password is incorrect - # else - # puts "Password is not correct" - # false - # # Email is not in database - # else - # puts "Email not registered" - # false - # end - # end - - # def register(firstName, lastName, email, password) - # # Check if the email is in the database - # if email_in_database(email) - # puts "Customer already registered" - # false - # end - # # Email is not already in database - # else - # # Create new Customer - # # To do: Check validity of first name - # # To do: Check validity of last name - # # To do: Check validity of email - # # To do: Check validity of password - # Customer.create(firstName: firstName, lastName: lastName, email: email, password: password) - # # Return true because the registration was successful - # true - # end - # end - - # def email_in_database(email) - # # Checks Customer database and returns true if it exits otherwise false - # inDatabase = Customer.where(email: email).first != nil ? true : false - # end end \ No newline at end of file From d2ac81e1f6959e260e0e26ea3e8a851837386e67 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:04:05 -0500 Subject: [PATCH 47/83] crud-ified the customer controller, adding new and create methods for login, show for data display, and edit and update methods for editing customer, and destroy for deleting account --- app/controllers/customers_controller.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index f95b9c5d8..b9438f52e 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -1,5 +1,22 @@ class CustomersController < ApplicationController - def update_profile + # the view for this action displays the form to login + def new + end + + # processes the parameters of the login form to create a new Ccustomer + def create + end + + # displays Customer data + def show + end + + # the view for this action displays the form to edit Customer + def edit + end + + # processes the parameters of the edit form + def update end def start_trip From cedcf67975700274518fafbe5b1efc0c62816c96 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:04:24 -0500 Subject: [PATCH 48/83] added destroy action --- app/controllers/customers_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index b9438f52e..181979087 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -19,6 +19,10 @@ def edit def update end + # processes the deletion of account + def destroy + end + def start_trip end From f6660b0e9957d188104a5f4e387dc5f5bf597d98 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:07:47 -0500 Subject: [PATCH 49/83] added main action in directors controller and corresponding view --- app/controllers/directors_controller.rb | 6 +++++- app/views/directors/main.html.erb | 0 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 app/views/directors/main.html.erb diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index 680081365..34d0cab29 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -1,10 +1,14 @@ class DirectorsController < ApplicationController + # the view for this action is the main page + def main + end + # the view for this action displays the form to register def new end - # this action intakes the parameters from the form to create a new Customer + # intakes the parameters from the form to create a new Customer def create end diff --git a/app/views/directors/main.html.erb b/app/views/directors/main.html.erb new file mode 100644 index 000000000..e69de29bb From d8a24290b050fe331ec1a361a77ffd8a66931bb9 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:08:12 -0500 Subject: [PATCH 50/83] deleted repetitive routes in routes file and outdated actions --- config/routes.rb | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 10e0b758a..2d9d59490 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,28 +1,16 @@ Rails.application.routes.draw do - get 'customers/update_profile' get 'customers/start_trip' get 'customers/end_trip' get 'customers/past_trip_calculations' - get 'directors/login' - get 'directors/register' - get 'directors/verify_email' - get 'bike/get_bike_id' - get 'bike/get_station_id' - get 'bike/get_station_name' - get 'bike/get_battery_percentage' - get 'customers/update_profile' - get 'customers/start_trip' - get 'customers/end_trip' - get 'customers/past_trip_calculations' - get 'directors/login' - get 'directors/register' - get 'directors/verify_email' + get 'bike/get_bike_id' get 'bike/get_station_id' get 'bike/get_station_name' get 'bike/get_battery_percentage' + get 'users/verify_account' get 'users/delete_account' + #root to: "stations#index" root to: "directors#new" end \ No newline at end of file From 394962836442bdbd43d71670080c353216c9b048 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:09:17 -0500 Subject: [PATCH 51/83] deleted views for actions that have been deleted --- app/views/customers/update_profile.html.erb | 4 ---- app/views/directors/email_in_database.html.erb | 4 ---- app/views/directors/login.html.erb | 4 ---- app/views/directors/register.html.erb | 4 ---- app/views/directors/verify_email.html.erb | 4 ---- 5 files changed, 20 deletions(-) delete mode 100644 app/views/customers/update_profile.html.erb delete mode 100644 app/views/directors/email_in_database.html.erb delete mode 100644 app/views/directors/login.html.erb delete mode 100644 app/views/directors/register.html.erb delete mode 100644 app/views/directors/verify_email.html.erb diff --git a/app/views/customers/update_profile.html.erb b/app/views/customers/update_profile.html.erb deleted file mode 100644 index 4b279bcf1..000000000 --- a/app/views/customers/update_profile.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -
-

Customers#update_profile

-

Find me in app/views/customers/update_profile.html.erb

-
diff --git a/app/views/directors/email_in_database.html.erb b/app/views/directors/email_in_database.html.erb deleted file mode 100644 index affc874c6..000000000 --- a/app/views/directors/email_in_database.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -
-

Directors#verify_email

-

Find me in app/views/directors/verify_email.html.erb

-
diff --git a/app/views/directors/login.html.erb b/app/views/directors/login.html.erb deleted file mode 100644 index f5694ad98..000000000 --- a/app/views/directors/login.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -
-

Directors#login

-

Find me in app/views/directors/login.html.erb

-
diff --git a/app/views/directors/register.html.erb b/app/views/directors/register.html.erb deleted file mode 100644 index b28e30829..000000000 --- a/app/views/directors/register.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -
-

Directors#register

-

Find me in app/views/directors/register.html.erb

-
diff --git a/app/views/directors/verify_email.html.erb b/app/views/directors/verify_email.html.erb deleted file mode 100644 index affc874c6..000000000 --- a/app/views/directors/verify_email.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -
-

Directors#verify_email

-

Find me in app/views/directors/verify_email.html.erb

-
From 9748b935361be359deb1a738d2b9b5718322c1ce Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:10:44 -0500 Subject: [PATCH 52/83] filled in main view with welcome message, adjusted routes for that to be landing page --- app/views/directors/main.html.erb | 7 +++++++ config/routes.rb | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/views/directors/main.html.erb b/app/views/directors/main.html.erb index e69de29bb..bac37a679 100644 --- a/app/views/directors/main.html.erb +++ b/app/views/directors/main.html.erb @@ -0,0 +1,7 @@ +
+
+
+ Welcome to ValetBike, we are happy to help! +
+
+
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 2d9d59490..f8d5fb8e9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,7 +10,7 @@ get 'users/verify_account' get 'users/delete_account' - + #root to: "stations#index" - root to: "directors#new" + root to: "directors#main" end \ No newline at end of file From 9e6fd5c8d3e37d8a395c6adb8e98beee54b78f85 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:18:16 -0500 Subject: [PATCH 53/83] Created a View Page for new action for Customer class -- Login form --- app/views/customers/new.html.erb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/views/customers/new.html.erb diff --git a/app/views/customers/new.html.erb b/app/views/customers/new.html.erb new file mode 100644 index 000000000..75d455a2a --- /dev/null +++ b/app/views/customers/new.html.erb @@ -0,0 +1,22 @@ + +

Welcome to ValetBike

+ +

Testing Login

+<%= form_tag(customers_new_path) do %> + + + + + + + + + +
<%= label_tag(:userName) %><%= text_field_tag(:userName, params[:userName]) %>
<%= label_tag(:password) %><%= password_field_tag(:password) %>
+ +
+ <%= submit_tag("Log In") %> +
+ <%end%> + + From ed8d823b07b552691601d86d3112bfe86643435d Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:18:37 -0500 Subject: [PATCH 54/83] Edited new page in Directors class to be registration form --- app/views/directors/new.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/directors/new.html.erb b/app/views/directors/new.html.erb index f8aedf839..8dd0af25d 100644 --- a/app/views/directors/new.html.erb +++ b/app/views/directors/new.html.erb @@ -1,9 +1,9 @@

Welcome to ValetBike

-

Testing Login

-<%= form_tag(directors_login_path) do %> - +

Testing Registration

+<%= form_tag(directors_new_path) do %> +
@@ -15,7 +15,7 @@
<%= label_tag(:userName) %> <%= text_field_tag(:userName, params[:userName]) %>
- <%= submit_tag("Log In") %> + <%= submit_tag("Register") %>
<%end%> From c4ebd3d2c5887e284f8704e57ece62a4b5ec6e1e Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:19:18 -0500 Subject: [PATCH 55/83] Added links to registration and login form on Main page; added routes for these actions --- app/views/directors/main.html.erb | 2 ++ config/routes.rb | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/app/views/directors/main.html.erb b/app/views/directors/main.html.erb index bac37a679..2dcae29fd 100644 --- a/app/views/directors/main.html.erb +++ b/app/views/directors/main.html.erb @@ -4,4 +4,6 @@ Welcome to ValetBike, we are happy to help! +
  • <%= link_to("Register", "/directors/new") %>
  • +
  • <%= link_to("Login", "/customers/new") %>
  • \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f8d5fb8e9..ba4c8ba2d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,6 @@ Rails.application.routes.draw do + get 'customers/new' + post 'customers/create' get 'customers/start_trip' get 'customers/end_trip' get 'customers/past_trip_calculations' @@ -11,6 +13,9 @@ get 'users/verify_account' get 'users/delete_account' + get 'directors/new' + post 'directors/create' + #root to: "stations#index" root to: "directors#main" end \ No newline at end of file From 65ba38c0c7db12d7345de0511a8c6cb7184b5964 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:22:41 -0500 Subject: [PATCH 56/83] deleted verify_account and delete_account in Users class --- app/controllers/users_controller.rb | 18 ------------------ app/views/users/delete_account.html.erb | 4 ---- app/views/users/verify_account.html.erb | 4 ---- 3 files changed, 26 deletions(-) delete mode 100644 app/views/users/delete_account.html.erb delete mode 100644 app/views/users/verify_account.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 16a8df980..3e74dea87 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,20 +1,2 @@ class UsersController < ApplicationController - def verify_account(userName, password) - # if userName is not in database - if User.where(userName: userName).count == 0 - false - # userName is in database - else - # find user password associated - user = User.where(userName: userName)[0] - # if the password is not the same as the one in the database - if user.password != password - false - end - # if the userName is in the database and the password matches, then all good! - true - end - - def delete_account - end end diff --git a/app/views/users/delete_account.html.erb b/app/views/users/delete_account.html.erb deleted file mode 100644 index 24571509c..000000000 --- a/app/views/users/delete_account.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -
    -

    Users#delete_account

    -

    Find me in app/views/users/delete_account.html.erb

    -
    diff --git a/app/views/users/verify_account.html.erb b/app/views/users/verify_account.html.erb deleted file mode 100644 index 9c8869d6a..000000000 --- a/app/views/users/verify_account.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -
    -

    Users#verify_account

    -

    Find me in app/views/users/verify_account.html.erb

    -
    From 58f98f4bbf4f9c481974201d04574788ca035caa Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:22:49 -0500 Subject: [PATCH 57/83] added pseudocode for login method --- app/controllers/customers_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index 181979087..b44df110f 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -5,6 +5,13 @@ def new # processes the parameters of the login form to create a new Ccustomer def create + # user = User.create(pass in parameters) + # if user.valid? (uses validations) + # then set session[:user_id] = user.id + # send confirmation message + # re route to main page + # else + # send message that login was unsuccessful end # displays Customer data From 72e4e774f1c8bc82bf597858557f3285dd828b23 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Mon, 4 Nov 2024 22:24:51 -0500 Subject: [PATCH 58/83] corrected/added pseudocode for both login and register --- app/controllers/customers_controller.rb | 10 +++++----- app/controllers/directors_controller.rb | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index b44df110f..76ddfd21d 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -3,15 +3,15 @@ class CustomersController < ApplicationController def new end - # processes the parameters of the login form to create a new Ccustomer + # processes the parameters of the login form to set current Customer def create - # user = User.create(pass in parameters) - # if user.valid? (uses validations) + # user = User.find_by(username: params(:username)) + # if user password is correct # then set session[:user_id] = user.id # send confirmation message # re route to main page - # else - # send message that login was unsuccessful + # else, user password is incorrect + # send error message end # displays Customer data diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index 34d0cab29..2297c6beb 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -6,6 +6,13 @@ def main # the view for this action displays the form to register def new + # user = User.create(pass in parameters) + # if user.valid? (uses validations) + # then set session[:user_id] = user.id + # send confirmation message + # re route to main page + # else + # send message that registration was unsuccessful end # intakes the parameters from the form to create a new Customer From d7dfe9526313b585c116c3f84daa0286a3c2f479 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Tue, 5 Nov 2024 08:59:22 -0500 Subject: [PATCH 59/83] added first name, last name, email --- app/views/directors/new.html.erb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/views/directors/new.html.erb b/app/views/directors/new.html.erb index 8dd0af25d..be753da45 100644 --- a/app/views/directors/new.html.erb +++ b/app/views/directors/new.html.erb @@ -5,8 +5,16 @@ <%= form_tag(directors_new_path) do %> - - + + + + + + + + + + From dd368b32f6b00670577c20a2ae3a0d07d0eb151c Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Tue, 5 Nov 2024 08:59:54 -0500 Subject: [PATCH 60/83] changed username -> email --- app/views/customers/new.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/customers/new.html.erb b/app/views/customers/new.html.erb index 75d455a2a..6142d2a38 100644 --- a/app/views/customers/new.html.erb +++ b/app/views/customers/new.html.erb @@ -5,8 +5,8 @@ <%= form_tag(customers_new_path) do %>
    <%= label_tag(:userName) %><%= text_field_tag(:userName, params[:userName]) %><%= label_tag(:firstName) %><%= text_field_tag(:firstName, params[:firstName]) %>
    <%= label_tag(:lastName) %><%= text_field_tag(:lastName, params[:lastName]) %>
    <%= label_tag(:email) %><%= text_field_tag(:email, params[:email]) %>
    <%= label_tag(:password) %>
    - - + + From fba11c6884d5effe12918ac7921c607412e951fb Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Tue, 5 Nov 2024 16:06:17 -0500 Subject: [PATCH 61/83] Method that requires specific paramaters to protect customer attributes --- app/controllers/customers_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index 76ddfd21d..86ff1b846 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -38,4 +38,8 @@ def end_trip def past_trip_calculations end + + def customer_params + params.require(:customer).permit(:firstName, :lastNAme, :email, :password) + end end From 49755fcaa4c9e4d9ba0d0d29593dcc2bb86781e0 Mon Sep 17 00:00:00 2001 From: mariaigartua Date: Sat, 2 Nov 2024 16:49:49 -0400 Subject: [PATCH 62/83] Created Bike class and getters --- config/routes.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index ba4c8ba2d..ed9a9c32e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,7 +9,6 @@ get 'bike/get_station_id' get 'bike/get_station_name' get 'bike/get_battery_percentage' - get 'users/verify_account' get 'users/delete_account' From cca5f3b4809a836ec5f59dfc358ba488cc8c9023 Mon Sep 17 00:00:00 2001 From: mariaigartua Date: Tue, 5 Nov 2024 13:30:14 -0500 Subject: [PATCH 63/83] Created Card Class --- app/controllers/card_controller.rb | 13 ++++++++++++ app/helpers/card_helper.rb | 2 ++ app/models/card.rb | 24 +++++++++++++++++++++++ app/views/card/pay.html.erb | 4 ++++ app/views/card/remove_card.html.erb | 4 ++++ app/views/card/update_payment.html.erb | 4 ++++ app/views/card/verify_payment.html.erb | 4 ++++ db/migrate/20241103155138_create_cards.rb | 11 +++++++++++ test/controllers/card_controller_test.rb | 23 ++++++++++++++++++++++ test/fixtures/cards.yml | 11 +++++++++++ test/models/card_test.rb | 7 +++++++ touch | 0 12 files changed, 107 insertions(+) create mode 100644 app/controllers/card_controller.rb create mode 100644 app/helpers/card_helper.rb create mode 100644 app/models/card.rb create mode 100644 app/views/card/pay.html.erb create mode 100644 app/views/card/remove_card.html.erb create mode 100644 app/views/card/update_payment.html.erb create mode 100644 app/views/card/verify_payment.html.erb create mode 100644 db/migrate/20241103155138_create_cards.rb create mode 100644 test/controllers/card_controller_test.rb create mode 100644 test/fixtures/cards.yml create mode 100644 test/models/card_test.rb create mode 100644 touch diff --git a/app/controllers/card_controller.rb b/app/controllers/card_controller.rb new file mode 100644 index 000000000..9d4be57e6 --- /dev/null +++ b/app/controllers/card_controller.rb @@ -0,0 +1,13 @@ +class CardController < ApplicationController + def remove_card + end + + def update_payment + end + + def verify_payment + end + + def pay + end +end diff --git a/app/helpers/card_helper.rb b/app/helpers/card_helper.rb new file mode 100644 index 000000000..eea3771e4 --- /dev/null +++ b/app/helpers/card_helper.rb @@ -0,0 +1,2 @@ +module CardHelper +end diff --git a/app/models/card.rb b/app/models/card.rb new file mode 100644 index 000000000..6258cafcc --- /dev/null +++ b/app/models/card.rb @@ -0,0 +1,24 @@ +class Card < ApplicationRecord + # Example methods for the Card model + + # Remove the card instance + def remove_card + destroy + end + + # Verify the card + def verify + update(verified: true) + end + + # Process a payment + def pay(amount) + if card_balance >= amount + update(card_balance: card_balance - amount) + true + else + false + end + end + end + \ No newline at end of file diff --git a/app/views/card/pay.html.erb b/app/views/card/pay.html.erb new file mode 100644 index 000000000..ca5ea8e47 --- /dev/null +++ b/app/views/card/pay.html.erb @@ -0,0 +1,4 @@ +
    +

    Card#pay

    +

    Find me in app/views/card/pay.html.erb

    +
    diff --git a/app/views/card/remove_card.html.erb b/app/views/card/remove_card.html.erb new file mode 100644 index 000000000..01b65e3f8 --- /dev/null +++ b/app/views/card/remove_card.html.erb @@ -0,0 +1,4 @@ +
    +

    Card#remove_card

    +

    Find me in app/views/card/remove_card.html.erb

    +
    diff --git a/app/views/card/update_payment.html.erb b/app/views/card/update_payment.html.erb new file mode 100644 index 000000000..a41fecd85 --- /dev/null +++ b/app/views/card/update_payment.html.erb @@ -0,0 +1,4 @@ +
    +

    Card#update_payment

    +

    Find me in app/views/card/update_payment.html.erb

    +
    diff --git a/app/views/card/verify_payment.html.erb b/app/views/card/verify_payment.html.erb new file mode 100644 index 000000000..c67f04474 --- /dev/null +++ b/app/views/card/verify_payment.html.erb @@ -0,0 +1,4 @@ +
    +

    Card#verify_payment

    +

    Find me in app/views/card/verify_payment.html.erb

    +
    diff --git a/db/migrate/20241103155138_create_cards.rb b/db/migrate/20241103155138_create_cards.rb new file mode 100644 index 000000000..92e078316 --- /dev/null +++ b/db/migrate/20241103155138_create_cards.rb @@ -0,0 +1,11 @@ +class CreateCards < ActiveRecord::Migration[7.0] + def change + create_table :cards do |t| + t.string :card_information + t.boolean :verified + t.integer :card_balance + + t.timestamps + end + end +end diff --git a/test/controllers/card_controller_test.rb b/test/controllers/card_controller_test.rb new file mode 100644 index 000000000..946939464 --- /dev/null +++ b/test/controllers/card_controller_test.rb @@ -0,0 +1,23 @@ +require "test_helper" + +class CardControllerTest < ActionDispatch::IntegrationTest + test "should get remove_card" do + get card_remove_card_url + assert_response :success + end + + test "should get update_payment" do + get card_update_payment_url + assert_response :success + end + + test "should get verify_payment" do + get card_verify_payment_url + assert_response :success + end + + test "should get pay" do + get card_pay_url + assert_response :success + end +end diff --git a/test/fixtures/cards.yml b/test/fixtures/cards.yml new file mode 100644 index 000000000..0d7c84977 --- /dev/null +++ b/test/fixtures/cards.yml @@ -0,0 +1,11 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + card_information: MyString + verified: false + card_balance: 1 + +two: + card_information: MyString + verified: false + card_balance: 1 diff --git a/test/models/card_test.rb b/test/models/card_test.rb new file mode 100644 index 000000000..133d5b60a --- /dev/null +++ b/test/models/card_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class CardTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/touch b/touch new file mode 100644 index 000000000..e69de29bb From 1036eef18e04e0eb68d4726ed87cc62bd13aae08 Mon Sep 17 00:00:00 2001 From: mariaigartua Date: Tue, 5 Nov 2024 14:57:15 -0500 Subject: [PATCH 64/83] Created Card Class --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9981654ee..b4e81f297 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ValetBike Smith College CSC223: Software Engineering\ -Group Members: Maggie, Nafisa, Fernanda, Mackenzie, Maria Jose +Group Members: Maggie, Nafisa, Fernanda, Mackenzie, Maria Starter App for ValetBike project From 8460ab4cb3d43114c96f5c16505c4ee973502368 Mon Sep 17 00:00:00 2001 From: mariaigartua Date: Tue, 5 Nov 2024 15:04:14 -0500 Subject: [PATCH 65/83] Created Card Class --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4e81f297..195f8fa55 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ValetBike -Smith College CSC223: Software Engineering\ +Smith College CSC223: Software Engineering Group Members: Maggie, Nafisa, Fernanda, Mackenzie, Maria Starter App for ValetBike project From 5c9f9d52de0db52a649bb4f7f6638004ae142510 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Tue, 5 Nov 2024 16:46:23 -0500 Subject: [PATCH 66/83] Updated Director New View to inlcude passwords as a parameter --- app/views/directors/new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/directors/new.html.erb b/app/views/directors/new.html.erb index be753da45..61329a34e 100644 --- a/app/views/directors/new.html.erb +++ b/app/views/directors/new.html.erb @@ -18,7 +18,7 @@
    - +
    <%= label_tag(:userName) %><%= text_field_tag(:userName, params[:userName]) %><%= label_tag(:email) %><%= text_field_tag(:email, params[:email]) %>
    <%= label_tag(:password) %>
    <%= label_tag(:password) %><%= password_field_tag(:password) %><%= password_field_tag(:password, params[:password]) %>
    From 899c053574c82772c20e406a582f86abed2b4c11 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Tue, 5 Nov 2024 16:50:29 -0500 Subject: [PATCH 67/83] added card migration to my repository --- db/schema.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 046c104dc..2b7d75568 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_11_02_184317) do +ActiveRecord::Schema[7.0].define(version: 2024_11_03_155138) do create_table "bikes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.integer "identifier" t.integer "current_station_id" @@ -18,6 +18,14 @@ t.datetime "updated_at", null: false end + create_table "cards", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "card_information" + t.boolean "verified" + t.integer "card_balance" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "customers", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.string "firstName" t.string "lastName" From a1cf3e9a97fb0008a190a00bc73f8495fafc82fb Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Tue, 5 Nov 2024 17:31:31 -0500 Subject: [PATCH 68/83] added password as a parameter to use in controller for customer --- app/views/customers/new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/customers/new.html.erb b/app/views/customers/new.html.erb index 6142d2a38..cbe9b1e72 100644 --- a/app/views/customers/new.html.erb +++ b/app/views/customers/new.html.erb @@ -10,7 +10,7 @@ <%= label_tag(:password) %> - <%= password_field_tag(:password) %> + <%= password_field_tag(:password, params[:password]) %> From 956f75e202cfbdc92c34f125994cb072e9bf582b Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Tue, 5 Nov 2024 17:32:23 -0500 Subject: [PATCH 69/83] added customer create method to instantiate customer objects when they register --- app/controllers/customers_controller.rb | 8 +++++++- app/views/customers/create.html.erb | 4 ++++ config/routes.rb | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 app/views/customers/create.html.erb diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index 86ff1b846..50abd21f7 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -5,6 +5,12 @@ def new # processes the parameters of the login form to set current Customer def create + @customer = Customer.new(customer_params) + if @customer.save + puts "success" + else + puts "failure to create customer" + end # user = User.find_by(username: params(:username)) # if user password is correct # then set session[:user_id] = user.id @@ -40,6 +46,6 @@ def past_trip_calculations end def customer_params - params.require(:customer).permit(:firstName, :lastNAme, :email, :password) + params.require(:customer).permit(:firstName, :lastName, :email, :password) end end diff --git a/app/views/customers/create.html.erb b/app/views/customers/create.html.erb new file mode 100644 index 000000000..ce16ebce3 --- /dev/null +++ b/app/views/customers/create.html.erb @@ -0,0 +1,4 @@ + +

    You are now registered!

    +<%= puts @customer.firstName%> + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ed9a9c32e..fecd68567 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,6 +15,8 @@ get 'directors/new' post 'directors/create' + get 'customers/create' + #root to: "stations#index" root to: "directors#main" end \ No newline at end of file From b53a770a12f3affb7954917561e1c5bf9794ccf7 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Tue, 5 Nov 2024 17:33:41 -0500 Subject: [PATCH 70/83] had the register button display the view for the log in after they are added to the database --- app/views/directors/new.html.erb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/directors/new.html.erb b/app/views/directors/new.html.erb index 61329a34e..d4e646dec 100644 --- a/app/views/directors/new.html.erb +++ b/app/views/directors/new.html.erb @@ -22,9 +22,10 @@ -
    - <%= submit_tag("Register") %> -
    + #
    + # <%= submit_tag("Register") %> + #
    + <%= link_to("Register", "/customers/new") %> <%end%> From b30cb35b40fa96e9fc54199622ae5fc7ab7af7a2 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Tue, 5 Nov 2024 19:48:13 -0500 Subject: [PATCH 71/83] made a method to register user --- app/controllers/directors_controller.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index 2297c6beb..b5706c5c5 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -6,17 +6,19 @@ def main # the view for this action displays the form to register def new - # user = User.create(pass in parameters) - # if user.valid? (uses validations) - # then set session[:user_id] = user.id - # send confirmation message - # re route to main page - # else - # send message that registration was unsuccessful end # intakes the parameters from the form to create a new Customer def create + user = User.create(params[:customer]) + if user.valid? + session[:user_id] = user.id + # change to json messaging in the future + puts "Successful Registration" + redirect_to(action: 'main') + else + puts "Unsuccessful Registration" + end end - + end \ No newline at end of file From 92cf0d00ec8f03449c2e5ddf893c496126f19419 Mon Sep 17 00:00:00 2001 From: mneedham01 Date: Tue, 5 Nov 2024 19:48:25 -0500 Subject: [PATCH 72/83] changed routes --- app/views/directors/main.html.erb | 4 ++-- app/views/directors/new.html.erb | 2 +- config/routes.rb | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/directors/main.html.erb b/app/views/directors/main.html.erb index 2dcae29fd..201aa5b7a 100644 --- a/app/views/directors/main.html.erb +++ b/app/views/directors/main.html.erb @@ -4,6 +4,6 @@ Welcome to ValetBike, we are happy to help! -
  • <%= link_to("Register", "/directors/new") %>
  • -
  • <%= link_to("Login", "/customers/new") %>
  • +
  • <%= link_to("Register", "/register") %>
  • +
  • <%= link_to("Login", "/login") %>
  • \ No newline at end of file diff --git a/app/views/directors/new.html.erb b/app/views/directors/new.html.erb index d4e646dec..65dd3bc5a 100644 --- a/app/views/directors/new.html.erb +++ b/app/views/directors/new.html.erb @@ -2,7 +2,7 @@

    Welcome to ValetBike

    Testing Registration

    -<%= form_tag(directors_new_path) do %> +<%= form_tag(register_path) do %> diff --git a/config/routes.rb b/config/routes.rb index fecd68567..915fa0d6a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,6 @@ Rails.application.routes.draw do - get 'customers/new' - post 'customers/create' + get '/login', to:'customers#new' + post '/login', to:'customers#create' get 'customers/start_trip' get 'customers/end_trip' get 'customers/past_trip_calculations' @@ -12,8 +12,8 @@ get 'users/verify_account' get 'users/delete_account' - get 'directors/new' - post 'directors/create' + get '/register', to:'directors#new' + post '/register', to:'directors#create' get 'customers/create' From 49d73fe9d69ab2e52112b8e2f2cfce5258e98964 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 09:12:18 -0500 Subject: [PATCH 73/83] made login link go to the login form --- app/views/customers/new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/customers/new.html.erb b/app/views/customers/new.html.erb index cbe9b1e72..9331c4463 100644 --- a/app/views/customers/new.html.erb +++ b/app/views/customers/new.html.erb @@ -2,7 +2,7 @@

    Welcome to ValetBike

    Testing Login

    -<%= form_tag(customers_new_path) do %> +<%= form_tag(login_path) do %>
    <%= label_tag(:firstName) %>
    From b55af6ead7388821bb4d847ef270b3e1e4e11dda Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 09:12:55 -0500 Subject: [PATCH 74/83] Deleted a link_to from the register button to the customer/new path --- app/views/directors/new.html.erb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/directors/new.html.erb b/app/views/directors/new.html.erb index 65dd3bc5a..17bc287e9 100644 --- a/app/views/directors/new.html.erb +++ b/app/views/directors/new.html.erb @@ -22,10 +22,9 @@
    <%= label_tag(:email) %>
    - #
    - # <%= submit_tag("Register") %> - #
    - <%= link_to("Register", "/customers/new") %> +
    + <%= submit_tag("Register") %> +
    <%end%> From ebb3cc0f335a05c5eb1c1dfe51d130b5f824d5bf Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 09:21:22 -0500 Subject: [PATCH 75/83] added comments for understanding route.rb paths with get and post --- config/routes.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index 915fa0d6a..76ddd2876 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,7 +12,9 @@ get 'users/verify_account' get 'users/delete_account' + #send the register path to get the view of director new get '/register', to:'directors#new' + #send the register path to get the method director create post '/register', to:'directors#create' get 'customers/create' From d8c4acf688a28e95e00a502d76ba5e68090ba98e Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 09:37:22 -0500 Subject: [PATCH 76/83] added comments that specify where the get and post for login path direct to --- config/routes.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index 76ddd2876..447cbd766 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,7 @@ Rails.application.routes.draw do + #send the login path to get the view of the customer new get '/login', to:'customers#new' + #send the login path to get the customer create method post '/login', to:'customers#create' get 'customers/start_trip' get 'customers/end_trip' From f23bda645ef02b4027abb6e956200636a416f9fc Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 09:49:06 -0500 Subject: [PATCH 77/83] Created method login for controller --- app/controllers/directors_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/directors_controller.rb b/app/controllers/directors_controller.rb index b5706c5c5..41698247b 100644 --- a/app/controllers/directors_controller.rb +++ b/app/controllers/directors_controller.rb @@ -19,6 +19,9 @@ def create else puts "Unsuccessful Registration" end - end + end + + def login + end end \ No newline at end of file From 99c28feb3bb0f1deb7c6de7f7a99a060a4f576b3 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 09:50:17 -0500 Subject: [PATCH 78/83] created view for login in director class to display form that asked for user information --- app/views/directors/login.html.erb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 app/views/directors/login.html.erb diff --git a/app/views/directors/login.html.erb b/app/views/directors/login.html.erb new file mode 100644 index 000000000..2b0df7f65 --- /dev/null +++ b/app/views/directors/login.html.erb @@ -0,0 +1,21 @@ + +

    Welcome to ValetBike

    + +

    Testing Login

    +<%= form_tag(login_path) do %> + + + + + + + + + +
    <%= label_tag(:email) %><%= text_field_tag(:email, params[:email]) %>
    <%= label_tag(:password) %><%= password_field_tag(:password, params[:password]) %>
    + +
    + <%= submit_tag("Log In") %> +
    + <%end%> + \ No newline at end of file From 693956dccbb973ab60ccbc339142db5c7f9cfd0e Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 09:54:58 -0500 Subject: [PATCH 79/83] Updated the new view in customer class to serve as registration form --- app/views/customers/new.html.erb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/views/customers/new.html.erb b/app/views/customers/new.html.erb index 9331c4463..17bc287e9 100644 --- a/app/views/customers/new.html.erb +++ b/app/views/customers/new.html.erb @@ -1,13 +1,21 @@

    Welcome to ValetBike

    -

    Testing Login

    -<%= form_tag(login_path) do %> - +

    Testing Registration

    +<%= form_tag(register_path) do %> +
    + + + + + + + + @@ -15,7 +23,7 @@
    <%= label_tag(:firstName) %><%= text_field_tag(:firstName, params[:firstName]) %>
    <%= label_tag(:lastName) %><%= text_field_tag(:lastName, params[:lastName]) %>
    <%= label_tag(:email) %> <%= text_field_tag(:email, params[:email]) %>
    <%= label_tag(:password) %> <%= password_field_tag(:password, params[:password]) %>
    - <%= submit_tag("Log In") %> + <%= submit_tag("Register") %>
    <%end%> From 27b6de8f1698f56204658c33fd5b2bdd8fad9d58 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 09:55:41 -0500 Subject: [PATCH 80/83] updated register and login paths to correspond to proper views in customer or director class --- config/routes.rb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 447cbd766..65bb16e5e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,16 @@ Rails.application.routes.draw do #send the login path to get the view of the customer new - get '/login', to:'customers#new' + #get '/login', to:'customers#new' + + #instead send the login path to get the view of directors login + get '/login', to:'directors#login' + #send the login path to get the customer create method - post '/login', to:'customers#create' + #post '/login', to:'customers#create' + + #instead get the login path to get the customer show method + post '/login', to:'customers#show' + get 'customers/start_trip' get 'customers/end_trip' get 'customers/past_trip_calculations' @@ -14,10 +22,13 @@ get 'users/verify_account' get 'users/delete_account' - #send the register path to get the view of director new - get '/register', to:'directors#new' + #send the register path to get the view of customer new + get '/register', to:'customers#new' #send the register path to get the method director create - post '/register', to:'directors#create' + #post '/register', to:'directors#create' + + #instead get the register path to get the method customer create + post '/register', to:'customers#create' get 'customers/create' From 0a0f35d41ab45e8db390b327898c9ca054ba3485 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 10:03:38 -0500 Subject: [PATCH 81/83] Created method to get paramaters from user privately --- app/controllers/customers_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index 50abd21f7..cb93d48c7 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -45,7 +45,12 @@ def end_trip def past_trip_calculations end + private def customer_params - params.require(:customer).permit(:firstName, :lastName, :email, :password) + params.require(:customer).permit( + :firstName, + :lastName, + :email, + :password) end end From edf0ed57849f7567f36711ebd5b0933ea29f9b77 Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 10:10:36 -0500 Subject: [PATCH 82/83] Updated create method to display if user registration was successful --- app/controllers/customers_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index cb93d48c7..0716ec0fa 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -7,9 +7,9 @@ def new def create @customer = Customer.new(customer_params) if @customer.save - puts "success" + render('create') else - puts "failure to create customer" + render('new') end # user = User.find_by(username: params(:username)) # if user password is correct From dcd40f9923bfce654584013fd37cc2f312eaf2be Mon Sep 17 00:00:00 2001 From: Fernanda Altamirano Date: Thu, 7 Nov 2024 10:47:49 -0500 Subject: [PATCH 83/83] Changed html text to specify that the view is from the customer class --- app/views/customers/new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/customers/new.html.erb b/app/views/customers/new.html.erb index 17bc287e9..d93e026fe 100644 --- a/app/views/customers/new.html.erb +++ b/app/views/customers/new.html.erb @@ -1,7 +1,7 @@

    Welcome to ValetBike

    -

    Testing Registration

    +

    Testing Registration in Customer Class

    <%= form_tag(register_path) do %>