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

Connor Richmond and Robert deLaguna #79

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9fd284e
feat: Database setup and Model creation
rjdelaguna Oct 9, 2023
b1b195b
Create pull_request_template.md
rjdelaguna Oct 9, 2023
25b4c67
Merge pull request #12 from rjdelaguna/setup
ConnorRichmond Oct 9, 2023
a8802bc
feat and test: User registrations page, and Model tests
rjdelaguna Oct 10, 2023
3b4fcb6
feat and test: User registration page and feature tests, model tests …
rjdelaguna Oct 10, 2023
863915b
gem: factory bot and faker setup
ConnorRichmond Oct 10, 2023
7ae4b67
User controllers and welcome page
ConnorRichmond Oct 10, 2023
44eac03
routes/home link on all pages
ConnorRichmond Oct 10, 2023
6f239ca
landing page testing/removed user models
ConnorRichmond Oct 10, 2023
3810492
Add coverage to ignore
rjdelaguna Oct 10, 2023
525adb3
Merge pull request #13 from rjdelaguna/4-user-registration-page
ConnorRichmond Oct 10, 2023
87809c2
Merge branch 'main' into landing_page
rjdelaguna Oct 10, 2023
ff9001c
Merge pull request #14 from rjdelaguna/landing_page
rjdelaguna Oct 10, 2023
462ee4d
Delete coverage directory
ConnorRichmond Oct 10, 2023
bd677ea
Merge pull request #15 from rjdelaguna/ConnorRichmond-patch-1
rjdelaguna Oct 10, 2023
b2ff964
commit to switch
rjdelaguna Oct 10, 2023
d986834
feat and test: Solo Spike
rjdelaguna Oct 11, 2023
da36f1c
feat: Viewing Party Page
rjdelaguna Oct 12, 2023
7c6a0ff
refactor: Hide API key
rjdelaguna Oct 12, 2023
68eb24a
Merge pull request #17 from rjdelaguna/11-new-viewing-party-page
ConnorRichmond Oct 12, 2023
2124014
test: refactored for all passing tests
rjdelaguna Oct 12, 2023
2bb855a
Merge pull request #18 from rjdelaguna/testing-refactor
ConnorRichmond Oct 13, 2023
f5636bb
update for flow
ConnorRichmond Oct 13, 2023
c4d79ae
DRY up code
ConnorRichmond Oct 13, 2023
54c518d
test refactor: brought coverage to 100%
rjdelaguna Oct 13, 2023
bc36a66
setup endpoints for service
ConnorRichmond Oct 13, 2023
7cd3b9a
Merge pull request #19 from rjdelaguna/testing-refactor
ConnorRichmond Oct 13, 2023
2536096
Merge branch 'main' of github.com:rjdelaguna/viewing_party_lite_7 int…
ConnorRichmond Oct 13, 2023
13f546d
comment out
ConnorRichmond Oct 13, 2023
0eb01c1
update endpoints to be in service
ConnorRichmond Oct 13, 2023
b2c3d05
update tests to be passing
ConnorRichmond Oct 13, 2023
c248764
Merge pull request #20 from rjdelaguna/refactors
rjdelaguna Oct 13, 2023
5dca760
run rubocop autocorrector
ConnorRichmond Oct 13, 2023
1367d60
change search text to clean when imputing
ConnorRichmond Oct 13, 2023
bf5a152
update button for clarity.
ConnorRichmond Oct 13, 2023
25f2cea
display user email in index/ catch for no movies
ConnorRichmond Oct 13, 2023
f2b0f28
add users to seeds
ConnorRichmond Oct 13, 2023
790901a
SAD path testing for viewing party
ConnorRichmond Oct 13, 2023
3c3bfb8
Merge pull request #21 from rjdelaguna/refactors
rjdelaguna Oct 13, 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
32 changes: 32 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Neccesary checkmarks:

- [ ] All Tests are Passing
- [ ] The code will run locally

Type of change

- [ ] New feature
- [ ] Bug Fix

Implements/Fixes:

description closes #

Check the correct boxes

- [ ] This broke nothing
- [ ] This broke some stuff
- [ ] This broke everything

Testing Changes

- [ ] No Tests have been changed
- [ ] Some Tests have been changed
- [ ] All of the Tests have been changed(Please describe what in the world happened)

Checklist:

- [ ] My code has no unused/commented out code
- [ ] I have reviewed my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have fully tested my code
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

/coverage
# Ignore bundler config.
/.bundle

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
49 changes: 29 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,10 +39,10 @@ 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"
Expand All @@ -50,24 +52,31 @@ gem "bootsnap", require: false

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "pry"
gem 'factory_bot_rails'
gem 'faker'
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 'rspec-rails'
gem 'shoulda-matchers'
gem 'simplecov'
gem 'vcr'
gem 'webmock'
end

gem 'faraday'
31 changes: 31 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,28 @@ 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)
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 @@ -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,12 +274,16 @@ GEM
zeitwerk (2.6.8)

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

DEPENDENCIES
bootsnap
capybara
factory_bot_rails
faker
faraday
importmap-rails
jbuilder
launchy
Expand All @@ -265,12 +293,15 @@ DEPENDENCIES
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
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
*= require_tree .
*= require_self
*/
.search_field {
text-align: center;
opacity: 0.6;
}
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
3 changes: 3 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# frozen_string_literal: true

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

class MoviesController < ApplicationController
def index
@user = User.find(params[:user_id])
search_query = params[:search]

movies = if search_query.present?
MovieService.new.search_movies(search_query)
else
MovieService.new.top_rated_movies
end

@movies = movies[:results]
end

def show
@user = User.find(params[:user_id])
movie_id = params[:id]
movie = MovieService.new.movie_details(movie_id)
cast = MovieService.new.cast(movie_id)
reviews = MovieService.new.movie_reviews(movie_id)

@movie = Movie.new(movie)
@cast = cast[:cast].first(10)
@reviews = reviews[:results]
end
end
33 changes: 33 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

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

def new; end

def create
user = User.new(user_params)
if !user.save
flash.now[:alert] = if params.require(:user)[:name] == '' || params.require(:user)[:email] == ''
'Missing Inputs'
else
'Email already in use'
end
render :new
else
redirect_to user_path(user)
end
end

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

private

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

class ViewingPartyController < ApplicationController
def new
@host = User.find(params[:user_id])
@movie = Movie.movie
@users = User.where.not(id: params[:user_id])
end

def create
movie = Movie.movie
duration = params[:duration]
start_time = params[:start_time]
date = params[:when]

if duration.blank? || start_time.blank? || date.blank?
flash[:alert] = "Duration, Start Time, and Date are required fields"
redirect_to new_user_movie_viewing_party_path
return
end

party = ViewingParty.create!(
movie_id: movie.id,
movie_title: movie.title,
movie_image: movie.img,
duration: duration,
date: date,
start_time: start_time
)

host = User.find(params[:user_id])

if params[:guests].nil?
flash[:alert] = "Add guests to the party"
redirect_to new_user_movie_viewing_party_path
return
end

users = params[:guests].map do |guest|
User.find(guest)
end

UsersViewingParty.create!(user_id: host.id, viewing_party_id: party.id, hosting?: true)
users.each do |user|
UsersViewingParty.create!(user_id: user.id, viewing_party_id: party.id)
end

redirect_to user_path(host)
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