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

Kevin Z & Miranda D #94

Open
wants to merge 95 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
677f5d0
Create pull_request_template.md
zkevkev Nov 27, 2023
5238c35
Create users migration
zkevkev Nov 27, 2023
ef3cde1
Merge branch 'main' of github.com:zkevkev/viewing_party_lite_7
zkevkev Nov 27, 2023
2ce1d47
feat/ landing page user story 1 complete
delaneymiranda1 Nov 28, 2023
c6b93b7
add user registration page testing
delaneymiranda1 Nov 28, 2023
6d4bbca
add registration controller
delaneymiranda1 Nov 28, 2023
32d5911
create a show action for user
delaneymiranda1 Nov 28, 2023
0ecd43a
add flash error for email
delaneymiranda1 Nov 28, 2023
ab8902d
fix test and users controller
delaneymiranda1 Nov 28, 2023
60d1871
complete user registration story 2
delaneymiranda1 Nov 28, 2023
9300df0
Write tests for users show page
zkevkev Nov 28, 2023
05c1666
Merge pull request #1 from zkevkev/feat/landing_page
zkevkev Nov 28, 2023
7456dad
Merge pull request #2 from zkevkev/feat/user_registration_page
zkevkev Nov 28, 2023
dc07b6b
Merge main into feat/user_dashboard_page
zkevkev Nov 28, 2023
a41c8bd
Update user show spec
zkevkev Nov 28, 2023
7fff47c
Merge branch 'main' of github.com:zkevkev/viewing_party_lite_7 into f…
zkevkev Nov 28, 2023
bc3bb3b
Update user model spec
zkevkev Nov 28, 2023
7ec3032
Begin implementation of user dashboard (tests bugged)
zkevkev Nov 28, 2023
72075ba
Update user show spec (discover link)
zkevkev Nov 28, 2023
2cf9e17
Debug user show spec
zkevkev Nov 28, 2023
c17d910
Add users discover index view
zkevkev Nov 28, 2023
724a708
Add experimental api connection (should be moved to results controller)
zkevkev Nov 29, 2023
d51b1c7
Write tests for user discover page functionality
zkevkev Nov 29, 2023
4c2645e
Functionalize user discover page
zkevkev Nov 29, 2023
789e46b
Add empty user discover results page
zkevkev Nov 29, 2023
441a04e
Modify user discover results controller for movie search functionality
zkevkev Nov 29, 2023
86f4f84
Merge pull request #3 from zkevkev/feat/user_dashboard_page
delaneymiranda1 Nov 29, 2023
90280c8
Complete shoulda-matchers setup in rails_helper
zkevkev Nov 29, 2023
0d1f048
Begin making poro for movies
zkevkev Nov 29, 2023
e403b60
Skip tests for results page
zkevkev Nov 29, 2023
d58239c
Modify tmdb api key to access token
zkevkev Nov 29, 2023
785d723
Create MoviesService for user discover results page
zkevkev Nov 29, 2023
78035cf
Attempt to implement moviesservice into results controller (bugged)
zkevkev Nov 29, 2023
6877893
Refactor results controller to not use service object (will refactor)
zkevkev Nov 29, 2023
290bff9
Functionalize results controller index action
zkevkev Nov 29, 2023
f12fc1a
Merge pull request #4 from zkevkev/feat/discover_movies_page
delaneymiranda1 Nov 29, 2023
504db1f
Refactor results controller to use movies_search service
zkevkev Nov 29, 2023
e64dd00
Begin writing movies result page and tests
zkevkev Nov 29, 2023
330a349
add test for limiting movie results to 20
delaneymiranda1 Nov 29, 2023
55aaa86
change test for 20 movies to avoid any possible issues with the selector
delaneymiranda1 Nov 29, 2023
d2a8cd9
Merge branch 'main' of github.com:zkevkev/viewing_party_lite_7 into f…
zkevkev Nov 29, 2023
2dac561
Modify credentials for tmdb api key
zkevkev Nov 29, 2023
cadbf1b
Add button back to discover page from results index
zkevkev Nov 29, 2023
46a6903
Add tests to results index spec
zkevkev Nov 29, 2023
07877c8
Merge pull request #5 from zkevkev/feat/movie_results_page
delaneymiranda1 Nov 29, 2023
da13e83
Refactor discover routing to use resource syntax, refactor global lin…
zkevkev Nov 29, 2023
90f6b3f
Refactor movies routing to use resources syntax
zkevkev Nov 29, 2023
cc77180
Move link to welcome page from all views into layouts/application
zkevkev Nov 29, 2023
b377f4b
Refactor top_movies in movies_search service to utilize helper methods
zkevkev Nov 29, 2023
70583a2
Write tests for movie poro
zkevkev Nov 29, 2023
66f36e4
Write incomplete test suite for movie_search service
zkevkev Nov 30, 2023
4f2911f
add testing for movies detail page
delaneymiranda1 Nov 30, 2023
a20adcf
Write tests for movies_search service
zkevkev Nov 30, 2023
11b0f8a
Add comments to movies_search service
zkevkev Nov 30, 2023
36191af
Delete unecessary view
zkevkev Nov 30, 2023
496d004
movies detail page almost complete, needs viewing party button
delaneymiranda1 Nov 30, 2023
58252ed
Merge pull request #6 from zkevkev/ref/general_refactor
delaneymiranda1 Nov 30, 2023
4d095b8
pulled changes into this branch before pushing
delaneymiranda1 Nov 30, 2023
7fc46e3
Generate migrations for parties and user_parties
zkevkev Nov 30, 2023
3fa33da
Write skeleton of test suite for new user movie party page
zkevkev Nov 30, 2023
9491595
Write incomplete tests for new user movie party page
zkevkev Nov 30, 2023
e25987d
Complete spec for new user movie party
zkevkev Nov 30, 2023
14cbebb
Add party and user_party models, validations, relationships, tests
zkevkev Nov 30, 2023
4ab8f3e
Write controller for parties new page
zkevkev Nov 30, 2023
743c495
fix failing tests and params errors
delaneymiranda1 Nov 30, 2023
33c544b
Begin writing new user movie party view
zkevkev Nov 30, 2023
c11da8c
Merge pull request #7 from zkevkev/feat/movies_details_page
zkevkev Nov 30, 2023
5c9a50f
Merge branch 'main' of github.com:zkevkev/viewing_party_lite_7 into f…
zkevkev Nov 30, 2023
3dda3d1
Add logic to new user movie party view
zkevkev Nov 30, 2023
1977ead
Complete parties controller create action
zkevkev Nov 30, 2023
b096e7f
Rename @user to @host in party create action
zkevkev Dec 1, 2023
bacf407
Debug parties new action
zkevkev Dec 1, 2023
5b4c569
Add comments
zkevkev Dec 1, 2023
dcb79c8
Chrange routing for parties and results to handrolled
zkevkev Dec 1, 2023
26f9aa8
Refactor tests to account for routing changes
zkevkev Dec 1, 2023
481ced6
Debug parties controller create action (handrolled routes)
zkevkev Dec 1, 2023
74d7c5b
Add parties list to user show view
zkevkev Dec 1, 2023
64a5f18
Refactor new user movie party view and tests
zkevkev Dec 1, 2023
3ecc6f9
Refactor new user movie party tests
zkevkev Dec 1, 2023
5ad20e5
Refactor MoviesSearchService #top_movies to use movie_search_facade
zkevkev Dec 1, 2023
32155a3
Write tests for movies_search_facade
zkevkev Dec 1, 2023
dea982b
Merge pull request #8 from zkevkev/feat/new_viewing_party
delaneymiranda1 Dec 1, 2023
9db4254
Refactor Movie poro testing
zkevkev Dec 1, 2023
8f67b5f
Begin implementing facades for all services
zkevkev Dec 1, 2023
d1612ed
Begin implementing webmock stubs in all relevant spec files
zkevkev Dec 1, 2023
b7b19fb
parties controller create refactor
delaneymiranda1 Dec 1, 2023
56a7474
Add tests for movie_search_service methods
zkevkev Dec 1, 2023
78bc959
add webmock to discover results show and index
delaneymiranda1 Dec 1, 2023
b51d33b
Add movie_search_service to results controller
zkevkev Dec 1, 2023
a6a4427
add webmock to discover index
delaneymiranda1 Dec 1, 2023
aa365b3
Merge branch 'ref/general_refactor' of github.com:zkevkev/viewing_par…
delaneymiranda1 Dec 1, 2023
08c3a2d
Debug link to results show page
zkevkev Dec 2, 2023
75dab02
add model testing for party
delaneymiranda1 Dec 2, 2023
b3ce755
Merge branch 'ref/general_refactor' of github.com:zkevkev/viewing_par…
delaneymiranda1 Dec 2, 2023
9ff6a32
Merge pull request #9 from zkevkev/ref/general_refactor
zkevkev Dec 2, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@

# Ignore master key for decrypting credentials and more.
/config/master.key
/coverage
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
7 changes: 6 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@ 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'

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

group :development do
Expand All @@ -62,12 +66,13 @@ group :development do

# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
gem "rubocop-rails"
end

group :test do
gem "webmock"
gem "rspec-rails"
gem "capybara"
gem "launchy"
gem "simplecov"
gem "webmock"
end
54 changes: 25 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ GEM
tzinfo (~> 2.0)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
base64 (0.2.0)
bindex (0.8.1)
bootsnap (1.16.0)
msgpack (~> 1.2)
Expand All @@ -84,13 +84,21 @@ 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)
faraday (2.7.12)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.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 All @@ -99,8 +107,6 @@ GEM
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.6.3)
language_server-protocol (3.17.0.3)
launchy (2.5.2)
addressable (~> 2.8)
loofah (2.21.3)
Expand Down Expand Up @@ -131,10 +137,6 @@ GEM
racc (~> 1.4)
nokogiri (1.15.2-x86_64-darwin)
racc (~> 1.4)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
pg (1.5.3)
pry (0.14.2)
coderay (~> 1.1)
Expand Down Expand Up @@ -174,10 +176,13 @@ GEM
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.8.1)
rexml (3.2.5)
rexml (3.2.6)
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 All @@ -195,24 +200,9 @@ GEM
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
rubocop (1.54.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-rails (2.20.2)
activesupport (>= 4.2.0)
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 @@ -236,12 +226,15 @@ GEM
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
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 @@ -256,21 +249,24 @@ PLATFORMS
DEPENDENCIES
bootsnap
capybara
faraday
importmap-rails
jbuilder
launchy
pg (~> 1.1)
pry
puma (~> 5.0)
rails (~> 7.0.4, >= 7.0.4.2)
rspec
rspec-rails
rubocop-rails
shoulda-matchers
simplecov
sprockets-rails
stimulus-rails
turbo-rails
tzinfo-data
web-console
webmock

RUBY VERSION
ruby 3.2.2p53
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
class ApplicationController < ActionController::Base
add_flash_types :alert

private

def error_message(errors)
errors.full_messages.join(', ')
end
end
22 changes: 22 additions & 0 deletions app/controllers/registration_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class RegistrationController < ApplicationController
def new
@user = User.new
end

def create
@user = User.new(user_params)

if @user.save
redirect_to user_path(@user)
else
flash[:alert] = "**Email taken. Please enter a different email.**"
redirect_to register_path
end
end

private

def user_params
params.require(:user).permit(:name, :email)
end
end
34 changes: 34 additions & 0 deletions app/controllers/users/discover/results/parties_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require './services/movies_search_service'
class Users::Discover::Results::PartiesController < ApplicationController
def new
@all_users = User.all
@host = User.find(params[:user_id])
movies_search = MoviesSearchService.new
@movie = movies_search.genre_runtime(params[:id])
end

def create
host = User.find(params[:user_id])
movies_search = MoviesSearchService.new
movie = movies_search.genre_runtime(params[:id])
success, party = Party.create_with_checks(params, movie)
if success
user_party = UserParty.create!(user: host, party: party, host: true)
User.all.each do |user|
if user != host && params[user.name.to_s] == '1'
UserParty.create!(user: user, party: party, host: false)
end
end
redirect_to user_path(host)
else
redirect_to "/users/#{host.id}/movies/#{movie.movie_id}/parties/new"
flash[:alert] = 'invalid duration'
end
end

private

def party_params
params.require(:party).permit(:duration, :date, :start_time, :movie_id)
end
end
24 changes: 24 additions & 0 deletions app/controllers/users/discover/results_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require './poros/movie'
require './facades/movie_search_facade'
require './services/movies_search_service'
class Users::Discover::ResultsController < ApplicationController
def index
@user = User.find(params[:user_id])
movie_search = MovieSearchFacade.new
movies_search = MoviesSearchService.new
if params[:top_rated].present?
@top_rated = movie_search.top_rated_movies
elsif params[:title].present?
@search_result = movies_search.search_movies(params[:title])
end
end

def show
@user = User.find(params[:user_id])
movies_search = MoviesSearchService.new
@movie = movies_search.genre_runtime(params[:id])
@cast_members = movies_search.movie_cast(params[:id])
@reviews = movies_search.movie_reviews(params[:id])
@reviews_count = movies_search.movie_review_count(params[:id]) # had to add this bc i couldnt figure out how to pull from outside hash
end
end
5 changes: 5 additions & 0 deletions app/controllers/users/discover_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Users::DiscoverController < ApplicationController
def index
@user = User.find(params[:user_id])
end
end
11 changes: 11 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class UsersController < ApplicationController
def index
@users = User.all
end

def new; end

def show
@user = User.find(params[:id])
end
end
7 changes: 7 additions & 0 deletions app/controllers/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class WelcomeController < ApplicationController

def index
@users = User.all
end

end
22 changes: 22 additions & 0 deletions app/models/party.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class Party < ApplicationRecord
has_many :user_parties
has_many :users, through: :user_parties

validates_presence_of :duration, :date, :start_time, :movie_id

def self.create_with_checks(params, movie)
party = Party.new({
duration: params[:duration],
date: params[:date],
start_time: params[:start_time],
movie_id: params[:movie_id]
})

if movie.runtime > party.duration
return false, party
end

party.save
[true, party]
end
end
7 changes: 7 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class User < ApplicationRecord
has_many :user_parties
has_many :parties, through: :user_parties

validates_presence_of :name, :email
validates_uniqueness_of :email
end
6 changes: 6 additions & 0 deletions app/models/user_party.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class UserParty < ApplicationRecord
belongs_to :user
belongs_to :party

validates_presence_of :host
end
4 changes: 4 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
</head>

<body>
<% flash.each do |type, message| %>
<p><%= message %></p>
<% end %>
<%= link_to 'Back to Welcome Page', root_path %><br>
<%= yield %>
</body>
</html>
21 changes: 21 additions & 0 deletions app/views/registration/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<h1> Registration Form </h1>

<% if flash[:alert] %>
<div class="alert alert-danger" style="color: red;">
<%= flash[:alert] %>
</div>
<% end %><br/><br/>

<%= form_with(model: @user, url: register_path, method: :post) do |f| %>
<div>
<%= f.label :name %>
<%= f.text_field :name %>
</div>
<div>
<%= f.label :email %>
<%= f.text_field :email %>
</div><br/>
<div>
<%= f.submit "Register" %>
</div>
<% end %>
11 changes: 11 additions & 0 deletions app/views/users/discover/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%= link_to "Back to Welcome Page", root_path %><br/>

<section><%= button_to 'Discover Top Rated Movies', user_movies_path(@user), method: :get, params: { top_rated: true }, data: { turbo: false }, local: true %><section>

<section id='search'>
<%= form_with url: user_movies_path(@user), method: :get, data: { turbo: false }, local: true do |form| %>
<%= form.label :title %>
<%= form.text_field :title %>
<%= form.submit 'Search by Movie Title' %>
<% end %>
<section>
15 changes: 15 additions & 0 deletions app/views/users/discover/results/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%= button_to 'Back to Discover Page', user_discover_index_path(@user), method: :get, data: { turbo: false }, local: true %><br>

<section>
<% if @top_rated.present? %>
<% @top_rated.take(20).each do |movie| %>
<%= link_to movie.title, "/users/#{@user.id}/movies/#{movie.movie_id}" %>
<p>Average Rating: <%= movie.vote_avg %></p>
<% end %>
<% elsif @search_result.present? %>
<% @search_result.take(20).each do |movie| %>
<%= link_to movie.title, "/users/#{@user.id}/movies/#{movie.movie_id}" %>
<p>Average Rating: <%= movie.vote_avg %></p>
<% end %>
<% end %>
</section>
Loading