Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joop and Reed Turn-in #82

Open
wants to merge 100 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
5ffa45a
setup: complete
JoopStark Oct 9, 2023
0b671b3
add: routes
JoopStark Oct 9, 2023
abf0dc4
Merge pull request #8 from JoopStark/joop-landing
reedhillmar Oct 9, 2023
d6aa92a
setup: adds gems
reedhillmar Oct 9, 2023
6bef21a
setup: schema setup
reedhillmar Oct 10, 2023
667acf2
setup: more validations
reedhillmar Oct 10, 2023
7559de2
setup: viewing party validations
reedhillmar Oct 10, 2023
be95b30
test: adds model tests
reedhillmar Oct 10, 2023
028904b
Merge pull request #9 from JoopStark/reed_setup
JoopStark Oct 10, 2023
9444e4e
user views
JoopStark Oct 10, 2023
1eeef9f
Merge branch 'main' of github.com:JoopStark/viewing_party_lite_7 into…
JoopStark Oct 10, 2023
519a1aa
Merge pull request #10 from JoopStark/joop-landing
reedhillmar Oct 10, 2023
aa9d11e
feat tests: welcome index page; header, new user button, current user…
JoopStark Oct 10, 2023
f229692
Merge branch 'main' into joop-landing
JoopStark Oct 10, 2023
b3fd397
feat test: user show page has header, discover button, and table with…
JoopStark Oct 10, 2023
5e4387b
Merge branch 'main' of github.com:JoopStark/viewing_party_lite_7 into…
JoopStark Oct 10, 2023
d5166bb
Merge branch 'joop-landing' of github.com:JoopStark/viewing_party_lit…
JoopStark Oct 10, 2023
712a008
Merge pull request #11 from JoopStark/joop-landing
reedhillmar Oct 10, 2023
314bbc2
feat test bug fixes: changed buttons from post to get
JoopStark Oct 10, 2023
7f42d38
schema: add image_path column to viewing_parties
JoopStark Oct 10, 2023
7cc1e26
Merge pull request #22 from JoopStark/joop-landing
reedhillmar Oct 10, 2023
20b2c28
feat: adds discover page and the start of search form
reedhillmar Oct 10, 2023
b1f79c0
Merge pull request #23 from JoopStark/reed_discover
JoopStark Oct 11, 2023
c4472fc
feat: movies index controller, changed schema
JoopStark Oct 11, 2023
3666c3f
Merge pull request #24 from JoopStark/joop-spike
reedhillmar Oct 11, 2023
911998b
fix schema and test helper
JoopStark Oct 11, 2023
9bcc25e
Merge pull request #25 from JoopStark/joop-movies_index
reedhillmar Oct 11, 2023
9077e8a
gems and vcr setup
JoopStark Oct 11, 2023
0f6dc5d
test: adds test for basic page setup
reedhillmar Oct 11, 2023
8acfae3
Merge pull request #27 from JoopStark/movie_details
JoopStark Oct 11, 2023
17a279e
Merge branch 'main' into joop-movies_index
reedhillmar Oct 11, 2023
455cd75
Merge pull request #26 from JoopStark/joop-movies_index
reedhillmar Oct 11, 2023
66da57e
test: test code for create view party button
reedhillmar Oct 11, 2023
fadba91
feat: adds create viewing party button functionality to movie details…
reedhillmar Oct 11, 2023
04b4a0b
feat: adds movie details to the movie details page
reedhillmar Oct 11, 2023
95720c5
test: adds test code for runtime and genres in movie details spec
reedhillmar Oct 11, 2023
5d942fb
feat: adds functionality for vote average, runtime, and genres to mov…
reedhillmar Oct 11, 2023
78175e6
feat test: movie index can display top 20 and keyword search
JoopStark Oct 11, 2023
73657b9
feat: movie index can display top 20 and keyword search
JoopStark Oct 11, 2023
af37b20
test/feat: adds test and functionality for displaying the movie summa…
reedhillmar Oct 11, 2023
ed7bf7f
Merge pull request #28 from JoopStark/joop-movies_index
reedhillmar Oct 11, 2023
2881183
test/feat: adds test code and functionality for showing cast members …
reedhillmar Oct 11, 2023
91fdc15
test: test code for total number of reviews on the movie details page
reedhillmar Oct 12, 2023
7ddcfb8
feat: shows total reviews on the movie details page
reedhillmar Oct 12, 2023
5d7c4b4
test: adds test code for displaying reviews with their author and rat…
reedhillmar Oct 12, 2023
04e0513
feat: adds functionality to show a review, its author, and the review…
reedhillmar Oct 12, 2023
ecdd351
poros: movie
JoopStark Oct 12, 2023
bd7946b
feat test: User show
JoopStark Oct 12, 2023
ad48dcd
feat: User show
JoopStark Oct 12, 2023
5236dbb
refactor: users show
JoopStark Oct 12, 2023
0ebae72
Merge pull request #29 from JoopStark/movie_details
JoopStark Oct 12, 2023
296d0c2
Merge pull request #30 from JoopStark/joop-users_show
reedhillmar Oct 12, 2023
21040a7
feat: runtime in MovieSearch poro
JoopStark Oct 12, 2023
ac1f345
feat: party new
JoopStark Oct 12, 2023
4c66484
feat: Viewing party new, multiple select invites and date and time pa…
JoopStark Oct 12, 2023
5eef78f
feat test: New User with sad paths
JoopStark Oct 12, 2023
230c81e
Merge pull request #31 from JoopStark/joop-party_new
reedhillmar Oct 12, 2023
43cdb00
bug: remove bug spec naming caused error in vcr
JoopStark Oct 12, 2023
08171ef
Merge pull request #32 from JoopStark/joop-party_new_spec
reedhillmar Oct 12, 2023
fa6c9c2
refactor: adds movie service and facade, refactors show page to use
reedhillmar Oct 12, 2023
3950284
Merge pull request #33 from JoopStark/services
JoopStark Oct 13, 2023
776c5f7
test: sad path testing for viewing party new
JoopStark Oct 13, 2023
4c62446
Merge pull request #34 from JoopStark/joop-party_new
reedhillmar Oct 13, 2023
34a47bc
refactor: more facade and service refactoring for movies index
reedhillmar Oct 13, 2023
8a7dc6a
Merge pull request #35 from JoopStark/services
JoopStark Oct 13, 2023
ca7e447
refactor: add cast poro and update movie facade and show page to utilize
reedhillmar Oct 13, 2023
300e9ee
poros test: Movie exist and has attribures
JoopStark Oct 13, 2023
2a47dcd
poros: movie and views fix
JoopStark Oct 13, 2023
6405f59
refactor: reviews poro and update movies facade and show page to utilize
reedhillmar Oct 13, 2023
ffc6c8b
refactory remove bad poros
JoopStark Oct 13, 2023
2cd453b
fix: sad path created nil rounding problem with movie.vote average
JoopStark Oct 13, 2023
5011603
refactor: movie.vote_average
JoopStark Oct 13, 2023
aa9ae81
Merge pull request #37 from JoopStark/reed_poro
JoopStark Oct 13, 2023
292c1ec
Merge branch 'main' into joop-movie_poro
reedhillmar Oct 13, 2023
d06c12e
Merge pull request #36 from JoopStark/joop-movie_poro
reedhillmar Oct 13, 2023
3e19695
service test: Movie Service
JoopStark Oct 13, 2023
a1aa0d6
test: adds testing for POROs and fixes welcome index test
reedhillmar Oct 13, 2023
a094903
Merge pull request #38 from JoopStark/reed_tests
JoopStark Oct 13, 2023
4fd7179
create facade test
JoopStark Oct 13, 2023
b34778c
Merge branch 'main' of github.com:JoopStark/viewing_party_lite_7 into…
JoopStark Oct 13, 2023
3055a4a
service test: MoviesService
JoopStark Oct 13, 2023
48c6805
refactor: rubocoped facade spec
JoopStark Oct 13, 2023
47fa99e
fix: rubocop fixes
reedhillmar Oct 13, 2023
d097713
refactor: rubocoped specs: models, facade, services
JoopStark Oct 13, 2023
6499141
fix: rubocop pulled me over for double quotes and issued me a citation
reedhillmar Oct 13, 2023
02b1992
Merge pull request #39 from JoopStark/reed_rubocop
JoopStark Oct 13, 2023
7cce921
merge conflict fix, took incoming
JoopStark Oct 13, 2023
fed8234
cleeeeean
JoopStark Oct 13, 2023
54a46ee
Merge pull request #40 from JoopStark/joop-movie_poro
JoopStark Oct 13, 2023
1ec1b8d
refactored user show page
JoopStark Oct 13, 2023
faa1589
refactor/test/fix: small tweaks to cover bases for all user stories, …
reedhillmar Oct 13, 2023
27e3813
Merge pull request #41 from JoopStark/reed_rubocop
JoopStark Oct 13, 2023
a36d01f
Merge branch 'main' of github.com:JoopStark/viewing_party_lite_7 into…
JoopStark Oct 13, 2023
e97385e
Merge pull request #42 from JoopStark/joop-movie_poro
reedhillmar Oct 13, 2023
28efdb0
refactory: pagentry
JoopStark Oct 14, 2023
2df584f
Merge pull request #43 from JoopStark/joop-demo
reedhillmar Oct 14, 2023
de082f1
test feat: authentication
JoopStark Oct 24, 2023
ac2eec7
Merge pull request #44 from JoopStark/joop-authentication
JoopStark Oct 24, 2023
e845db8
removed pry
JoopStark Oct 24, 2023
22da37a
authorization
JoopStark Oct 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@

# Ignore master key for decrypting credentials and more.
/config/master.key
/config/application.yml
/coverage
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--require spec_helper
--format documentation
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"rubyLsp.enabledFeatures": {

"codeActions": true,
"diagnostics": true,
"documentHighlights": true,
"documentLink": true,
"documentSymbols": true,
"foldingRanges": true,
"formatting": true,
"hover": true,
"inlayHint": true,
"onTypeFormatting": true,
"selectionRanges": true,
"semanticHighlighting": true,
"completion": true,
"codeLens": true,
"definition": true,
"workspaceSymbol": true,
"references": true
}
}
12 changes: 10 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ gem "jbuilder"
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"
gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
Expand All @@ -47,10 +47,15 @@ gem "bootsnap", require: false

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"
gem "faraday"
gem "figaro"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "pry"
gem "rspec-rails"
gem "factory_bot_rails"
gem "faker"
end

group :development do
Expand All @@ -66,8 +71,11 @@ group :development do
end

group :test do
gem "rspec-rails"
gem "capybara"
gem "launchy"
gem "simplecov"
gem "shoulda-matchers"
gem "orderly"
gem "webmock"
gem "vcr"
end
44 changes: 44 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ GEM
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
base64 (0.1.1)
bcrypt (3.1.19)
bindex (0.8.1)
bootsnap (1.16.0)
msgpack (~> 1.2)
Expand All @@ -84,13 +86,30 @@ GEM
xpath (~> 3.2)
coderay (1.1.3)
concurrent-ruby (1.2.2)
crack (0.4.5)
rexml
crass (1.0.6)
date (3.3.3)
diff-lcs (1.5.0)
docile (1.4.0)
erubi (1.12.0)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
faker (3.2.1)
i18n (>= 1.8.11, < 2)
faraday (2.7.11)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
figaro (1.2.0)
thor (>= 0.14.0, < 2)
globalid (1.1.0)
activesupport (>= 5.0)
hashdiff (1.0.1)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
importmap-rails (1.2.1)
Expand Down Expand Up @@ -131,6 +150,9 @@ GEM
racc (~> 1.4)
nokogiri (1.15.2-x86_64-darwin)
racc (~> 1.4)
orderly (0.1.1)
capybara (>= 1.1)
rspec (>= 2.14)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
Expand Down Expand Up @@ -178,6 +200,10 @@ GEM
rake (13.0.6)
regexp_parser (2.8.1)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
Expand Down Expand Up @@ -213,6 +239,9 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
shoulda-matchers (5.3.0)
activesupport (>= 5.2.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -237,11 +266,16 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
vcr (6.2.0)
web-console (4.2.0)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webmock (3.19.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand All @@ -250,27 +284,37 @@ GEM
zeitwerk (2.6.8)

PLATFORMS
arm64-darwin-21
arm64-darwin-22
x86_64-darwin-21

DEPENDENCIES
bcrypt (~> 3.1.7)
bootsnap
capybara
factory_bot_rails
faker
faraday
figaro
importmap-rails
jbuilder
launchy
orderly
pg (~> 1.1)
pry
puma (~> 5.0)
rails (~> 7.0.4, >= 7.0.4.2)
rspec-rails
rubocop-rails
shoulda-matchers
simplecov
sprockets-rails
stimulus-rails
turbo-rails
tzinfo-data
vcr
web-console
webmock

RUBY VERSION
ruby 3.2.2p53
Expand Down
Binary file added app/.DS_Store
Binary file not shown.
12 changes: 12 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# frozen_string_literal: true

# app/controller/application_controller.rb
class ApplicationController < ActionController::Base
helper_method :current_user

def error_message(errors)
errors.full_messages.join(', ')
end

def current_user
@_current_user ||= User.find(session[:user_id]) if session[:user_id]
end
end
16 changes: 16 additions & 0 deletions app/controllers/movies_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

# app/controllers/movies_controller.rb
class MoviesController < ApplicationController
def index
@movies = if params[:q] == 'keyword'
MoviesFacade.new.movie_search(params[:search])
else
MoviesFacade.new.movie_discover
end
end

def show
@facade = MoviesFacade.new(params[:id])
end
end
64 changes: 64 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# frozen_string_literal: true

# Controllers users
class UsersController < ApplicationController
# before_action :require_user

def new; end

def create
user = user_params
user[:email] = user[:email].downcase
new_user= User.create(user)
if new_user.save
session[:user_id] = new_user.id
redirect_to user_path(new_user)
flash[:sucess] = "Welcome, #{new_user.email}"
else
redirect_to register_path
flash[:alert] = "Error: #{error_message(new_user.errors)}"
end
end

def show
require_user
@user = User.find(params[:id])
end

def discover
@user = User.find(params[:user_id])
end

def login
user = User.find_by(email: params[:email].downcase)
if user.authenticate(params[:password])
session[:user_id] = user.id
flash[:success] = "#{user.email} was successful"
redirect_to '/'
else
flash[:error] = "Sorry, your credentials are bad."
render :login_form
end
end

def login_form
end

def logout
reset_session
# session.delete(current_user.id)
# @_current_user = nil
flash[:notice] = "You have successfully logged out."
redirect_to '/'
end

private

def user_params
params.permit(:name, :email, :password, :password_confirmation)
end

def require_user
render file: "public/404.html" unless current_user
end
end
62 changes: 62 additions & 0 deletions app/controllers/viewing_parties_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# frozen_string_literal: false

# app/controllers/viewing_parties_controller.rb
class ViewingPartiesController < ApplicationController
def new
@movie = MoviesFacade.new(params[:movie_id]).movie
@users = User.where.not(id: params[:user_id])
end

def create
# require_user
@movie = MoviesFacade.new(params[:movie_id]).movie
party = ViewingParty.create(date_time: param_datetime_formatter,
movie_id: params[:movie_id],
duration: params[:duration])
if params[:duration].to_i < @movie.runtime
redirect_to "/users/#{:user_id}/movies/#{:movie_id}/viewing_parties/new"
flash[:alert] = 'Error: Duration must not be less than movie runtime'
elsif party.save
create_host_viewing_party(party)
create_invited_viewing_party(party)
redirect_to "/users/#{params[:user_id]}"
else
redirect_to "/users/#{:user_id}/movies/#{:movie_id}/viewing_parties/new"
flash[:alert] = "Error: #{error_message(party.errors)}"
end
end

private

def create_host_viewing_party(party)
UserViewingParty.create!(viewing_party: party, user_id: params[:user_id], host: true)
end

def create_invited_viewing_party(party)
unless params[:invites_id].nil?
params[:invites_id].each do |invite_id|
UserViewingParty.create!(viewing_party: party, user_id: invite_id)
end
end
end

# def viewing_params
# date_time: param_datetime_formatter,
# movie_id: params[:movie_id],
# duration: params[:duration]
# end

def param_datetime_formatter # "2023-04-27 14:54:09 UTC"
"" << params["date(1i)"] << "-" <<
params["date(2i)"] << "-" <<
params["date(3i)"] << " " <<
params["time(4i)"] << ":" <<
params["time(5i)"] << ":" <<
"00" << " " <<
"UTC"
end

def require_user
render file: "public/404.html" unless current_user
end
end
8 changes: 8 additions & 0 deletions app/controllers/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

# app/controllers/welcome_controller.rb
class WelcomeController < ApplicationController
def index
@users = User.all
end
end
Loading