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

Eliza/Antoine - Viewing Party Lite - Pair Project #78

Open
wants to merge 135 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
6df1d4b
add pull request template
elizakeating Oct 9, 2023
ec45f7c
files: add gems
Antoine-Aube Oct 9, 2023
e756168
db: initial migrations
Antoine-Aube Oct 9, 2023
d81dad4
Merge pull request #12 from elizakeating/intial_set_up
elizakeating Oct 9, 2023
bb4529f
routes: landing page and new users
Antoine-Aube Oct 9, 2023
8a06720
routes: create new users path
Antoine-Aube Oct 9, 2023
322d2e7
models: generate model templates
Antoine-Aube Oct 9, 2023
cb1f111
controllers: generate templates for controllers
Antoine-Aube Oct 9, 2023
bf4863d
db: seeds
Antoine-Aube Oct 9, 2023
0d36d09
feature: home nav bar
Antoine-Aube Oct 10, 2023
95d25d0
feature: landing page - title, new user button, users with links
Antoine-Aube Oct 10, 2023
7fe0cb3
feature: new user form and flash messages in layouts/application.html…
Antoine-Aube Oct 10, 2023
6e8af84
models: validations/relationships - uniqueness of emails
Antoine-Aube Oct 10, 2023
9f6c718
controllers: welcome index and create new users
Antoine-Aube Oct 10, 2023
b0e4f12
test: user model validations and relationships
Antoine-Aube Oct 10, 2023
d453d5c
test: viewing party model validations and relationships
Antoine-Aube Oct 10, 2023
916bc5a
test:user_viewing_party relationships.
Antoine-Aube Oct 10, 2023
cfc1a39
test: new user form
Antoine-Aube Oct 10, 2023
0e19786
test: welcome page
Antoine-Aube Oct 10, 2023
575a5fc
docs: rails helper file adjust extra end for shoulda matchers
Antoine-Aube Oct 10, 2023
56ac856
docs: fix error by adding end in shoulda-matchers block
elizakeating Oct 10, 2023
db37038
test: add tests for model relationships
elizakeating Oct 10, 2023
41c8e9c
feat: add relationships to models
elizakeating Oct 10, 2023
987676a
test: add beginning tests for user dashboard story
elizakeating Oct 10, 2023
56561ac
feat: add dashboard route for user
elizakeating Oct 10, 2023
f73a887
feat: add users controller and show action
elizakeating Oct 10, 2023
b54edc3
feat: add user dashboard view
elizakeating Oct 10, 2023
89b2f04
fix: add 'spec' to the end of my model test files
Antoine-Aube Oct 10, 2023
7d53336
test: add test for discover movies story
elizakeating Oct 10, 2023
b4fee75
feat: add route to moves index for discover page
elizakeating Oct 10, 2023
7ceb08c
feat: change button to button_to instead of form
elizakeating Oct 10, 2023
ad0006d
feat: add movies controller and index action
elizakeating Oct 10, 2023
0599963
feat: add seeds to database
elizakeating Oct 10, 2023
97ffba1
refactor: remove save_and_open_page
elizakeating Oct 10, 2023
d0a3f7a
fix: change order of relationships in viewing party model
Antoine-Aube Oct 10, 2023
ebf8117
Merge pull request #13 from elizakeating/Landing_page_and_user_regist…
elizakeating Oct 10, 2023
86ba9df
Merge branch 'main' into user_dashboard_page_discover_button
elizakeating Oct 10, 2023
9d5118b
Merge pull request #14 from elizakeating/user_dashboard_page_discover…
Antoine-Aube Oct 10, 2023
3859724
test: add test for discover movies page user story
elizakeating Oct 11, 2023
a71c993
feat: add two buttons and a search field to movies discover page
elizakeating Oct 11, 2023
ad24e21
feat: add way to find user for discover page
elizakeating Oct 11, 2023
da3e60e
feat: add route to movies search page
elizakeating Oct 11, 2023
0ba5c37
feat: add view for movie search
elizakeating Oct 11, 2023
9fe1eb7
add webmock and vcr gems
elizakeating Oct 11, 2023
b248c5d
feat: gem setup and cassettes
elizakeating Oct 11, 2023
4a67c7b
test: add test for the top 20 rated movies search page user story
elizakeating Oct 11, 2023
971d4f1
feat: add api call to get results in search action, add show action
elizakeating Oct 11, 2023
e685f9d
refactor: removed @user in the controller and just used the params id…
elizakeating Oct 11, 2023
63716f8
feat: show action
elizakeating Oct 11, 2023
223f29b
feat: add section to display the movies on search page
elizakeating Oct 11, 2023
e7c9872
feat: add routes to movies show for details page
elizakeating Oct 11, 2023
4d0b60c
feat: add show view for movie details page
elizakeating Oct 11, 2023
887a9de
feat: add orderly gem, barbie movie search fixture
elizakeating Oct 11, 2023
9616c6c
test: add test for keyword search for movies, wrap other tests in vcr…
elizakeating Oct 11, 2023
eaa4dd6
test: wrap tests in vcr to prevent errors
elizakeating Oct 11, 2023
a120969
feat: add logic to show what the movie results are for
elizakeating Oct 11, 2023
9b71871
feat: add logic for the keyword api call
elizakeating Oct 11, 2023
7c0aab7
feat: fixture files for vcr
elizakeating Oct 11, 2023
0fd8919
feat: add viewing party header
elizakeating Oct 11, 2023
0b1f271
test: add test for movie results page
elizakeating Oct 11, 2023
f3b8086
feat: add top 20 and search feature to search page
elizakeating Oct 11, 2023
f95d2ab
test: add tests for movie details page
elizakeating Oct 11, 2023
6955781
feat: add route to new viewing party
elizakeating Oct 11, 2023
23e44ce
feat: add all movie information to movie show view
elizakeating Oct 11, 2023
eb5c55c
feat: add viewing parties controller and viewing party new view
elizakeating Oct 11, 2023
1912a9d
feat: add show action to movies controller
elizakeating Oct 11, 2023
e6a3ddf
fix: fix link not directing to the users dashboard
elizakeating Oct 11, 2023
ba4d38d
feat: encrypt api key
elizakeating Oct 11, 2023
a7de63d
Merge pull request #15 from elizakeating/api_user_stories
Antoine-Aube Oct 11, 2023
6f9dc1a
tests: poros tests
Antoine-Aube Oct 12, 2023
217c7b5
poro: review
Antoine-Aube Oct 12, 2023
bf5fc18
poro: movie
Antoine-Aube Oct 12, 2023
e06592f
poro: cast member
Antoine-Aube Oct 12, 2023
bafa5b0
docs: notes on movie attrributes
Antoine-Aube Oct 12, 2023
3ee8aa3
routes: create new viewing party
Antoine-Aube Oct 12, 2023
f6f9bca
refactor: show method refactored into facade/service pattern
Antoine-Aube Oct 12, 2023
6f00afb
controller: beginnings create methods for creating new viewing party
Antoine-Aube Oct 12, 2023
38d1d0b
refactor: movie facade
Antoine-Aube Oct 12, 2023
716e0de
refactor: services
Antoine-Aube Oct 12, 2023
b77a91e
refactor: facade/service refactor for movies/show
Antoine-Aube Oct 12, 2023
cd77852
feature: start of new viewing party form
Antoine-Aube Oct 12, 2023
bd5b7d8
routes: alias for create viewing party route
Antoine-Aube Oct 12, 2023
19ca0b7
tests: small refactors and vcr cassette rerecord
Antoine-Aube Oct 12, 2023
7bbde1a
Merge pull request #16 from elizakeating/antoine_viewing_party_page
elizakeating Oct 12, 2023
927307e
refactor: refactor movies search action to only include if logic and …
elizakeating Oct 13, 2023
4ff41e0
refactor: add top_20_movies and searched_movies methods in movie faca…
elizakeating Oct 13, 2023
8c93e60
refactor: add get_top_20_movies and get_searched_movies methods to mo…
elizakeating Oct 13, 2023
56a428b
refactor: update interactions with movie object to accoount for refac…
elizakeating Oct 13, 2023
266721d
refactor: change service method name to get_top_movies
elizakeating Oct 13, 2023
b8ec912
test: add test for movie service and generate fixture file
elizakeating Oct 13, 2023
4796556
test: add tests for movie facade, re-record fixtures
elizakeating Oct 13, 2023
12de53f
fix: update vote average in tests due to change in api
elizakeating Oct 13, 2023
cae1e05
test: add test for viewing party new page
elizakeating Oct 13, 2023
e8aa3bc
feat: finish new viewing party form
elizakeating Oct 13, 2023
db98178
feat: update create action in viewing parties controller
elizakeating Oct 13, 2023
9b30bf7
feat: add attributes to viewing party and user viewing party tables
elizakeating Oct 13, 2023
d32c502
rename directory
elizakeating Oct 13, 2023
6473123
fix: update barbie view count... again
elizakeating Oct 13, 2023
a0c3933
test: update user dashboard test to account for all the new aspects o…
elizakeating Oct 13, 2023
4cc9b4d
feat: update user show view to account for new stuff in user dashboar…
elizakeating Oct 13, 2023
db8c326
test: fix some vcr errors and cassettes
elizakeating Oct 13, 2023
3b39c7b
refactor: remove redundant ttitle in welcome page and center button
elizakeating Oct 13, 2023
4d08163
refactor: center link to home
elizakeating Oct 13, 2023
6d7f9d8
feat: stylsheet updates
elizakeating Oct 13, 2023
acd0acc
test: add viewing party model tests for find_movie and find_host
elizakeating Oct 13, 2023
0b9ad52
feat: add find_movie and find_host methods to viewing party model
elizakeating Oct 13, 2023
c070da1
test: add tests for convert_time and format_genres methods of movie poro
elizakeating Oct 13, 2023
7e8f771
feat: add conver_time and format_genres methods to movie poro, also a…
elizakeating Oct 13, 2023
a763b5c
feat: update runtime and genre sections to work with poro methods
elizakeating Oct 13, 2023
1b6902a
refactor: remove comments
elizakeating Oct 13, 2023
512a5af
test: fixtures
elizakeating Oct 13, 2023
6870394
refactor: making movie discover page look nicer
elizakeating Oct 13, 2023
bd56e4d
refactor: making pages looks better
elizakeating Oct 13, 2023
04ca89c
style: change flex justify
elizakeating Oct 13, 2023
2da771a
feat: add find_user, party_params, adjust create
elizakeating Oct 13, 2023
715e26f
feat: add parties_i_am_hosting and parties_i_am_invited_to methods to…
elizakeating Oct 13, 2023
5dcbd80
test: add tests for parties_i_am_hosting and parties_i_am_invited_to …
elizakeating Oct 13, 2023
0611bd5
feat: add party_guests method to viewing party model
elizakeating Oct 13, 2023
8a7d81e
feat: add two columns for hosting/invited, change out users for party…
elizakeating Oct 13, 2023
5fd1ab2
test: check for hosted/invited columns in test
elizakeating Oct 13, 2023
08bec2f
test: add validation, test for party_guests method
elizakeating Oct 13, 2023
cce5ff3
Merge pull request #17 from elizakeating/search_refactor_new_dashboard
Antoine-Aube Oct 13, 2023
310d745
fix typo
elizakeating Oct 13, 2023
adb3575
autocorrect rubocop offenses
Antoine-Aube Oct 13, 2023
109e5db
more rubocop autocorrection
Antoine-Aube Oct 13, 2023
f4b62fc
migration: add password authentication and migrate db
Antoine-Aube Oct 23, 2023
b082d4f
rerecord vcrs
Antoine-Aube Oct 23, 2023
395c5d4
fix: test instance variable to have password for users
Antoine-Aube Oct 24, 2023
96e1142
feaure: password added to create new user forms with passing test fixes
Antoine-Aube Oct 24, 2023
402ca8d
feature: login form with authentication
Antoine-Aube Oct 24, 2023
9382650
test: login happy path
Antoine-Aube Oct 24, 2023
892bb3d
test: sad path for bad credentials login
Antoine-Aube Oct 24, 2023
e12f6d7
Merge pull request #18 from Antoine-Aube/authentication_branch
Antoine-Aube Oct 24, 2023
a15c5e4
Revert "Authentication branch"
Antoine-Aube Oct 24, 2023
f8410c0
Merge pull request #19 from elizakeating/revert-18-authentication_branch
Antoine-Aube Oct 24, 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 @@ -6,6 +6,7 @@

# Ignore bundler config.
/.bundle
/coverage

# Ignore all logfiles and tempfiles.
/log/*
Expand Down
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
48 changes: 28 additions & 20 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
source "https://rubygems.org"
# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.2.2"
ruby '3.2.2'

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.4", ">= 7.0.4.2"
gem 'rails', '~> 7.0.4', '>= 7.0.4.2'

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"
gem 'sprockets-rails'

# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"
gem 'pg', '~> 1.1'

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"
gem 'puma', '~> 5.0'

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
gem 'importmap-rails'

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"
gem 'turbo-rails'

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"
gem 'stimulus-rails'

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
gem 'jbuilder'

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"
Expand All @@ -37,37 +39,43 @@ gem "jbuilder"
# 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 ]
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
gem 'bootsnap', require: false

# Use Sass to process CSS
# gem "sassc-rails"

# 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 'pry'
end

group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
gem 'web-console'

# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
# gem "rack-mini-profiler"

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

group :test do
gem "rspec-rails"
gem "capybara"
gem "launchy"
gem "simplecov"
end
gem 'capybara'
gem 'launchy'
gem 'orderly'
gem 'rspec-rails'
gem 'shoulda-matchers'
gem 'simplecov'
gem 'vcr'
gem 'webmock'
end
30 changes: 30 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ GEM
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
base64 (0.1.1)
bindex (0.8.1)
bootsnap (1.16.0)
msgpack (~> 1.2)
Expand All @@ -84,13 +85,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.11)
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 Down Expand Up @@ -131,6 +140,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 +190,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 +229,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 +256,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 +274,33 @@ GEM
zeitwerk (2.6.8)

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

DEPENDENCIES
bootsnap
capybara
faraday
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
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative "config/application"
require_relative 'config/application'

Rails.application.load_tasks
33 changes: 33 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,36 @@
*= require_tree .
*= require_self
*/

#viewing_parties {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}

.movie_section {
width: 500px;
padding: 5px;
margin: 10px;
outline-style: solid;
outline-color: grey;
outline-width: thick;
}

.movie-list {
display: flex;
align-items: center;
justify-content: center;
}

#average {
margin: 10px;
}

#summary {
width: 500px;
}

#reviews {
width: 700px;
}
2 changes: 2 additions & 0 deletions app/channels/application_cable/channel.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ApplicationCable
class Channel < ActionCable::Channel::Base
end
Expand Down
2 changes: 2 additions & 0 deletions app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ApplicationCable
class Connection < ActionCable::Connection::Base
end
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
end
25 changes: 25 additions & 0 deletions app/controllers/movies_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

class MoviesController < ApplicationController
def index; end

def search
@movies = if params[:q] == 'top20rated'
facade.top_20_movies
else
facade.searched_movies(params[:q])
end
end

def show
@movie = facade.movie
@cast_members = facade.cast_members
@reviews = facade.reviews
end

private

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

class UsersController < ApplicationController
def show
@user = User.find(params[:id])
end

def new; end

def create
user = User.new(user_params)
if user.save
redirect_to root_path
elsif !user.save
flash[:error] = 'User email already in use, please enter another email'
redirect_to '/register/new'
end
end

private

def user_params
params.permit(:name, :email)
end
end
46 changes: 46 additions & 0 deletions app/controllers/viewing_parties_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# frozen_string_literal: true

class ViewingPartiesController < ApplicationController
before_action :find_movie
before_action :find_user, only: %i[new create]

def new
@users = User.where('id != ?', params[:id])
end

def create
viewing_party = ViewingParty.new(party_params)

if viewing_party.duration < @movie.runtime
flash[:error] = 'Viewing party duration can not be less than the run time of the movie. Please try again.'
redirect_to "/users/#{params[:id]}/movies/#{@movie.id}/viewing_party/new"
else
viewing_party.save
UserViewingParty.create(user: @user, viewing_party:, host: true)

User.all.each do |user|
UserViewingParty.create(user:, viewing_party:, host: false) if params[user.name.to_s] == '1'
end

redirect_to "/users/#{params[:id]}"
end
end

private

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

def find_movie
@movie = facade.movie
end

def party_params
params.permit(:movie_id, :duration, :day, :view_time)
end

def facade
MovieFacade.new(params[:movie_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 @@
# frozen_string_literal: true

class WelcomeController < ApplicationController
def index
@users = User.all
end
end
Loading