├── .babelrc ├── .gitignore ├── .postcssrc.yml ├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── Procfile ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── api │ │ │ └── v1 │ │ │ │ ├── dashboards.coffee │ │ │ │ ├── executions.coffee │ │ │ │ ├── favorites.coffee │ │ │ │ ├── movies.coffee │ │ │ │ ├── recommendations.coffee │ │ │ │ ├── reviews.coffee │ │ │ │ ├── searches.coffee │ │ │ │ └── series.coffee │ │ ├── application.js │ │ ├── cable.js │ │ ├── channels │ │ │ └── .keep │ │ └── home.coffee │ └── stylesheets │ │ ├── api │ │ └── v1 │ │ │ ├── dashboards.scss │ │ │ ├── executions.scss │ │ │ ├── favorites.scss │ │ │ ├── movies.scss │ │ │ ├── recommendations.scss │ │ │ ├── reviews.scss │ │ │ ├── searches.scss │ │ │ └── series.scss │ │ ├── application.css │ │ └── home.scss ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── api │ │ └── v1 │ │ │ ├── dashboards_controller.rb │ │ │ ├── executions_controller.rb │ │ │ ├── favorites_controller.rb │ │ │ ├── movies_controller.rb │ │ │ ├── recommendations_controller.rb │ │ │ ├── reviews_controller.rb │ │ │ ├── searches_controller.rb │ │ │ └── series_controller.rb │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ └── home_controller.rb ├── helpers │ ├── api │ │ └── v1 │ │ │ ├── dashboards_helper.rb │ │ │ ├── executions_helper.rb │ │ │ ├── favorites_helper.rb │ │ │ ├── movies_helper.rb │ │ │ ├── recommendations_helper.rb │ │ │ ├── reviews_helper.rb │ │ │ ├── searches_helper.rb │ │ │ └── series_helper.rb │ ├── application_helper.rb │ └── home_helper.rb ├── javascript │ └── packs │ │ ├── api │ │ ├── http.js │ │ ├── index.js │ │ ├── player.js │ │ ├── review.js │ │ └── watchable.js │ │ ├── app.vue │ │ ├── application.js │ │ ├── assets │ │ └── logo.png │ │ ├── components │ │ ├── home │ │ │ ├── _details.vue │ │ │ ├── _featured.vue │ │ │ ├── _movie_list.vue │ │ │ ├── _movie_menu.vue │ │ │ ├── _reviews.vue │ │ │ └── index.vue │ │ ├── shared │ │ │ ├── footer.vue │ │ │ └── header.vue │ │ └── watch │ │ │ └── index.vue │ │ ├── routes.js │ │ └── store │ │ ├── index.js │ │ └── modules │ │ ├── movie_menu.js │ │ ├── player.js │ │ ├── review.js │ │ └── watchable.js ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── application_record.rb │ ├── category.rb │ ├── concerns │ │ ├── .keep │ │ └── highlightable.rb │ ├── favorite.rb │ ├── movie.rb │ ├── player.rb │ ├── review.rb │ ├── serie.rb │ └── user.rb ├── serializers │ └── api │ │ └── v1 │ │ ├── category_serializer.rb │ │ ├── movie_serializer.rb │ │ ├── player_serializer.rb │ │ ├── review_serializer.rb │ │ ├── serie_serializer.rb │ │ ├── user_serializer.rb │ │ └── watchable_serializer.rb ├── services │ └── dashboard_service.rb └── views │ ├── devise │ ├── registrations │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── sessions │ │ └── new.html.erb │ └── shared │ │ └── _links.html.erb │ ├── home │ └── index.html.erb │ └── layouts │ ├── application.html.erb │ ├── mailer.html.erb │ └── mailer.text.erb ├── bin ├── bundle ├── rails ├── rake ├── setup ├── spring ├── update ├── webpack ├── webpack-dev-server └── yarn ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── credentials.yml.enc ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── application_controller_renderer.rb │ ├── assets.rb │ ├── aws.rb │ ├── backtrace_silencers.rb │ ├── content_security_policy.rb │ ├── cookies_serializer.rb │ ├── devise.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── pg_search.rb │ └── wrap_parameters.rb ├── locales │ ├── devise.en.yml │ └── en.yml ├── puma.rb ├── routes.rb ├── spring.rb ├── storage.yml ├── webpack │ ├── development.js │ ├── environment.js │ ├── loaders │ │ └── vue.js │ ├── production.js │ └── test.js └── webpacker.yml ├── db ├── migrate │ ├── 20180519060421_devise_create_users.rb │ ├── 20180519172436_create_pg_search_documents.rb │ ├── 20180519173753_create_categories.rb │ ├── 20180519173754_create_reviews.rb │ ├── 20180519173755_create_favorites.rb │ ├── 20180519173756_create_series.rb │ ├── 20180519173757_create_movies.rb │ ├── 20180519173758_create_players.rb │ ├── 20180519173759_add_last_watched_episode_to_series.rb │ ├── 20180525024551_remove_elapsed_time_from_player.rb │ └── 20180525024605_add_elapsed_time_to_player.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── log └── .keep ├── package.json ├── public ├── 404.html ├── 422.html ├── 500.html ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── favicon.ico └── robots.txt ├── test ├── application_system_test_case.rb ├── controllers │ ├── .keep │ ├── api │ │ └── v1 │ │ │ ├── dashboards_controller_test.rb │ │ │ ├── executions_controller_test.rb │ │ │ ├── favorites_controller_test.rb │ │ │ ├── movies_controller_test.rb │ │ │ ├── recommendations_controller_test.rb │ │ │ ├── reviews_controller_test.rb │ │ │ ├── searches_controller_test.rb │ │ │ └── series_controller_test.rb │ └── home_controller_test.rb ├── fixtures │ ├── .keep │ ├── categories.yml │ ├── favorites.yml │ ├── files │ │ └── .keep │ ├── movies.yml │ ├── players.yml │ ├── reviews.yml │ ├── series.yml │ └── users.yml ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── category_test.rb │ ├── favorite_test.rb │ ├── movie_test.rb │ ├── player_test.rb │ ├── review_test.rb │ ├── serie_test.rb │ └── user_test.rb ├── system │ └── .keep └── test_helper.rb ├── tmp └── .keep ├── vendor └── .keep └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": "> 1%", 7 | "uglify": true 8 | }, 9 | "useBuiltIns": true 10 | }] 11 | ], 12 | 13 | "plugins": [ 14 | "syntax-dynamic-import", 15 | "transform-object-rest-spread", 16 | ["transform-class-properties", { "spec": true }] 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all logfiles and tempfiles. 11 | /log/* 12 | /tmp/* 13 | !/log/.keep 14 | !/tmp/.keep 15 | 16 | # Ignore uploaded files in development 17 | /storage/* 18 | 19 | /node_modules 20 | /yarn-error.log 21 | 22 | /public/assets 23 | .byebug_history 24 | 25 | # Ignore master key for decrypting credentials and more. 26 | /config/master.key 27 | /public/packs 28 | /public/packs-test 29 | /node_modules 30 | yarn-debug.log* 31 | .yarn-integrity 32 | -------------------------------------------------------------------------------- /.postcssrc.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | postcss-import: {} 3 | postcss-cssnext: {} 4 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.4.0 -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | ruby '2.4.0' 5 | gem 'aws-sdk-s3' 6 | gem 'webpacker' 7 | gem 'foreman' 8 | 9 | # Autenticação 10 | gem 'devise' 11 | # Serialização do Json 12 | gem 'fast_jsonapi', git: "https://github.com/Netflix/fast_jsonapi", branch: "dev" 13 | # Pesquisas dentro do Postgresql 14 | gem 'pg_search' 15 | 16 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 17 | gem 'rails', '~> 5.2.0' 18 | # Use postgresql as the database for Active Record 19 | gem 'pg', '>= 0.18', '< 2.0' 20 | # Use Puma as the app server 21 | gem 'puma', '~> 3.11' 22 | # Use SCSS for stylesheets 23 | gem 'sass-rails', '~> 5.0' 24 | # Use Uglifier as compressor for JavaScript assets 25 | gem 'uglifier', '>= 1.3.0' 26 | # See https://github.com/rails/execjs#readme for more supported runtimes 27 | # gem 'mini_racer', platforms: :ruby 28 | 29 | # Use CoffeeScript for .coffee assets and views 30 | gem 'coffee-rails', '~> 4.2' 31 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 32 | gem 'turbolinks', '~> 5' 33 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 34 | gem 'jbuilder', '~> 2.5' 35 | # Use Redis adapter to run Action Cable in production 36 | # gem 'redis', '~> 4.0' 37 | # Use ActiveModel has_secure_password 38 | # gem 'bcrypt', '~> 3.1.7' 39 | 40 | # Use ActiveStorage variant 41 | # gem 'mini_magick', '~> 4.8' 42 | 43 | # Use Capistrano for deployment 44 | # gem 'capistrano-rails', group: :development 45 | 46 | # Reduces boot times through caching; required in config/boot.rb 47 | gem 'bootsnap', '>= 1.1.0', require: false 48 | 49 | group :development, :test do 50 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 51 | gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 52 | end 53 | 54 | group :development do 55 | # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 56 | gem 'web-console', '>= 3.3.0' 57 | gem 'listen', '>= 3.0.5', '< 3.2' 58 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 59 | gem 'spring' 60 | gem 'spring-watcher-listen', '~> 2.0.0' 61 | end 62 | 63 | group :test do 64 | # Adds support for Capybara system testing and selenium driver 65 | gem 'capybara', '>= 2.15', '< 4.0' 66 | gem 'selenium-webdriver' 67 | # Easy installation and use of chromedriver to run system tests with Chrome 68 | gem 'chromedriver-helper' 69 | end 70 | 71 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 72 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 73 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: https://github.com/Netflix/fast_jsonapi 3 | revision: b090391551d65be0646468e4d604ee6eb365d8da 4 | branch: dev 5 | specs: 6 | fast_jsonapi (1.1.1) 7 | activesupport (>= 4.2) 8 | 9 | GEM 10 | remote: https://rubygems.org/ 11 | specs: 12 | actioncable (5.2.0) 13 | actionpack (= 5.2.0) 14 | nio4r (~> 2.0) 15 | websocket-driver (>= 0.6.1) 16 | actionmailer (5.2.0) 17 | actionpack (= 5.2.0) 18 | actionview (= 5.2.0) 19 | activejob (= 5.2.0) 20 | mail (~> 2.5, >= 2.5.4) 21 | rails-dom-testing (~> 2.0) 22 | actionpack (5.2.0) 23 | actionview (= 5.2.0) 24 | activesupport (= 5.2.0) 25 | rack (~> 2.0) 26 | rack-test (>= 0.6.3) 27 | rails-dom-testing (~> 2.0) 28 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 29 | actionview (5.2.0) 30 | activesupport (= 5.2.0) 31 | builder (~> 3.1) 32 | erubi (~> 1.4) 33 | rails-dom-testing (~> 2.0) 34 | rails-html-sanitizer (~> 1.0, >= 1.0.3) 35 | activejob (5.2.0) 36 | activesupport (= 5.2.0) 37 | globalid (>= 0.3.6) 38 | activemodel (5.2.0) 39 | activesupport (= 5.2.0) 40 | activerecord (5.2.0) 41 | activemodel (= 5.2.0) 42 | activesupport (= 5.2.0) 43 | arel (>= 9.0) 44 | activestorage (5.2.0) 45 | actionpack (= 5.2.0) 46 | activerecord (= 5.2.0) 47 | marcel (~> 0.3.1) 48 | activesupport (5.2.0) 49 | concurrent-ruby (~> 1.0, >= 1.0.2) 50 | i18n (>= 0.7, < 2) 51 | minitest (~> 5.1) 52 | tzinfo (~> 1.1) 53 | addressable (2.5.2) 54 | public_suffix (>= 2.0.2, < 4.0) 55 | archive-zip (0.11.0) 56 | io-like (~> 0.3.0) 57 | arel (9.0.0) 58 | aws-eventstream (1.0.0) 59 | aws-partitions (1.87.0) 60 | aws-sdk-core (3.21.1) 61 | aws-eventstream (~> 1.0) 62 | aws-partitions (~> 1.0) 63 | aws-sigv4 (~> 1.0) 64 | jmespath (~> 1.0) 65 | aws-sdk-kms (1.5.0) 66 | aws-sdk-core (~> 3) 67 | aws-sigv4 (~> 1.0) 68 | aws-sdk-s3 (1.12.0) 69 | aws-sdk-core (~> 3, >= 3.21.1) 70 | aws-sdk-kms (~> 1) 71 | aws-sigv4 (~> 1.0) 72 | aws-sigv4 (1.0.2) 73 | bcrypt (3.1.12) 74 | bindex (0.5.0) 75 | bootsnap (1.3.0) 76 | msgpack (~> 1.0) 77 | builder (3.2.3) 78 | byebug (10.0.2) 79 | capybara (3.1.0) 80 | addressable 81 | mini_mime (>= 0.1.3) 82 | nokogiri (~> 1.8) 83 | rack (>= 1.6.0) 84 | rack-test (>= 0.6.3) 85 | xpath (~> 3.0) 86 | childprocess (0.9.0) 87 | ffi (~> 1.0, >= 1.0.11) 88 | chromedriver-helper (1.2.0) 89 | archive-zip (~> 0.10) 90 | nokogiri (~> 1.8) 91 | coffee-rails (4.2.2) 92 | coffee-script (>= 2.2.0) 93 | railties (>= 4.0.0) 94 | coffee-script (2.4.1) 95 | coffee-script-source 96 | execjs 97 | coffee-script-source (1.12.2) 98 | concurrent-ruby (1.0.5) 99 | crass (1.0.4) 100 | devise (4.4.3) 101 | bcrypt (~> 3.0) 102 | orm_adapter (~> 0.1) 103 | railties (>= 4.1.0, < 6.0) 104 | responders 105 | warden (~> 1.2.3) 106 | dotenv (0.7.0) 107 | erubi (1.7.1) 108 | execjs (2.7.0) 109 | ffi (1.9.23) 110 | foreman (0.64.0) 111 | dotenv (~> 0.7.0) 112 | thor (>= 0.13.6) 113 | globalid (0.4.1) 114 | activesupport (>= 4.2.0) 115 | i18n (1.0.1) 116 | concurrent-ruby (~> 1.0) 117 | io-like (0.3.0) 118 | jbuilder (2.7.0) 119 | activesupport (>= 4.2.0) 120 | multi_json (>= 1.2) 121 | jmespath (1.4.0) 122 | listen (3.1.5) 123 | rb-fsevent (~> 0.9, >= 0.9.4) 124 | rb-inotify (~> 0.9, >= 0.9.7) 125 | ruby_dep (~> 1.2) 126 | loofah (2.2.2) 127 | crass (~> 1.0.2) 128 | nokogiri (>= 1.5.9) 129 | mail (2.7.0) 130 | mini_mime (>= 0.1.1) 131 | marcel (0.3.2) 132 | mimemagic (~> 0.3.2) 133 | method_source (0.9.0) 134 | mimemagic (0.3.2) 135 | mini_mime (1.0.0) 136 | mini_portile2 (2.3.0) 137 | minitest (5.11.3) 138 | msgpack (1.2.4) 139 | multi_json (1.13.1) 140 | nio4r (2.3.1) 141 | nokogiri (1.8.2) 142 | mini_portile2 (~> 2.3.0) 143 | orm_adapter (0.5.0) 144 | pg (1.0.0) 145 | pg_search (2.1.2) 146 | activerecord (>= 4.2) 147 | activesupport (>= 4.2) 148 | arel (>= 6) 149 | public_suffix (3.0.2) 150 | puma (3.11.4) 151 | rack (2.0.5) 152 | rack-proxy (0.6.4) 153 | rack 154 | rack-test (1.0.0) 155 | rack (>= 1.0, < 3) 156 | rails (5.2.0) 157 | actioncable (= 5.2.0) 158 | actionmailer (= 5.2.0) 159 | actionpack (= 5.2.0) 160 | actionview (= 5.2.0) 161 | activejob (= 5.2.0) 162 | activemodel (= 5.2.0) 163 | activerecord (= 5.2.0) 164 | activestorage (= 5.2.0) 165 | activesupport (= 5.2.0) 166 | bundler (>= 1.3.0) 167 | railties (= 5.2.0) 168 | sprockets-rails (>= 2.0.0) 169 | rails-dom-testing (2.0.3) 170 | activesupport (>= 4.2.0) 171 | nokogiri (>= 1.6) 172 | rails-html-sanitizer (1.0.4) 173 | loofah (~> 2.2, >= 2.2.2) 174 | railties (5.2.0) 175 | actionpack (= 5.2.0) 176 | activesupport (= 5.2.0) 177 | method_source 178 | rake (>= 0.8.7) 179 | thor (>= 0.18.1, < 2.0) 180 | rake (12.3.1) 181 | rb-fsevent (0.10.3) 182 | rb-inotify (0.9.10) 183 | ffi (>= 0.5.0, < 2) 184 | responders (2.4.0) 185 | actionpack (>= 4.2.0, < 5.3) 186 | railties (>= 4.2.0, < 5.3) 187 | ruby_dep (1.5.0) 188 | rubyzip (1.2.1) 189 | sass (3.5.6) 190 | sass-listen (~> 4.0.0) 191 | sass-listen (4.0.0) 192 | rb-fsevent (~> 0.9, >= 0.9.4) 193 | rb-inotify (~> 0.9, >= 0.9.7) 194 | sass-rails (5.0.7) 195 | railties (>= 4.0.0, < 6) 196 | sass (~> 3.1) 197 | sprockets (>= 2.8, < 4.0) 198 | sprockets-rails (>= 2.0, < 4.0) 199 | tilt (>= 1.1, < 3) 200 | selenium-webdriver (3.12.0) 201 | childprocess (~> 0.5) 202 | rubyzip (~> 1.2) 203 | spring (2.0.2) 204 | activesupport (>= 4.2) 205 | spring-watcher-listen (2.0.1) 206 | listen (>= 2.7, < 4.0) 207 | spring (>= 1.2, < 3.0) 208 | sprockets (3.7.1) 209 | concurrent-ruby (~> 1.0) 210 | rack (> 1, < 3) 211 | sprockets-rails (3.2.1) 212 | actionpack (>= 4.0) 213 | activesupport (>= 4.0) 214 | sprockets (>= 3.0.0) 215 | thor (0.20.0) 216 | thread_safe (0.3.6) 217 | tilt (2.0.8) 218 | turbolinks (5.1.1) 219 | turbolinks-source (~> 5.1) 220 | turbolinks-source (5.1.0) 221 | tzinfo (1.2.5) 222 | thread_safe (~> 0.1) 223 | uglifier (4.1.10) 224 | execjs (>= 0.3.0, < 3) 225 | warden (1.2.7) 226 | rack (>= 1.0) 227 | web-console (3.6.2) 228 | actionview (>= 5.0) 229 | activemodel (>= 5.0) 230 | bindex (>= 0.4.0) 231 | railties (>= 5.0) 232 | webpacker (3.5.3) 233 | activesupport (>= 4.2) 234 | rack-proxy (>= 0.6.1) 235 | railties (>= 4.2) 236 | websocket-driver (0.7.0) 237 | websocket-extensions (>= 0.1.0) 238 | websocket-extensions (0.1.3) 239 | xpath (3.0.0) 240 | nokogiri (~> 1.8) 241 | 242 | PLATFORMS 243 | ruby 244 | 245 | DEPENDENCIES 246 | aws-sdk-s3 247 | bootsnap (>= 1.1.0) 248 | byebug 249 | capybara (>= 2.15, < 4.0) 250 | chromedriver-helper 251 | coffee-rails (~> 4.2) 252 | devise 253 | fast_jsonapi! 254 | foreman 255 | jbuilder (~> 2.5) 256 | listen (>= 3.0.5, < 3.2) 257 | pg (>= 0.18, < 2.0) 258 | pg_search 259 | puma (~> 3.11) 260 | rails (~> 5.2.0) 261 | sass-rails (~> 5.0) 262 | selenium-webdriver 263 | spring 264 | spring-watcher-listen (~> 2.0.0) 265 | turbolinks (~> 5) 266 | tzinfo-data 267 | uglifier (>= 1.3.0) 268 | web-console (>= 3.3.0) 269 | webpacker 270 | 271 | RUBY VERSION 272 | ruby 2.4.0p0 273 | 274 | BUNDLED WITH 275 | 1.16.1 276 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: rails server 2 | webpack: bin/webpack-dev-server -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/api/v1/dashboards.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/api/v1/executions.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/api/v1/favorites.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/api/v1/movies.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/api/v1/recommendations.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/api/v1/reviews.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/api/v1/searches.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/api/v1/series.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's 5 | // vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require rails-ujs 14 | //= require activestorage 15 | //= require turbolinks 16 | //= require_tree . 17 | -------------------------------------------------------------------------------- /app/assets/javascripts/cable.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command. 3 | // 4 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/app/assets/javascripts/channels/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/home.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/api/v1/dashboards.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the api/v1/dashboards controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/api/v1/executions.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the api/v1/executions controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/api/v1/favorites.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the api/v1/favorites controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/api/v1/movies.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the api/v1/movies controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/api/v1/recommendations.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the api/v1/recommendations controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/api/v1/reviews.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the api/v1/reviews controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/api/v1/searches.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the api/v1/searches controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/api/v1/series.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the api/v1/series controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 6 | * vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/home.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the home controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/api/v1/dashboards_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::DashboardsController < ApplicationController 2 | 3 | def index 4 | type_params and (return if performed?) 5 | result = DashboardService.new(params[:type], current_user).perform 6 | render json: result 7 | end 8 | 9 | private 10 | 11 | def type_params 12 | params[:type] ||= "category" 13 | type_whitelist 14 | end 15 | 16 | def type_whitelist 17 | unless ["category", "keep_watching", "highlight"].include?(params[:type]) 18 | render json: { errors: "Unpermitted type parameter" }, status: :forbidden 19 | end 20 | end 21 | end -------------------------------------------------------------------------------- /app/controllers/api/v1/executions_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::ExecutionsController < ApplicationController 2 | before_action :set_execution, only: :update 3 | skip_before_action :verify_authenticity_token 4 | 5 | def show 6 | movie = Movie.find(params[:id]) 7 | @player = movie.players.find_or_create_by(end_date: nil, user: current_user) 8 | render json: Api::V1::PlayerSerializer.new(@player, include: [:movie, :'movie.serie']).serialized_json 9 | end 10 | 11 | def update 12 | if @player.update(player_params.merge(user: current_user)) 13 | if @player.movie.serie 14 | @player.movie.serie.update(last_watched_episode: @player.movie) 15 | end 16 | render json: Api::V1::PlayerSerializer.new(@player, include: [:movie]).serialized_json 17 | else 18 | render json: { errors: @player.errors.full_messages }, status: :unprocessable_entity 19 | end 20 | end 21 | 22 | private 23 | 24 | def player_params 25 | params.require(:execution).permit(:elapsed_time, :end_date) 26 | end 27 | 28 | def set_execution 29 | @player = Player.find_by(movie_id: params[:id]) 30 | end 31 | end -------------------------------------------------------------------------------- /app/controllers/api/v1/favorites_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::FavoritesController < ApplicationController 2 | before_action :set_favorite, only: :destroy 3 | skip_before_action :verify_authenticity_token 4 | 5 | def index 6 | @favorites = current_user.favorites 7 | render json: Api::V1::WatchableSerializer.new(@favorites.map(&:favoritable)).serialized_json 8 | end 9 | 10 | def create 11 | @favorite = Favorite.new(favorite_params.merge(user: current_user)) 12 | if @favorite.save 13 | head :ok 14 | else 15 | render json: { errors: @favorite.errors.full_messages }, status: :unprocessable_entity 16 | end 17 | end 18 | 19 | def destroy 20 | @favorite.destroy 21 | head :ok 22 | end 23 | 24 | private 25 | 26 | def set_favorite 27 | @favorite = Favorite.find_by(favoritable_type: params[:type].capitalize!, favoritable_id: params[:id], user: current_user) 28 | end 29 | 30 | def favorite_params 31 | params.require(:favorite).permit(:favoritable_type, :favoritable_id) 32 | end 33 | end -------------------------------------------------------------------------------- /app/controllers/api/v1/movies_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::MoviesController < ApplicationController 2 | def show 3 | @movie = Movie.find(params[:id]) 4 | render json: Api::V1::MovieSerializer.new(@movie, params: { user: current_user }).serialized_json 5 | end 6 | end -------------------------------------------------------------------------------- /app/controllers/api/v1/recommendations_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::RecommendationsController < ApplicationController 2 | def index 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/api/v1/reviews_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::ReviewsController < ApplicationController 2 | skip_before_action :verify_authenticity_token 3 | 4 | def index 5 | @reviews = Review.where(reviewable_id: params[:id], reviewable_type: params[:type].capitalize!) 6 | render json: Api::V1::ReviewSerializer.new(@reviews, include: [:user]).serialized_json 7 | end 8 | 9 | def create 10 | @review = Review.new(review_params.merge(user: current_user)) 11 | if @review.save 12 | render json: @review 13 | else 14 | render json: { errors: @review.errors.full_messages }, status: :unprocessable_entity 15 | end 16 | end 17 | 18 | private 19 | 20 | def review_params 21 | params.require(:review).permit(:reviewable_type, :reviewable_id, :rating, :description) 22 | end 23 | end -------------------------------------------------------------------------------- /app/controllers/api/v1/searches_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::SearchesController < ApplicationController 2 | def index 3 | check_search_value and (return if performed?) 4 | search = PgSearch.multisearch(params[:value]).order("created_at DESC") 5 | render json: Api::V1::WatchableSerializer.new(search.map(&:searchable)).serialized_json 6 | end 7 | 8 | private 9 | 10 | def check_search_value 11 | if params[:value].present? && params[:value].length < 3 12 | render json: { errors: "Parameter :value must have at least 3 characters" } 13 | end 14 | end 15 | end -------------------------------------------------------------------------------- /app/controllers/api/v1/series_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::SeriesController < ApplicationController 2 | def show 3 | @serie = Serie.find(params[:id]) 4 | render json: Api::V1::SerieSerializer.new(@serie, include: [:episodes], params: { user: current_user }).serialized_json 5 | end 6 | end -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | before_action :authenticate_user! 3 | end 4 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | def index 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/helpers/api/v1/dashboards_helper.rb: -------------------------------------------------------------------------------- 1 | module Api::V1::DashboardsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/api/v1/executions_helper.rb: -------------------------------------------------------------------------------- 1 | module Api::V1::ExecutionsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/api/v1/favorites_helper.rb: -------------------------------------------------------------------------------- 1 | module Api::V1::FavoritesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/api/v1/movies_helper.rb: -------------------------------------------------------------------------------- 1 | module Api::V1::MoviesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/api/v1/recommendations_helper.rb: -------------------------------------------------------------------------------- 1 | module Api::V1::RecommendationsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/api/v1/reviews_helper.rb: -------------------------------------------------------------------------------- 1 | module Api::V1::ReviewsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/api/v1/searches_helper.rb: -------------------------------------------------------------------------------- 1 | module Api::V1::SearchesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/api/v1/series_helper.rb: -------------------------------------------------------------------------------- 1 | module Api::V1::SeriesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | module HomeHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/javascript/packs/api/http.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | let token = document.getElementsByName('csrf-token')[0].getAttribute('content') 3 | 4 | const http = axios.create({ 5 | baseURL: '/api/v1', 6 | timeout: 1000, 7 | headers: { 8 | 'X-Custom-Header': 'foobar', 9 | 'Accept': 'application/json', 10 | 'Content-Type': 'application/json', 11 | 'X-CSRF-Token': token, 12 | } 13 | }); 14 | 15 | export default http; -------------------------------------------------------------------------------- /app/javascript/packs/api/index.js: -------------------------------------------------------------------------------- 1 | import Watchable from './watchable'; 2 | import Review from './review'; 3 | import Player from './player'; 4 | 5 | export default { 6 | Watchable, 7 | Review, 8 | Player 9 | } -------------------------------------------------------------------------------- /app/javascript/packs/api/player.js: -------------------------------------------------------------------------------- 1 | import Http from './http'; 2 | 3 | export default { 4 | show(id){ 5 | return Http.get(`/movies/${id}/executions`); 6 | }, 7 | update(id, elapsed_time, end_time){ 8 | return Http.put(`/movies/${id}/executions`, { 9 | execution: { 10 | elapsed_time: elapsed_time, 11 | end_time: end_time 12 | } 13 | }); 14 | } 15 | } -------------------------------------------------------------------------------- /app/javascript/packs/api/review.js: -------------------------------------------------------------------------------- 1 | import Http from './http'; 2 | 3 | export default { 4 | index(id, type){ 5 | return Http.get('/reviews', { 6 | params: { 7 | id: id, 8 | type: type 9 | } 10 | }); 11 | }, 12 | create(id, type, description, rating){ 13 | return Http.post('/reviews', { 14 | review: { 15 | reviewable_id: id, 16 | reviewable_type: type.replace(/\b\w/g, l => l.toUpperCase()), 17 | description: description, 18 | rating: rating 19 | } 20 | }); 21 | } 22 | } -------------------------------------------------------------------------------- /app/javascript/packs/api/watchable.js: -------------------------------------------------------------------------------- 1 | import Http from './http'; 2 | import { serialize } from 'uri-js'; 3 | 4 | 5 | export default { 6 | getFeatured() { 7 | return Http.get('/dashboard', { 8 | params: { 9 | type: 'highlight' 10 | } 11 | }) 12 | }, 13 | getCategories (){ 14 | return Http.get('/dashboard', { 15 | params: { 16 | type: 'category' 17 | } 18 | }); 19 | }, 20 | getKeepWatching (){ 21 | return Http.get('/dashboard', { 22 | params: { 23 | type: 'keep_watching' 24 | } 25 | }); 26 | }, 27 | getWatchable (id, type){ 28 | return Http.get(`/${type.toLowerCase()}s/${id}`); 29 | } 30 | } -------------------------------------------------------------------------------- /app/javascript/packs/app.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 27 | 28 | -------------------------------------------------------------------------------- /app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './app.vue' 3 | import Vuetify from 'vuetify' 4 | import router from './routes.js'; 5 | import store from './store'; 6 | 7 | 8 | import 'slick-carousel/slick/slick.css'; 9 | import 'vuetify/dist/vuetify.min.css'; 10 | import 'vue-dplayer/dist/vue-dplayer.css'; 11 | 12 | 13 | Vue.use(Vuetify) 14 | 15 | document.addEventListener('DOMContentLoaded', () => { 16 | const app = new Vue({ 17 | el: '#app', 18 | router, 19 | store, 20 | render: h => h(App) 21 | }) 22 | }) -------------------------------------------------------------------------------- /app/javascript/packs/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/app/javascript/packs/assets/logo.png -------------------------------------------------------------------------------- /app/javascript/packs/components/home/_details.vue: -------------------------------------------------------------------------------- 1 | 61 | 62 | 75 | 76 | -------------------------------------------------------------------------------- /app/javascript/packs/components/home/_featured.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 41 | 42 | -------------------------------------------------------------------------------- /app/javascript/packs/components/home/_movie_list.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 95 | 96 | -------------------------------------------------------------------------------- /app/javascript/packs/components/home/_movie_menu.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 99 | 100 | -------------------------------------------------------------------------------- /app/javascript/packs/components/home/_reviews.vue: -------------------------------------------------------------------------------- 1 | 72 | 73 | 124 | 125 | -------------------------------------------------------------------------------- /app/javascript/packs/components/home/index.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 38 | 39 | -------------------------------------------------------------------------------- /app/javascript/packs/components/shared/footer.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 26 | 27 | -------------------------------------------------------------------------------- /app/javascript/packs/components/shared/header.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 51 | 52 | -------------------------------------------------------------------------------- /app/javascript/packs/components/watch/index.vue: -------------------------------------------------------------------------------- 1 | 53 | 54 | 136 | 137 | -------------------------------------------------------------------------------- /app/javascript/packs/routes.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router'; 3 | Vue.use(VueRouter); 4 | 5 | import HomeIndex from './components/home/index.vue'; 6 | import WatchIndex from './components/watch/index.vue'; 7 | 8 | const router = new VueRouter({ 9 | mode: 'history', 10 | routes: [ 11 | { path: '/', component: HomeIndex }, 12 | { path: '/watch/:id', component: WatchIndex } 13 | ] 14 | }); 15 | 16 | export default router; -------------------------------------------------------------------------------- /app/javascript/packs/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuex from 'vuex'; 3 | Vue.use(Vuex); 4 | 5 | import MovieMenu from './modules/movie_menu'; 6 | import Watchable from './modules/watchable'; 7 | import Review from './modules/review'; 8 | import Player from './modules/player'; 9 | 10 | const store = new Vuex.Store({ 11 | modules: { 12 | MovieMenu, 13 | Watchable, 14 | Review, 15 | Player 16 | } 17 | }); 18 | 19 | export default store; -------------------------------------------------------------------------------- /app/javascript/packs/store/modules/movie_menu.js: -------------------------------------------------------------------------------- 1 | const MovieMenu = { 2 | namespaced: true, 3 | state: { 4 | currentMovieId: null 5 | }, 6 | mutations: { 7 | changeId(state, currentMovieId) { 8 | state.currentMovieId = currentMovieId; 9 | } 10 | }, 11 | actions: { 12 | changeId(context, currentMovieId) { 13 | context.commit('changeId', currentMovieId) 14 | } 15 | } 16 | }; 17 | 18 | export default MovieMenu; -------------------------------------------------------------------------------- /app/javascript/packs/store/modules/player.js: -------------------------------------------------------------------------------- 1 | import Api from '../../api'; 2 | 3 | const Player = { 4 | namespaced: true, 5 | state: { 6 | player: null, 7 | movie: null, 8 | serie: null 9 | }, 10 | mutations: { 11 | setPlayer(state, player) { 12 | state.player = player.data.attributes; 13 | state.movie = player.included[0]; 14 | state.serie = (player.included[1])? player.included[1] : null; 15 | } 16 | }, 17 | actions: { 18 | show(context, movie_id) { 19 | Api.Player.show(movie_id) 20 | .then(response => response.data) 21 | .then(player => { 22 | context.commit('setPlayer', player); 23 | }).catch(function (error) { 24 | console.log(error); 25 | }); 26 | }, 27 | update(context, {id, elapsed_time, end_time}) { 28 | Api.Player.update(id, elapsed_time, end_time) 29 | .then(response => response.data) 30 | .then(player => { 31 | console.log(player); 32 | }).catch(function (error) { 33 | console.log(error); 34 | }); 35 | } 36 | } 37 | }; 38 | 39 | export default Player; -------------------------------------------------------------------------------- /app/javascript/packs/store/modules/review.js: -------------------------------------------------------------------------------- 1 | import Api from '../../api'; 2 | 3 | const Reviews = { 4 | namespaced: true, 5 | state: { 6 | reviews: null, 7 | errorMessage: null, 8 | errorActive: false 9 | }, 10 | mutations: { 11 | setReviews(state, reviews) { 12 | state.reviews = reviews.data; 13 | }, 14 | pushReview(state, review) { 15 | state.reviews.push(review); 16 | }, 17 | setErrorMessage(state, {message, status}) { 18 | state.errorMessage = message; 19 | state.errorActive = status; 20 | } 21 | }, 22 | actions: { 23 | index(context, {id, type}) { 24 | Api.Review.index(id, type) 25 | .then(response => response.data) 26 | .then(reviews => { 27 | context.commit('setReviews', reviews); 28 | context.commit('setErrorMessage', {message: "", status: false}) 29 | }).catch(function (error) { 30 | console.log(error); 31 | }); 32 | }, 33 | create(context, {id, type, description, rating}) { 34 | Api.Review.create(id, type, description, rating) 35 | .then(response => response.data) 36 | .then(review => { 37 | context.commit('pushReview', {attributes: review}); 38 | context.commit('setErrorMessage', {message: "", status: false}) 39 | }).catch(function (error) { 40 | context.commit('setErrorMessage', {message: "Erro na criação do review", status: true}) 41 | }); 42 | } 43 | } 44 | }; 45 | 46 | export default Reviews; -------------------------------------------------------------------------------- /app/javascript/packs/store/modules/watchable.js: -------------------------------------------------------------------------------- 1 | import Api from '../../api'; 2 | 3 | const Watchable = { 4 | namespaced: true, 5 | state: { 6 | featured: null, 7 | keepWatching: null, 8 | categories: [], 9 | watchable: null 10 | }, 11 | mutations: { 12 | setFeatured(state, watchable) { 13 | state.featured = watchable.data.attributes; 14 | }, 15 | setKeepWatching(state, watchables) { 16 | state.keepWatching = watchables.data; 17 | }, 18 | setCategories(state, categories) { 19 | state.categories = categories.data; 20 | }, 21 | setWatchable(state, watchable) { 22 | state.watchable = watchable.data; 23 | } 24 | }, 25 | actions: { 26 | getFeatured(context) { 27 | Api.Watchable.getFeatured() 28 | .then(response => response.data) 29 | .then(watchable => { 30 | context.commit('setFeatured', watchable) 31 | }).catch(function (error) { 32 | console.log(error); 33 | }); 34 | }, 35 | getKeepWatching(context) { 36 | Api.Watchable.getKeepWatching() 37 | .then(response => response.data) 38 | .then(watchables => { 39 | context.commit('setKeepWatching', watchables) 40 | }).catch(function (error) { 41 | console.log(error); 42 | }); 43 | }, 44 | getCategories(context) { 45 | Api.Watchable.getCategories() 46 | .then(response => response.data) 47 | .then(categories => { 48 | context.commit('setCategories', categories) 49 | }).catch(function (error) { 50 | console.log(error); 51 | }); 52 | }, 53 | getWatchable(context, {id, type}) { 54 | Api.Watchable.getWatchable(id, type) 55 | .then(response => response.data) 56 | .then(watchable => { 57 | context.commit('setWatchable', watchable) 58 | }).catch(function (error) { 59 | console.log(error); 60 | }); 61 | } 62 | } 63 | }; 64 | 65 | export default Watchable; -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/models/category.rb: -------------------------------------------------------------------------------- 1 | class Category < ApplicationRecord 2 | has_many :series, class_name: "Serie" 3 | has_many :movies 4 | validates :name, presence: true, uniqueness: true 5 | end -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/concerns/highlightable.rb: -------------------------------------------------------------------------------- 1 | module Highlightable 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | validate :single_highlight 6 | 7 | def single_highlight 8 | any_entity = has_any_other_highlighted?(Movie) 9 | any_entity ||= has_any_other_highlighted?(Serie) unless any_entity 10 | if highlighted && any_entity 11 | errors.add(:single_highlight, "Only one highlighted entity is permitted") 12 | end 13 | end 14 | 15 | def has_any_other_highlighted?(model) 16 | records = model.where(highlighted: true) 17 | if self.class == model 18 | return records.where.not(id: self.id).any? 19 | end 20 | records.any? 21 | end 22 | end 23 | end -------------------------------------------------------------------------------- /app/models/favorite.rb: -------------------------------------------------------------------------------- 1 | class Favorite < ApplicationRecord 2 | belongs_to :favoritable, polymorphic: true 3 | belongs_to :user 4 | validates :user_id, uniqueness: { scope: [:favoritable_type, :favoritable_id], message: "can favorite only one time per resource" } 5 | end -------------------------------------------------------------------------------- /app/models/movie.rb: -------------------------------------------------------------------------------- 1 | class Movie < ApplicationRecord 2 | include Highlightable 3 | include PgSearch 4 | multisearchable against: [:title], if: lambda{ |record| record.serie.nil? } 5 | belongs_to :serie, optional: true 6 | belongs_to :category, optional: true 7 | has_many :reviews, as: :reviewable 8 | has_many :players, dependent: :destroy 9 | has_one :watched_serie, class_name: "Serie", foreign_key: "last_watched_episode_id", dependent: :nullify 10 | validates :title, presence: true 11 | validates :description, presence: true 12 | validates :thumbnail_key, presence: true 13 | validates :video_key, presence: true 14 | validates :episode_number, presence: true, uniqueness: { scope: :serie_id }, if: ->{ serie.present? } 15 | validates :category, presence: true, if: ->{ serie.nil? } 16 | validate :highlight_episode 17 | 18 | private 19 | 20 | def highlight_episode 21 | if self.serie.present? && self.highlighted == true 22 | errors.add(:highlight_episode, "It's not possible to highlight an serie episode") 23 | end 24 | end 25 | end -------------------------------------------------------------------------------- /app/models/player.rb: -------------------------------------------------------------------------------- 1 | class Player < ApplicationRecord 2 | belongs_to :movie 3 | belongs_to :user 4 | before_create :set_start_date 5 | 6 | private 7 | 8 | def set_start_date 9 | self.start_date ||= Time.zone.now 10 | end 11 | end -------------------------------------------------------------------------------- /app/models/review.rb: -------------------------------------------------------------------------------- 1 | class Review < ApplicationRecord 2 | belongs_to :reviewable, polymorphic: true 3 | belongs_to :user 4 | validates :rating, presence: true, numericality: { only_integer: true, greater_than: 0, less_than_or_equal_to: 5 } 5 | validates :description, presence: true, length: { minimum: 50 } 6 | validates :user_id, uniqueness: { scope: [:reviewable_type, :reviewable_id], message: "can add only one review per resource" } 7 | end -------------------------------------------------------------------------------- /app/models/serie.rb: -------------------------------------------------------------------------------- 1 | class Serie < ApplicationRecord 2 | include Highlightable 3 | include PgSearch 4 | multisearchable against: [:title] 5 | belongs_to :category 6 | has_many :reviews, as: :reviewable 7 | has_many :episodes, ->{ order(:episode_number) }, class_name: "Movie", dependent: :destroy 8 | belongs_to :last_watched_episode, class_name: "Movie", optional: true 9 | validates :title, presence: true 10 | validates :description, presence: true 11 | validates :thumbnail_key, presence: true 12 | end -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | devise :database_authenticatable, :registerable, :trackable, :validatable 3 | has_many :reviews 4 | has_many :favorites 5 | has_many :players 6 | validates :name, presence: true, on: :update 7 | end -------------------------------------------------------------------------------- /app/serializers/api/v1/category_serializer.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::CategorySerializer 2 | include FastJsonapi::ObjectSerializer 3 | attributes :name 4 | 5 | attribute :movies do |object| 6 | Api::V1::MovieSerializer.new(object.movies).serializable_hash 7 | end 8 | 9 | attribute :series do |object| 10 | Api::V1::SerieSerializer.new(object.series).serializable_hash 11 | end 12 | end -------------------------------------------------------------------------------- /app/serializers/api/v1/movie_serializer.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::MovieSerializer 2 | include FastJsonapi::ObjectSerializer 3 | attributes :id, :title, :description, :episode_number, :serie_id 4 | belongs_to :serie 5 | 6 | attribute :category do |object| 7 | object.category&.name 8 | end 9 | 10 | attribute :reviews_count do |object| 11 | object.reviews.count 12 | end 13 | 14 | attribute :favorite do |object, params| 15 | if params.present? && params.has_key?(:user) 16 | params[:user].favorites.where(favoritable: object).exists? 17 | end 18 | end 19 | 20 | attribute :thumbnail_url do |object| 21 | AWS_BUCKET.object("thumbnails/#{object.thumbnail_key}").presigned_url(:get, expires_in: 120) 22 | end 23 | 24 | attribute :thumbnail_cover_url do |object| 25 | AWS_BUCKET.object("thumbnails/#{object.thumbnail_cover_key}").presigned_url(:get, expires_in: 120) 26 | end 27 | 28 | attribute :featured_thumbnail_url do |object| 29 | if object[:featured_thumbnail_key].present? 30 | AWS_BUCKET.object("thumbnails/#{object.featured_thumbnail_key}").presigned_url(:get, expires_in: 120) 31 | end 32 | end 33 | 34 | attribute :video_url do |object| 35 | AWS_BUCKET.object("videos/#{object.video_key}").presigned_url(:get, expires_in: 120) 36 | end 37 | end -------------------------------------------------------------------------------- /app/serializers/api/v1/player_serializer.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::PlayerSerializer 2 | include FastJsonapi::ObjectSerializer 3 | set_type :execution 4 | attributes :id, :start_date, :end_date, :elapsed_time 5 | belongs_to :movie 6 | end -------------------------------------------------------------------------------- /app/serializers/api/v1/review_serializer.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::ReviewSerializer 2 | include FastJsonapi::ObjectSerializer 3 | attributes :rating, :description 4 | belongs_to :user 5 | end -------------------------------------------------------------------------------- /app/serializers/api/v1/serie_serializer.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::SerieSerializer 2 | include FastJsonapi::ObjectSerializer 3 | attributes :id, :title, :description 4 | has_many :episodes, record_type: :movies, serializer: :movie 5 | 6 | attribute :episodes do |object| 7 | object.episodes.map do |e| 8 | { 9 | title: e.title, 10 | id: e.id, 11 | thumbnail_url: AWS_BUCKET.object("thumbnails/#{e.thumbnail_key}").presigned_url(:get, expires_in: 120) 12 | } 13 | end 14 | end 15 | 16 | attribute :category do |object| 17 | object.category.name 18 | end 19 | 20 | attribute :last_watched_episode do |object| 21 | object.last_watched_episode_id 22 | end 23 | 24 | attribute :reviews_count do |object| 25 | object.reviews.count 26 | end 27 | 28 | attribute :favorite do |object, params| 29 | if params.present? && params.has_key?(:user) 30 | params[:user].favorites.where(favoritable: object).exists? 31 | end 32 | end 33 | 34 | attribute :thumbnail_url do |object| 35 | AWS_BUCKET.object("thumbnails/#{object.thumbnail_key}").presigned_url(:get, expires_in: 120) 36 | end 37 | 38 | attribute :thumbnail_cover_url do |object| 39 | AWS_BUCKET.object("thumbnails/#{object.thumbnail_cover_key}").presigned_url(:get, expires_in: 120) 40 | end 41 | 42 | attribute :featured_thumbnail_url do |object| 43 | if object[:featured_thumbnail_key].present? 44 | AWS_BUCKET.object("thumbnails/#{object.featured_thumbnail_key}").presigned_url(:get, expires_in: 120) 45 | end 46 | end 47 | end -------------------------------------------------------------------------------- /app/serializers/api/v1/user_serializer.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::UserSerializer 2 | include FastJsonapi::ObjectSerializer 3 | attributes :name, :email 4 | end -------------------------------------------------------------------------------- /app/serializers/api/v1/watchable_serializer.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::WatchableSerializer 2 | include FastJsonapi::ObjectSerializer 3 | attributes :id, :title, :description 4 | 5 | attribute :type do |object| 6 | object.model_name 7 | end 8 | 9 | attribute :favorite do |object, params| 10 | if params.present? && params.has_key?(:user) 11 | params[:user].favorites.where(favoritable: object).exists? 12 | end 13 | end 14 | 15 | attribute :thumbnail_url do |object| 16 | AWS_BUCKET.object("thumbnails/#{object.thumbnail_key}").presigned_url(:get, expires_in: 120) 17 | end 18 | 19 | attribute :thumbnail_cover_url do |object| 20 | AWS_BUCKET.object("thumbnails/#{object.thumbnail_cover_key}").presigned_url(:get, expires_in: 120) 21 | end 22 | 23 | attribute :video_url do |object| 24 | if object[:video_key].present? 25 | AWS_BUCKET.object("videos/#{object.video_key}").presigned_url(:get, expires_in: 120) 26 | end 27 | end 28 | 29 | attribute :featured_thumbnail_url do |object| 30 | if object[:featured_thumbnail_key].present? 31 | AWS_BUCKET.object("thumbnails/#{object.featured_thumbnail_key}").presigned_url(:get, expires_in: 120) 32 | end 33 | end 34 | end -------------------------------------------------------------------------------- /app/services/dashboard_service.rb: -------------------------------------------------------------------------------- 1 | class DashboardService 2 | 3 | def initialize(type, user) 4 | @type = type 5 | @user = user 6 | end 7 | 8 | def perform 9 | send("group_by_#{@type}") 10 | end 11 | 12 | private 13 | 14 | def group_by_category 15 | categories = Category.includes(:movies, :series) 16 | Api::V1::CategorySerializer.new(categories) 17 | end 18 | 19 | def group_by_keep_watching 20 | players = Player.includes(:movie).where(end_date: nil, user: @user) 21 | Api::V1::MovieSerializer.new(players.map(&:movie)) 22 | end 23 | 24 | def group_by_highlight 25 | highlight = Movie.find_by(highlighted: true) 26 | highlight ||= Serie.find_by(highlighted: true) 27 | Api::V1::WatchableSerializer.new(highlight, params: { user: @user }) 28 | end 29 | end -------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Edit <%= resource_name.to_s.humanize %>

2 | 3 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true, autocomplete: "email" %> 9 |
10 | 11 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 12 |
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
13 | <% end %> 14 | 15 |
16 | <%= f.label :password %> (leave blank if you don't want to change it)
17 | <%= f.password_field :password, autocomplete: "off" %> 18 | <% if @minimum_password_length %> 19 |
20 | <%= @minimum_password_length %> characters minimum 21 | <% end %> 22 |
23 | 24 |
25 | <%= f.label :password_confirmation %>
26 | <%= f.password_field :password_confirmation, autocomplete: "off" %> 27 |
28 | 29 |
30 | <%= f.label :current_password %> (we need your current password to confirm your changes)
31 | <%= f.password_field :current_password, autocomplete: "off" %> 32 |
33 | 34 |
35 | <%= f.submit "Update" %> 36 |
37 | <% end %> 38 | 39 |

Cancel my account

40 | 41 |

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

42 | 43 | <%= link_to "Back", :back %> 44 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |

Sign up

2 | 3 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true, autocomplete: "email" %> 9 |
10 | 11 |
12 | <%= f.label :password %> 13 | <% if @minimum_password_length %> 14 | (<%= @minimum_password_length %> characters minimum) 15 | <% end %>
16 | <%= f.password_field :password, autocomplete: "off" %> 17 |
18 | 19 |
20 | <%= f.label :password_confirmation %>
21 | <%= f.password_field :password_confirmation, autocomplete: "off" %> 22 |
23 | 24 |
25 | <%= f.submit "Sign up" %> 26 |
27 | <% end %> 28 | 29 | <%= render "devise/shared/links" %> 30 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |

Log in

2 | 3 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 4 |
5 | <%= f.label :email %>
6 | <%= f.email_field :email, autofocus: true, autocomplete: "email" %> 7 |
8 | 9 |
10 | <%= f.label :password %>
11 | <%= f.password_field :password, autocomplete: "off" %> 12 |
13 | 14 | <% if devise_mapping.rememberable? -%> 15 |
16 | <%= f.check_box :remember_me %> 17 | <%= f.label :remember_me %> 18 |
19 | <% end -%> 20 | 21 |
22 | <%= f.submit "Log in" %> 23 |
24 | <% end %> 25 | 26 | <%= render "devise/shared/links" %> 27 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 | <%- if controller_name != 'sessions' %> 2 | <%= link_to "Log in", new_session_path(resource_name) %>
3 | <% end -%> 4 | 5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%> 8 | 9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> 10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%> 12 | 13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%> 16 | 17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%> 20 | 21 | <%- if devise_mapping.omniauthable? %> 22 | <%- resource_class.omniauth_providers.each do |provider| %> 23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%> 25 | <% end -%> 26 | -------------------------------------------------------------------------------- /app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |
-------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Onebitflix 5 | <%= csrf_meta_tags %> 6 | <%= csp_meta_tag %> 7 | 8 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 9 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 10 | <%= stylesheet_pack_tag 'application' %> 11 | 12 | 13 | 14 | 15 | 16 | 17 | <%= yield %> 18 | <%= javascript_pack_tag 'application' %> 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../config/application', __dir__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'fileutils' 3 | include FileUtils 4 | 5 | # path to your application root. 6 | APP_ROOT = File.expand_path('..', __dir__) 7 | 8 | def system!(*args) 9 | system(*args) || abort("\n== Command #{args} failed ==") 10 | end 11 | 12 | chdir APP_ROOT do 13 | # This script is a starting point to setup your application. 14 | # Add necessary setup steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # Install JavaScript dependencies if using Yarn 21 | # system('bin/yarn') 22 | 23 | # puts "\n== Copying sample files ==" 24 | # unless File.exist?('config/database.yml') 25 | # cp 'config/database.yml.sample', 'config/database.yml' 26 | # end 27 | 28 | puts "\n== Preparing database ==" 29 | system! 'bin/rails db:setup' 30 | 31 | puts "\n== Removing old logs and tempfiles ==" 32 | system! 'bin/rails log:clear tmp:clear' 33 | 34 | puts "\n== Restarting application server ==" 35 | system! 'bin/rails restart' 36 | end 37 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) 11 | spring = lockfile.specs.detect { |spec| spec.name == "spring" } 12 | if spring 13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 14 | gem 'spring', spring.version 15 | require 'spring/binstub' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'fileutils' 3 | include FileUtils 4 | 5 | # path to your application root. 6 | APP_ROOT = File.expand_path('..', __dir__) 7 | 8 | def system!(*args) 9 | system(*args) || abort("\n== Command #{args} failed ==") 10 | end 11 | 12 | chdir APP_ROOT do 13 | # This script is a way to update your development environment automatically. 14 | # Add necessary update steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # Install JavaScript dependencies if using Yarn 21 | # system('bin/yarn') 22 | 23 | puts "\n== Updating database ==" 24 | system! 'bin/rails db:migrate' 25 | 26 | puts "\n== Removing old logs and tempfiles ==" 27 | system! 'bin/rails log:clear tmp:clear' 28 | 29 | puts "\n== Restarting application server ==" 30 | system! 'bin/rails restart' 31 | end 32 | -------------------------------------------------------------------------------- /bin/webpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "rubygems" 11 | require "bundler/setup" 12 | 13 | require "webpacker" 14 | require "webpacker/webpack_runner" 15 | Webpacker::WebpackRunner.run(ARGV) 16 | -------------------------------------------------------------------------------- /bin/webpack-dev-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "rubygems" 11 | require "bundler/setup" 12 | 13 | require "webpacker" 14 | require "webpacker/dev_server_runner" 15 | Webpacker::DevServerRunner.run(ARGV) 16 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_ROOT = File.expand_path('..', __dir__) 3 | Dir.chdir(APP_ROOT) do 4 | begin 5 | exec "yarnpkg", *ARGV 6 | rescue Errno::ENOENT 7 | $stderr.puts "Yarn executable was not detected in the system." 8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" 9 | exit 1 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module Onebitflix 10 | class Application < Rails::Application 11 | # Initialize configuration defaults for originally generated Rails version. 12 | config.load_defaults 5.2 13 | 14 | # Settings in config/environments/* take precedence over those specified here. 15 | # Application configuration can go into files in config/initializers 16 | # -- all .rb files in that directory are automatically loaded after loading 17 | # the framework and any gems in your application. 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations. 5 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: onebitflix_production 11 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | W25O2MJhnRnIby3m5OYSZj2zFLlZVYZhiyHuM+PEuA6pLL9yldFr2pEkxp1xVL+LdyJsMvww2I4MOi6TB9T9/jVU461F1FktdBaHdlohVdwFfm5boQTrHcFtmyZamLk6iWf1YbfITok0V26MRKa30sjNZrCMQLYQCjO/WJZqvtSK3fIGYpR4V5JEPxUYBp/mX5Kt0Vyofu4vMH3tQ844WNcXhruPTSpweW/2vxFF/KfhGBqZRdHXE/NXZ2uRZA6sXcKlL/NuBpxzEjHXo+vnt4Add95ZomUNwdxPSrYBlu717V5MjPOQfkRWPPISkde0mf7/b+7saE4sUN6/G/9Vt443lAFA2Tp0lwimA8u8Orpk1cYu3LFl6eXkGiFB81VflAmg3IslS9h3hcq7PybbL1ZktWYEKXyuuEvaKtz7lfu99YJmT1Nt6MZw92VQ9sK95fHtt5bUaNqKxI2MldQzEu7250gcPhsGOVXVe3F7EFp8GlQCUkzOad77FHQMcDeiS4NbTBW9yks=--9vaqDJFCykLsXqdk--OazkWfpHbdTpxLiCtBSAdw== -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | default: &default 2 | adapter: postgresql 3 | encoding: unicode 4 | username: leonardo 5 | password: 12345678 6 | development: 7 | <<: *default 8 | database: onebitflix2_development -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Verifies that versions and hashed value of the package contents in the project's package.json 3 | config.webpacker.check_yarn_integrity = true 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # In the development environment your application's code is reloaded on 7 | # every request. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. 12 | config.eager_load = false 13 | 14 | # Show full error reports. 15 | config.consider_all_requests_local = true 16 | 17 | # Enable/disable caching. By default caching is disabled. 18 | # Run rails dev:cache to toggle caching. 19 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 20 | config.action_controller.perform_caching = true 21 | 22 | config.cache_store = :memory_store 23 | config.public_file_server.headers = { 24 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 25 | } 26 | else 27 | config.action_controller.perform_caching = false 28 | 29 | config.cache_store = :null_store 30 | end 31 | 32 | # Store uploaded files on the local file system (see config/storage.yml for options) 33 | config.active_storage.service = :local 34 | 35 | # Don't care if the mailer can't send. 36 | config.action_mailer.raise_delivery_errors = false 37 | 38 | config.action_mailer.perform_caching = false 39 | 40 | # Print deprecation notices to the Rails logger. 41 | config.active_support.deprecation = :log 42 | 43 | # Raise an error on page load if there are pending migrations. 44 | config.active_record.migration_error = :page_load 45 | 46 | # Highlight code that triggered database queries in logs. 47 | config.active_record.verbose_query_logs = true 48 | 49 | # Debug mode disables concatenation and preprocessing of assets. 50 | # This option may cause significant delays in view rendering with a large 51 | # number of complex assets. 52 | config.assets.debug = true 53 | 54 | # Suppress logger output for asset requests. 55 | config.assets.quiet = true 56 | 57 | # Raises error for missing translations 58 | # config.action_view.raise_on_missing_translations = true 59 | 60 | # Use an evented file watcher to asynchronously detect changes in source code, 61 | # routes, locales, etc. This feature depends on the listen gem. 62 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 63 | end 64 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Verifies that versions and hashed value of the package contents in the project's package.json 3 | config.webpacker.check_yarn_integrity = false 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # Code is not reloaded between requests. 7 | config.cache_classes = true 8 | 9 | # Eager load code on boot. This eager loads most of Rails and 10 | # your application in memory, allowing both threaded web servers 11 | # and those relying on copy on write to perform better. 12 | # Rake tasks automatically ignore this option for performance. 13 | config.eager_load = true 14 | 15 | # Full error reports are disabled and caching is turned on. 16 | config.consider_all_requests_local = false 17 | config.action_controller.perform_caching = true 18 | 19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 21 | # config.require_master_key = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress JavaScripts and CSS. 28 | config.assets.js_compressor = Uglifier.new(harmony: true) 29 | # config.assets.css_compressor = :sass 30 | 31 | # Do not fallback to assets pipeline if a precompiled asset is missed. 32 | config.assets.compile = false 33 | 34 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 35 | 36 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 37 | # config.action_controller.asset_host = 'http://assets.example.com' 38 | 39 | # Specifies the header that your server uses for sending files. 40 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 41 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 42 | 43 | # Store uploaded files on the local file system (see config/storage.yml for options) 44 | config.active_storage.service = :local 45 | 46 | # Mount Action Cable outside main process or domain 47 | # config.action_cable.mount_path = nil 48 | # config.action_cable.url = 'wss://example.com/cable' 49 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 50 | 51 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 52 | # config.force_ssl = true 53 | 54 | # Use the lowest log level to ensure availability of diagnostic information 55 | # when problems arise. 56 | config.log_level = :debug 57 | 58 | # Prepend all log lines with the following tags. 59 | config.log_tags = [ :request_id ] 60 | 61 | # Use a different cache store in production. 62 | # config.cache_store = :mem_cache_store 63 | 64 | # Use a real queuing backend for Active Job (and separate queues per environment) 65 | # config.active_job.queue_adapter = :resque 66 | # config.active_job.queue_name_prefix = "onebitflix_#{Rails.env}" 67 | 68 | config.action_mailer.perform_caching = false 69 | 70 | # Ignore bad email addresses and do not raise email delivery errors. 71 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 72 | # config.action_mailer.raise_delivery_errors = false 73 | 74 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 75 | # the I18n.default_locale when a translation cannot be found). 76 | config.i18n.fallbacks = true 77 | 78 | # Send deprecation notices to registered listeners. 79 | config.active_support.deprecation = :notify 80 | 81 | # Use default logging formatter so that PID and timestamp are not suppressed. 82 | config.log_formatter = ::Logger::Formatter.new 83 | 84 | # Use a different logger for distributed setups. 85 | # require 'syslog/logger' 86 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 87 | 88 | if ENV["RAILS_LOG_TO_STDOUT"].present? 89 | logger = ActiveSupport::Logger.new(STDOUT) 90 | logger.formatter = config.log_formatter 91 | config.logger = ActiveSupport::TaggedLogging.new(logger) 92 | end 93 | 94 | # Do not dump schema after migrations. 95 | config.active_record.dump_schema_after_migration = false 96 | end 97 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure public file server for tests with Cache-Control for performance. 16 | config.public_file_server.enabled = true 17 | config.public_file_server.headers = { 18 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 19 | } 20 | 21 | # Show full error reports and disable caching. 22 | config.consider_all_requests_local = true 23 | config.action_controller.perform_caching = false 24 | 25 | # Raise exceptions instead of rendering exception templates. 26 | config.action_dispatch.show_exceptions = false 27 | 28 | # Disable request forgery protection in test environment. 29 | config.action_controller.allow_forgery_protection = false 30 | 31 | # Store uploaded files on the local file system in a temporary directory 32 | config.active_storage.service = :test 33 | 34 | config.action_mailer.perform_caching = false 35 | 36 | # Tell Action Mailer not to deliver emails to the real world. 37 | # The :test delivery method accumulates sent emails in the 38 | # ActionMailer::Base.deliveries array. 39 | config.action_mailer.delivery_method = :test 40 | 41 | # Print deprecation notices to the stderr. 42 | config.active_support.deprecation = :stderr 43 | 44 | # Raises error for missing translations 45 | # config.action_view.raise_on_missing_translations = true 46 | end 47 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | # Add Yarn node_modules folder to the asset load path. 9 | Rails.application.config.assets.paths << Rails.root.join('node_modules') 10 | 11 | # Precompile additional assets. 12 | # application.js, application.css, and all non-JS/CSS in the app/assets 13 | # folder are already added. 14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 15 | -------------------------------------------------------------------------------- /config/initializers/aws.rb: -------------------------------------------------------------------------------- 1 | Aws.config.update({ 2 | region: 'us-east-1', 3 | credentials: Aws::Credentials.new(Rails.application.credentials.aws_key, Rails.application.credentials.aws_secret) 4 | }) 5 | 6 | AWS_BUCKET = Aws::S3::Resource.new.bucket("onebitflix") -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy 4 | # For further information see the following documentation 5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 6 | 7 | # Rails.application.config.content_security_policy do |policy| 8 | # policy.default_src :self, :https 9 | # policy.font_src :self, :https, :data 10 | # policy.img_src :self, :https, :data 11 | # policy.object_src :none 12 | # policy.script_src :self, :https 13 | # policy.style_src :self, :https 14 | 15 | # # Specify URI for violation reports 16 | # # policy.report_uri "/csp-violation-report-endpoint" 17 | # end 18 | 19 | # If you are using UJS then enable automatic nonce generation 20 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } 21 | 22 | # Report CSP violations to a specified URI 23 | # For further information see the following documentation: 24 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 25 | # Rails.application.config.content_security_policy_report_only = true 26 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Use this hook to configure devise mailer, warden hooks and so forth. 4 | # Many of these configuration options can be set straight in your model. 5 | Devise.setup do |config| 6 | # The secret key used by Devise. Devise uses this key to generate 7 | # random tokens. Changing this key will render invalid all existing 8 | # confirmation, reset password and unlock tokens in the database. 9 | # Devise will use the `secret_key_base` as its `secret_key` 10 | # by default. You can change it below and use your own secret key. 11 | # config.secret_key = '2818c992bc95ab7e5a2516cc685c3b44cd3886e5321ecf10f6cc0926f8d5644d0f9930c7e1a7dbccf93e3cd3fe6dd203e9c6a657308829937ec5f751a44d975b' 12 | 13 | # ==> Controller configuration 14 | # Configure the parent class to the devise controllers. 15 | # config.parent_controller = 'DeviseController' 16 | 17 | # ==> Mailer Configuration 18 | # Configure the e-mail address which will be shown in Devise::Mailer, 19 | # note that it will be overwritten if you use your own mailer class 20 | # with default "from" parameter. 21 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' 22 | 23 | # Configure the class responsible to send e-mails. 24 | # config.mailer = 'Devise::Mailer' 25 | 26 | # Configure the parent class responsible to send e-mails. 27 | # config.parent_mailer = 'ActionMailer::Base' 28 | 29 | # ==> ORM configuration 30 | # Load and configure the ORM. Supports :active_record (default) and 31 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 32 | # available as additional gems. 33 | require 'devise/orm/active_record' 34 | 35 | # ==> Configuration for any authentication mechanism 36 | # Configure which keys are used when authenticating a user. The default is 37 | # just :email. You can configure it to use [:username, :subdomain], so for 38 | # authenticating a user, both parameters are required. Remember that those 39 | # parameters are used only when authenticating and not when retrieving from 40 | # session. If you need permissions, you should implement that in a before filter. 41 | # You can also supply a hash where the value is a boolean determining whether 42 | # or not authentication should be aborted when the value is not present. 43 | # config.authentication_keys = [:email] 44 | 45 | # Configure parameters from the request object used for authentication. Each entry 46 | # given should be a request method and it will automatically be passed to the 47 | # find_for_authentication method and considered in your model lookup. For instance, 48 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 49 | # The same considerations mentioned for authentication_keys also apply to request_keys. 50 | # config.request_keys = [] 51 | 52 | # Configure which authentication keys should be case-insensitive. 53 | # These keys will be downcased upon creating or modifying a user and when used 54 | # to authenticate or find a user. Default is :email. 55 | config.case_insensitive_keys = [:email] 56 | 57 | # Configure which authentication keys should have whitespace stripped. 58 | # These keys will have whitespace before and after removed upon creating or 59 | # modifying a user and when used to authenticate or find a user. Default is :email. 60 | config.strip_whitespace_keys = [:email] 61 | 62 | # Tell if authentication through request.params is enabled. True by default. 63 | # It can be set to an array that will enable params authentication only for the 64 | # given strategies, for example, `config.params_authenticatable = [:database]` will 65 | # enable it only for database (email + password) authentication. 66 | # config.params_authenticatable = true 67 | 68 | # Tell if authentication through HTTP Auth is enabled. False by default. 69 | # It can be set to an array that will enable http authentication only for the 70 | # given strategies, for example, `config.http_authenticatable = [:database]` will 71 | # enable it only for database authentication. The supported strategies are: 72 | # :database = Support basic authentication with authentication key + password 73 | # config.http_authenticatable = false 74 | 75 | # If 401 status code should be returned for AJAX requests. True by default. 76 | # config.http_authenticatable_on_xhr = true 77 | 78 | # The realm used in Http Basic Authentication. 'Application' by default. 79 | # config.http_authentication_realm = 'Application' 80 | 81 | # It will change confirmation, password recovery and other workflows 82 | # to behave the same regardless if the e-mail provided was right or wrong. 83 | # Does not affect registerable. 84 | # config.paranoid = true 85 | 86 | # By default Devise will store the user in session. You can skip storage for 87 | # particular strategies by setting this option. 88 | # Notice that if you are skipping storage for all authentication paths, you 89 | # may want to disable generating routes to Devise's sessions controller by 90 | # passing skip: :sessions to `devise_for` in your config/routes.rb 91 | config.skip_session_storage = [:http_auth] 92 | 93 | # By default, Devise cleans up the CSRF token on authentication to 94 | # avoid CSRF token fixation attacks. This means that, when using AJAX 95 | # requests for sign in and sign up, you need to get a new CSRF token 96 | # from the server. You can disable this option at your own risk. 97 | # config.clean_up_csrf_token_on_authentication = true 98 | 99 | # When false, Devise will not attempt to reload routes on eager load. 100 | # This can reduce the time taken to boot the app but if your application 101 | # requires the Devise mappings to be loaded during boot time the application 102 | # won't boot properly. 103 | # config.reload_routes = true 104 | 105 | # ==> Configuration for :database_authenticatable 106 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If 107 | # using other algorithms, it sets how many times you want the password to be hashed. 108 | # 109 | # Limiting the stretches to just one in testing will increase the performance of 110 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 111 | # a value less than 10 in other environments. Note that, for bcrypt (the default 112 | # algorithm), the cost increases exponentially with the number of stretches (e.g. 113 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 114 | config.stretches = Rails.env.test? ? 1 : 11 115 | 116 | # Set up a pepper to generate the hashed password. 117 | # config.pepper = 'a58b17ee12dc54638be943cdfc8ef60d06255261b1294745a7804b86a8b157f981c34bc08d961e285c598381ddaecd9116feb5a1b776cbda29cf2d2d53b2b4a7' 118 | 119 | # Send a notification to the original email when the user's email is changed. 120 | # config.send_email_changed_notification = false 121 | 122 | # Send a notification email when the user's password is changed. 123 | # config.send_password_change_notification = false 124 | 125 | # ==> Configuration for :confirmable 126 | # A period that the user is allowed to access the website even without 127 | # confirming their account. For instance, if set to 2.days, the user will be 128 | # able to access the website for two days without confirming their account, 129 | # access will be blocked just in the third day. Default is 0.days, meaning 130 | # the user cannot access the website without confirming their account. 131 | # config.allow_unconfirmed_access_for = 2.days 132 | 133 | # A period that the user is allowed to confirm their account before their 134 | # token becomes invalid. For example, if set to 3.days, the user can confirm 135 | # their account within 3 days after the mail was sent, but on the fourth day 136 | # their account can't be confirmed with the token any more. 137 | # Default is nil, meaning there is no restriction on how long a user can take 138 | # before confirming their account. 139 | # config.confirm_within = 3.days 140 | 141 | # If true, requires any email changes to be confirmed (exactly the same way as 142 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 143 | # db field (see migrations). Until confirmed, new email is stored in 144 | # unconfirmed_email column, and copied to email column on successful confirmation. 145 | config.reconfirmable = true 146 | 147 | # Defines which key will be used when confirming an account 148 | # config.confirmation_keys = [:email] 149 | 150 | # ==> Configuration for :rememberable 151 | # The time the user will be remembered without asking for credentials again. 152 | # config.remember_for = 2.weeks 153 | 154 | # Invalidates all the remember me tokens when the user signs out. 155 | config.expire_all_remember_me_on_sign_out = true 156 | 157 | # If true, extends the user's remember period when remembered via cookie. 158 | # config.extend_remember_period = false 159 | 160 | # Options to be passed to the created cookie. For instance, you can set 161 | # secure: true in order to force SSL only cookies. 162 | # config.rememberable_options = {} 163 | 164 | # ==> Configuration for :validatable 165 | # Range for password length. 166 | config.password_length = 6..128 167 | 168 | # Email regex used to validate email formats. It simply asserts that 169 | # one (and only one) @ exists in the given string. This is mainly 170 | # to give user feedback and not to assert the e-mail validity. 171 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ 172 | 173 | # ==> Configuration for :timeoutable 174 | # The time you want to timeout the user session without activity. After this 175 | # time the user will be asked for credentials again. Default is 30 minutes. 176 | # config.timeout_in = 30.minutes 177 | 178 | # ==> Configuration for :lockable 179 | # Defines which strategy will be used to lock an account. 180 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 181 | # :none = No lock strategy. You should handle locking by yourself. 182 | # config.lock_strategy = :failed_attempts 183 | 184 | # Defines which key will be used when locking and unlocking an account 185 | # config.unlock_keys = [:email] 186 | 187 | # Defines which strategy will be used to unlock an account. 188 | # :email = Sends an unlock link to the user email 189 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 190 | # :both = Enables both strategies 191 | # :none = No unlock strategy. You should handle unlocking by yourself. 192 | # config.unlock_strategy = :both 193 | 194 | # Number of authentication tries before locking an account if lock_strategy 195 | # is failed attempts. 196 | # config.maximum_attempts = 20 197 | 198 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 199 | # config.unlock_in = 1.hour 200 | 201 | # Warn on the last attempt before the account is locked. 202 | # config.last_attempt_warning = true 203 | 204 | # ==> Configuration for :recoverable 205 | # 206 | # Defines which key will be used when recovering the password for an account 207 | # config.reset_password_keys = [:email] 208 | 209 | # Time interval you can reset your password with a reset password key. 210 | # Don't put a too small interval or your users won't have the time to 211 | # change their passwords. 212 | config.reset_password_within = 6.hours 213 | 214 | # When set to false, does not sign a user in automatically after their password is 215 | # reset. Defaults to true, so a user is signed in automatically after a reset. 216 | # config.sign_in_after_reset_password = true 217 | 218 | # ==> Configuration for :encryptable 219 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default). 220 | # You can use :sha1, :sha512 or algorithms from others authentication tools as 221 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 222 | # for default behavior) and :restful_authentication_sha1 (then you should set 223 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). 224 | # 225 | # Require the `devise-encryptable` gem when using anything other than bcrypt 226 | # config.encryptor = :sha512 227 | 228 | # ==> Scopes configuration 229 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 230 | # "users/sessions/new". It's turned off by default because it's slower if you 231 | # are using only default views. 232 | # config.scoped_views = false 233 | 234 | # Configure the default scope given to Warden. By default it's the first 235 | # devise role declared in your routes (usually :user). 236 | # config.default_scope = :user 237 | 238 | # Set this configuration to false if you want /users/sign_out to sign out 239 | # only the current scope. By default, Devise signs out all scopes. 240 | # config.sign_out_all_scopes = true 241 | 242 | # ==> Navigation configuration 243 | # Lists the formats that should be treated as navigational. Formats like 244 | # :html, should redirect to the sign in page when the user does not have 245 | # access, but formats like :xml or :json, should return 401. 246 | # 247 | # If you have any extra navigational formats, like :iphone or :mobile, you 248 | # should add them to the navigational formats lists. 249 | # 250 | # The "*/*" below is required to match Internet Explorer requests. 251 | # config.navigational_formats = ['*/*', :html] 252 | 253 | # The default HTTP method used to sign out a resource. Default is :delete. 254 | config.sign_out_via = :get 255 | 256 | # ==> OmniAuth 257 | # Add a new OmniAuth provider. Check the wiki for more information on setting 258 | # up on your models and hooks. 259 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 260 | 261 | # ==> Warden configuration 262 | # If you want to use other strategies, that are not supported by Devise, or 263 | # change the failure app, you can configure them inside the config.warden block. 264 | # 265 | # config.warden do |manager| 266 | # manager.intercept_401 = false 267 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 268 | # end 269 | 270 | # ==> Mountable engine configurations 271 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 272 | # is mountable, there are some extra configurations to be taken into account. 273 | # The following options are available, assuming the engine is mounted as: 274 | # 275 | # mount MyEngine, at: '/my_engine' 276 | # 277 | # The router that invoked `devise_for`, in the example above, would be: 278 | # config.router_name = :my_engine 279 | # 280 | # When using OmniAuth, Devise cannot automatically set OmniAuth path, 281 | # so you need to do it manually. For the users scope, it would be: 282 | # config.omniauth_path_prefix = '/my_engine/users/auth' 283 | end 284 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/pg_search.rb: -------------------------------------------------------------------------------- 1 | PgSearch.multisearch_options = { 2 | using: { 3 | tsearch: { 4 | any_word: true 5 | }, 6 | trigram: {} 7 | } 8 | } -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your email address has been successfully confirmed." 7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." 8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid %{authentication_keys} or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account is locked." 15 | not_found_in_database: "Invalid %{authentication_keys} or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your email address before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock instructions" 26 | email_changed: 27 | subject: "Email Changed" 28 | password_change: 29 | subject: "Password Changed" 30 | omniauth_callbacks: 31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 32 | success: "Successfully authenticated from %{kind} account." 33 | passwords: 34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." 35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." 37 | updated: "Your password has been changed successfully. You are now signed in." 38 | updated_not_active: "Your password has been changed successfully." 39 | registrations: 40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." 41 | signed_up: "Welcome! You have signed up successfully." 42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." 45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." 46 | updated: "Your account has been updated successfully." 47 | sessions: 48 | signed_in: "Signed in successfully." 49 | signed_out: "Signed out successfully." 50 | already_signed_out: "Signed out successfully." 51 | unlocks: 52 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." 53 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." 54 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 55 | errors: 56 | messages: 57 | already_confirmed: "was already confirmed, please try signing in" 58 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 59 | expired: "has expired, please request a new one" 60 | not_found: "not found" 61 | not_locked: "was not locked" 62 | not_saved: 63 | one: "1 error prohibited this %{resource} from being saved:" 64 | other: "%{count} errors prohibited this %{resource} from being saved:" 65 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # 'true': 'foo' 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at http://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 8 | threads threads_count, threads_count 9 | 10 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 11 | # 12 | port ENV.fetch("PORT") { 3000 } 13 | 14 | # Specifies the `environment` that Puma will run in. 15 | # 16 | environment ENV.fetch("RAILS_ENV") { "development" } 17 | 18 | # Specifies the number of `workers` to boot in clustered mode. 19 | # Workers are forked webserver processes. If using threads and workers together 20 | # the concurrency of the application would be max `threads` * `workers`. 21 | # Workers do not work on JRuby or Windows (both of which do not support 22 | # processes). 23 | # 24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 25 | 26 | # Use the `preload_app!` method when specifying a `workers` number. 27 | # This directive tells Puma to first boot the application and load code 28 | # before forking the application. This takes advantage of Copy On Write 29 | # process behavior so workers use less memory. 30 | # 31 | # preload_app! 32 | 33 | # Allow puma to be restarted by `rails restart` command. 34 | plugin :tmp_restart 35 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | devise_for :users 3 | root :to => "home#index" 4 | 5 | namespace :api do 6 | namespace :v1 do 7 | get '/dashboard', to: 'dashboards#index', as: 'dashboard' 8 | resources :favorites, path: "my_list", only: %i( index create ) 9 | delete '/my_list/:type/:id', to: 'favorites#destroy' 10 | resources :reviews, only: [:index, :create] 11 | resources :searches, path: "search", only: :index 12 | resources :series, only: :show 13 | resources :movies, only: :show do 14 | member do 15 | get '/executions', to: 'executions#show' 16 | put '/executions', to: 'executions#update' 17 | end 18 | end 19 | resources :recommendations, only: :index 20 | end 21 | end 22 | 23 | match "*path", to: "home#index", via: :get 24 | end -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w[ 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ].each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | const vue = require('./loaders/vue') 3 | 4 | environment.loaders.append('vue', vue) 5 | module.exports = environment 6 | -------------------------------------------------------------------------------- /config/webpack/loaders/vue.js: -------------------------------------------------------------------------------- 1 | const { dev_server: devServer } = require('@rails/webpacker').config 2 | 3 | const isProduction = process.env.NODE_ENV === 'production' 4 | const inDevServer = process.argv.find(v => v.includes('webpack-dev-server')) 5 | const extractCSS = !(inDevServer && (devServer && devServer.hmr)) || isProduction 6 | 7 | module.exports = { 8 | test: /\.vue(\.erb)?$/, 9 | use: [{ 10 | loader: 'vue-loader', 11 | options: { extractCSS } 12 | }] 13 | } 14 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpacker.yml: -------------------------------------------------------------------------------- 1 | # Note: You must restart bin/webpack-dev-server for changes to take effect 2 | 3 | default: &default 4 | source_path: app/javascript 5 | source_entry_path: packs 6 | public_output_path: packs 7 | cache_path: tmp/cache/webpacker 8 | 9 | # Additional paths webpack should lookup modules 10 | # ['app/assets', 'engine/foo/app/assets'] 11 | resolved_paths: [] 12 | 13 | # Reload manifest.json on all requests so we reload latest compiled packs 14 | cache_manifest: false 15 | 16 | extensions: 17 | - .vue 18 | - .js 19 | - .sass 20 | - .scss 21 | - .css 22 | - .module.sass 23 | - .module.scss 24 | - .module.css 25 | - .png 26 | - .svg 27 | - .gif 28 | - .jpeg 29 | - .jpg 30 | 31 | development: 32 | <<: *default 33 | compile: true 34 | 35 | # Reference: https://webpack.js.org/configuration/dev-server/ 36 | dev_server: 37 | https: false 38 | host: localhost 39 | port: 3035 40 | public: localhost:3035 41 | hmr: false 42 | # Inline should be set to true if using HMR 43 | inline: true 44 | overlay: true 45 | compress: true 46 | disable_host_check: true 47 | use_local_ip: false 48 | quiet: false 49 | headers: 50 | 'Access-Control-Allow-Origin': '*' 51 | watch_options: 52 | ignored: /node_modules/ 53 | 54 | 55 | test: 56 | <<: *default 57 | compile: true 58 | 59 | # Compile test packs to a separate directory 60 | public_output_path: packs-test 61 | 62 | production: 63 | <<: *default 64 | 65 | # Production depends on precompilation of packs prior to booting for performance. 66 | compile: false 67 | 68 | # Cache manifest.json for performance 69 | cache_manifest: true 70 | -------------------------------------------------------------------------------- /db/migrate/20180519060421_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DeviseCreateUsers < ActiveRecord::Migration[5.2] 4 | def change 5 | create_table :users do |t| 6 | t.string :name 7 | ## Database authenticatable 8 | t.string :email, null: false, default: "" 9 | t.string :encrypted_password, null: false, default: "" 10 | 11 | ## Recoverable 12 | t.string :reset_password_token 13 | t.datetime :reset_password_sent_at 14 | 15 | ## Rememberable 16 | t.datetime :remember_created_at 17 | 18 | ## Trackable 19 | t.integer :sign_in_count, default: 0, null: false 20 | t.datetime :current_sign_in_at 21 | t.datetime :last_sign_in_at 22 | t.inet :current_sign_in_ip 23 | t.inet :last_sign_in_ip 24 | 25 | ## Confirmable 26 | # t.string :confirmation_token 27 | # t.datetime :confirmed_at 28 | # t.datetime :confirmation_sent_at 29 | # t.string :unconfirmed_email # Only if using reconfirmable 30 | 31 | ## Lockable 32 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 33 | # t.string :unlock_token # Only if unlock strategy is :email or :both 34 | # t.datetime :locked_at 35 | 36 | 37 | t.timestamps null: false 38 | end 39 | 40 | add_index :users, :email, unique: true 41 | add_index :users, :reset_password_token, unique: true 42 | # add_index :users, :confirmation_token, unique: true 43 | # add_index :users, :unlock_token, unique: true 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /db/migrate/20180519172436_create_pg_search_documents.rb: -------------------------------------------------------------------------------- 1 | class CreatePgSearchDocuments < ActiveRecord::Migration[5.2] 2 | 3 | def self.up 4 | say_with_time("Creating table for pg_search multisearch") do 5 | create_table :pg_search_documents do |t| 6 | t.text :content 7 | t.belongs_to :searchable, :polymorphic => true, :index => true 8 | t.timestamps null: false 9 | end 10 | end 11 | 12 | say_with_time("Adding PG Extensions") do 13 | execute "CREATE EXTENSION IF NOT EXISTS pg_trgm;" 14 | execute "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;" 15 | end 16 | end 17 | 18 | def self.down 19 | say_with_time("Dropping table for pg_search multisearch") do 20 | drop_table :pg_search_documents 21 | end 22 | 23 | say_with_time("Dropping PG Extensions") do 24 | execute "DROP EXTENSION IF EXISTS pg_trgm;" 25 | execute "DROP EXTENSION IF EXISTS fuzzystrmatch;" 26 | end 27 | end 28 | end -------------------------------------------------------------------------------- /db/migrate/20180519173753_create_categories.rb: -------------------------------------------------------------------------------- 1 | class CreateCategories < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :categories do |t| 4 | t.string :name 5 | 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20180519173754_create_reviews.rb: -------------------------------------------------------------------------------- 1 | class CreateReviews < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :reviews do |t| 4 | t.integer :rating 5 | t.text :description 6 | t.references :reviewable, polymorphic: true 7 | t.references :user, foreign_key: true 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20180519173755_create_favorites.rb: -------------------------------------------------------------------------------- 1 | class CreateFavorites < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :favorites do |t| 4 | t.references :favoritable, polymorphic: true 5 | t.references :user, foreign_key: true 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20180519173756_create_series.rb: -------------------------------------------------------------------------------- 1 | class CreateSeries < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :series do |t| 4 | t.boolean :highlighted, default: false 5 | t.string :title 6 | t.text :description 7 | t.string :thumbnail_key 8 | t.references :category, foreign_key: true 9 | t.string :featured_thumbnail_key 10 | t.string :thumbnail_cover_key 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20180519173757_create_movies.rb: -------------------------------------------------------------------------------- 1 | class CreateMovies < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :movies do |t| 4 | t.boolean :highlighted, default: false 5 | t.string :title 6 | t.text :description 7 | t.string :thumbnail_key 8 | t.string :video_key 9 | t.integer :episode_number 10 | t.string :featured_thumbnail_key 11 | t.references :serie, optional: true, foreign_key: true 12 | t.references :category, foreign_key: true 13 | t.string :thumbnail_cover_key 14 | 15 | t.timestamps 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /db/migrate/20180519173758_create_players.rb: -------------------------------------------------------------------------------- 1 | class CreatePlayers < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :players do |t| 4 | t.datetime :start_date 5 | t.datetime :end_date 6 | t.time :elapsed_time 7 | t.references :movie, foreign_key: true 8 | t.references :user, foreign_key: true 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20180519173759_add_last_watched_episode_to_series.rb: -------------------------------------------------------------------------------- 1 | class AddLastWatchedEpisodeToSeries < ActiveRecord::Migration[5.2] 2 | def change 3 | add_reference :series, :last_watched_episode, foreign_key: { to_table: :movies } 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180525024551_remove_elapsed_time_from_player.rb: -------------------------------------------------------------------------------- 1 | class RemoveElapsedTimeFromPlayer < ActiveRecord::Migration[5.2] 2 | def change 3 | remove_column :players, :elapsed_time, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180525024605_add_elapsed_time_to_player.rb: -------------------------------------------------------------------------------- 1 | class AddElapsedTimeToPlayer < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :players, :elapsed_time, :decimal 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # Note that this schema.rb definition is the authoritative source for your 6 | # database schema. If you need to create the application database on another 7 | # system, you should be using db:schema:load, not running all the migrations 8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 | # you'll amass, the slower it'll run and the greater likelihood for issues). 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 2018_05_25_024605) do 14 | 15 | # These are extensions that must be enabled in order to support this database 16 | enable_extension "fuzzystrmatch" 17 | enable_extension "pg_trgm" 18 | enable_extension "plpgsql" 19 | 20 | create_table "categories", force: :cascade do |t| 21 | t.string "name" 22 | t.datetime "created_at", null: false 23 | t.datetime "updated_at", null: false 24 | end 25 | 26 | create_table "favorites", force: :cascade do |t| 27 | t.string "favoritable_type" 28 | t.bigint "favoritable_id" 29 | t.bigint "user_id" 30 | t.datetime "created_at", null: false 31 | t.datetime "updated_at", null: false 32 | t.index ["favoritable_type", "favoritable_id"], name: "index_favorites_on_favoritable_type_and_favoritable_id" 33 | t.index ["user_id"], name: "index_favorites_on_user_id" 34 | end 35 | 36 | create_table "movies", force: :cascade do |t| 37 | t.boolean "highlighted", default: false 38 | t.string "title" 39 | t.text "description" 40 | t.string "thumbnail_key" 41 | t.string "video_key" 42 | t.integer "episode_number" 43 | t.string "featured_thumbnail_key" 44 | t.bigint "serie_id" 45 | t.bigint "category_id" 46 | t.string "thumbnail_cover_key" 47 | t.datetime "created_at", null: false 48 | t.datetime "updated_at", null: false 49 | t.index ["category_id"], name: "index_movies_on_category_id" 50 | t.index ["serie_id"], name: "index_movies_on_serie_id" 51 | end 52 | 53 | create_table "pg_search_documents", force: :cascade do |t| 54 | t.text "content" 55 | t.string "searchable_type" 56 | t.bigint "searchable_id" 57 | t.datetime "created_at", null: false 58 | t.datetime "updated_at", null: false 59 | t.index ["searchable_type", "searchable_id"], name: "index_pg_search_documents_on_searchable_type_and_searchable_id" 60 | end 61 | 62 | create_table "players", force: :cascade do |t| 63 | t.datetime "start_date" 64 | t.datetime "end_date" 65 | t.bigint "movie_id" 66 | t.bigint "user_id" 67 | t.datetime "created_at", null: false 68 | t.datetime "updated_at", null: false 69 | t.decimal "elapsed_time" 70 | t.index ["movie_id"], name: "index_players_on_movie_id" 71 | t.index ["user_id"], name: "index_players_on_user_id" 72 | end 73 | 74 | create_table "reviews", force: :cascade do |t| 75 | t.integer "rating" 76 | t.text "description" 77 | t.string "reviewable_type" 78 | t.bigint "reviewable_id" 79 | t.bigint "user_id" 80 | t.datetime "created_at", null: false 81 | t.datetime "updated_at", null: false 82 | t.index ["reviewable_type", "reviewable_id"], name: "index_reviews_on_reviewable_type_and_reviewable_id" 83 | t.index ["user_id"], name: "index_reviews_on_user_id" 84 | end 85 | 86 | create_table "series", force: :cascade do |t| 87 | t.boolean "highlighted", default: false 88 | t.string "title" 89 | t.text "description" 90 | t.string "thumbnail_key" 91 | t.bigint "category_id" 92 | t.string "featured_thumbnail_key" 93 | t.string "thumbnail_cover_key" 94 | t.datetime "created_at", null: false 95 | t.datetime "updated_at", null: false 96 | t.bigint "last_watched_episode_id" 97 | t.index ["category_id"], name: "index_series_on_category_id" 98 | t.index ["last_watched_episode_id"], name: "index_series_on_last_watched_episode_id" 99 | end 100 | 101 | create_table "users", force: :cascade do |t| 102 | t.string "name" 103 | t.string "email", default: "", null: false 104 | t.string "encrypted_password", default: "", null: false 105 | t.string "reset_password_token" 106 | t.datetime "reset_password_sent_at" 107 | t.datetime "remember_created_at" 108 | t.integer "sign_in_count", default: 0, null: false 109 | t.datetime "current_sign_in_at" 110 | t.datetime "last_sign_in_at" 111 | t.inet "current_sign_in_ip" 112 | t.inet "last_sign_in_ip" 113 | t.datetime "created_at", null: false 114 | t.datetime "updated_at", null: false 115 | t.index ["email"], name: "index_users_on_email", unique: true 116 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true 117 | end 118 | 119 | add_foreign_key "favorites", "users" 120 | add_foreign_key "movies", "categories" 121 | add_foreign_key "movies", "series", column: "serie_id" 122 | add_foreign_key "players", "movies" 123 | add_foreign_key "players", "users" 124 | add_foreign_key "reviews", "users" 125 | add_foreign_key "series", "categories" 126 | add_foreign_key "series", "movies", column: "last_watched_episode_id" 127 | end 128 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | ## Customize de acordo com os videos e thumbnails de exemplo que você subir para o seu servidor 2 | 3 | # Categories 4 | ror = Category.create(name: 'Ruby On Rails') 5 | talks = Category.create(name: 'Talks') 6 | testes = Category.create(name: 'Testes') 7 | outros = Category.create(name: 'Outros') 8 | 9 | # Featured Movie 10 | movie1 = Movie.create(title: "Ruby On Rails Api do zero ao Deploy", description: "Aprenda a criar uma API completa com Ruby On Rails...", thumbnail_key: "rails-api1.png", thumbnail_cover_key: "rails-api-cover.png", video_key: "rails-api1.mp4", highlighted: true, category: ror, featured_thumbnail_key: "rails-api-featured.png") 11 | 12 | # Users 13 | user1 = User.create(name: 'example', email: 'example@example.com', password: '123456', password_confirmation: '123456') 14 | user2 = User.create(name: 'example2', email: 'example2@example.com', password: '123456', password_confirmation: '123456') 15 | user3 = User.create(name: 'example3', email: 'example3@example.com', password: '123456', password_confirmation: '123456') 16 | user4 = User.create(name: 'example4', email: 'example4@example.com', password: '123456', password_confirmation: '123456') 17 | user5 = User.create(name: 'example5', email: 'example5@example.com', password: '123456', password_confirmation: '123456') 18 | 19 | # Movies sem série 20 | movie2 = Movie.create(title: "Crie generators no Ruby On Rails", description: "Generators são uma maneira de você automatizar a criação de conjuntos de arquivos no seu APP (assim como o rails new, o rails generate controller, o rails generate scaffold e etc), e nesse Screencast nós vamos aprender como cria-los..", thumbnail_key: "generators.png", thumbnail_cover_key: "generators-cover.png", video_key: "generators.mp4", category: ror) 21 | movie3 = Movie.create(title: "Dominando o uso de Jobs no RoR - Parte 1", description: "s Jobs são uma maneira fácil de você rodar processos demorados em background (evitando lentidão na hora de responder as requisições do usuário e tornando seu sistema mais fluido).", thumbnail_key: "jobs1.png", thumbnail_cover_key: "jobs1-cover.png", video_key: "jobs1.mp4", category: ror) 22 | movie4 = Movie.create(title: "Dominando o uso de Jobs no RoR - Parte 2", description: "s Jobs são uma maneira fácil de você rodar processos demorados em background (evitando lentidão na hora de responder as requisições do usuário e tornando seu sistema mais fluido).", thumbnail_key: "jobs2.png", thumbnail_cover_key: "jobs2-cover.png", video_key: "jobs2.mp4", category: ror) 23 | movie5 = Movie.create(title: "Instalando pacotes no Rails com Yarn", description: "O Yarn é um gerenciador de pacotes javascript rápido, seguro e confiável que foi integrado no rails >= 5.1 para facilitar ainda mais a gestão das dependências. (agora você usa o Bundler para bibliotecas ruby e o Yarn para bibliotecas javascript, simples assim)", thumbnail_key: "materialize.png", thumbnail_cover_key: "materialize-cover.png", video_key: "materialize.mp4", category: ror) 24 | 25 | movie5 = Movie.create(title: "Como monitorar seu APP em produção", description: "Hoje vamos falar de um tema muito interessante quando precisamos lidar com a verificação da saúde do nosso ambiente de produção: a instrumentação.", thumbnail_key: "obt18.png", thumbnail_cover_key: "obt18-cover.png", video_key: "obt18.mp4", category: outros) 26 | movie6 = Movie.create(title: "Desmistificando a Criação de APIs", description: "Desmistificando a Criação de APIs Desmistificando a Criação de APIs Desmistificando a Criação de APIs Desmistificando a Criação de APIs", thumbnail_key: "obt17.png", thumbnail_cover_key: "obt17-cover.png", video_key: "obt17.mp4", category: outros) 27 | movie7 = Movie.create(title: "Dominando o Visual Studio Code - Parte 1", description: "O Visual Studio Code é um editor de texto Open Source completo que possui integração nativa com o Git, milhares de extensões, é rápido e permite que você realize o debug facilmente do seu código.", thumbnail_key: "vscode1.png", thumbnail_cover_key: "vscode1-cover.png", video_key: "vscode1.mp4", category: outros) 28 | movie8 = Movie.create(title: "Dominando o Visual Studio Code - Parte 1", description: "O Visual Studio Code é um editor de texto Open Source completo que possui integração nativa com o Git, milhares de extensões, é rápido e permite que você realize o debug facilmente do seu código.", thumbnail_key: "vscode2.png", thumbnail_cover_key: "vscode2-cover.png", video_key: "vscode2.mp4", category: outros) 29 | movie9 = Movie.create(title: "Dominando o Visual Studio Code - Parte 1", description: "O Visual Studio Code é um editor de texto Open Source completo que possui integração nativa com o Git, milhares de extensões, é rápido e permite que você realize o debug facilmente do seu código.", thumbnail_key: "vscode3.png", thumbnail_cover_key: "vscode3-cover.png", video_key: "vscode3.mp4", category: outros) 30 | 31 | 32 | # Series 33 | vscode = Serie.create(title: 'Visual Studio Code', description: 'Uma série completa para você dominar um dos mais importantes editores de texto', thumbnail_key: "vscode1.png", thumbnail_cover_key: "vscode-serie-cover.png", category: outros) 34 | movie10 = Movie.create(title: "Dominando o Visual Studio Code - Parte 1", description: "O Visual Studio Code é um editor de texto Open Source completo que possui integração nativa com o Git, milhares de extensões, é rápido e permite que você realize o debug facilmente do seu código.", thumbnail_key: "vscode1.png", thumbnail_cover_key: "vscode1-cover.png", video_key: "vscode1.mp4", serie: vscode, episode_number: 1) 35 | movie11 = Movie.create(title: "Dominando o Visual Studio Code - Parte 2", description: "O Visual Studio Code é um editor de texto Open Source completo que possui integração nativa com o Git, milhares de extensões, é rápido e permite que você realize o debug facilmente do seu código.", thumbnail_key: "vscode2.png", thumbnail_cover_key: "vscode2-cover.png", video_key: "vscode2.mp4", serie: vscode, episode_number: 2) 36 | movie12 = Movie.create(title: "Dominando o Visual Studio Code - Parte 3", description: "O Visual Studio Code é um editor de texto Open Source completo que possui integração nativa com o Git, milhares de extensões, é rápido e permite que você realize o debug facilmente do seu código.", thumbnail_key: "vscode3.png", thumbnail_cover_key: "vscode3-cover.png", video_key: "vscode3.mp4", serie: vscode, episode_number: 3) 37 | 38 | # Keep Wathching 39 | Player.create(start_date: Time.now, user: user1, elapsed_time: 10, movie: movie1) 40 | Player.create(start_date: Time.now, user: user1, elapsed_time: 20, movie: movie2) 41 | Player.create(start_date: Time.now, user: user1, elapsed_time: 30, movie: movie3) 42 | Player.create(start_date: Time.now, user: user1, elapsed_time: 40, movie: movie4) 43 | Player.create(start_date: Time.now, user: user1, elapsed_time: 50, movie: movie5) 44 | 45 | # Reviews 46 | Review.create(rating: 3, description: 'I have always depended on the kindness of strangers.', reviewable: movie2, user: user1) 47 | Review.create(rating: 2, description: 'Help me, Obi-Wan Kenobi. Youre my only hope. ', reviewable:movie2, user: user2) 48 | Review.create(rating: 5, description: 'Every time a bell rings, an angel gets his wings. ', reviewable:movie2, user: user3) 49 | Review.create(rating: 3, description: 'Magic Mirror on the wall, who is the fairest one of all?', reviewable: movie2, user: user4) 50 | Review.create(rating: 5, description: 'Just when I thought I was out, they pull me back in.', reviewable: movie2, user: user5) 51 | 52 | 53 | # Favorites 54 | Favorite.create(favoritable: Movie.all[0], user: user1) 55 | Favorite.create(favoritable: Movie.all[1], user: user1) 56 | Favorite.create(favoritable: Movie.all[2], user: user1) 57 | Favorite.create(favoritable: Movie.all[3], user: user1) 58 | Favorite.create(favoritable: Movie.all[4], user: user1) -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/lib/tasks/.keep -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "onebitflix", 3 | "private": true, 4 | "dependencies": { 5 | "@rails/webpacker": "3.5", 6 | "axios": "^0.18.0", 7 | "jquery": "^3.3.1", 8 | "material-design-icons-iconfont": "^3.0.3", 9 | "vue": "^2.5.16", 10 | "vue-dplayer": "^0.0.9", 11 | "vue-loader": "14.2.2", 12 | "vue-rate-it": "^2.1.0", 13 | "vue-router": "^3.0.1", 14 | "vue-slick": "^1.1.12", 15 | "vue-template-compiler": "^2.5.16", 16 | "vuetify": "^1.0.18", 17 | "vuex": "^3.0.1" 18 | }, 19 | "devDependencies": { 20 | "webpack-dev-server": "2.11.2" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /test/application_system_test_case.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase 4 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400] 5 | end 6 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/api/v1/dashboards_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Api::V1::DashboardsControllerTest < ActionDispatch::IntegrationTest 4 | test "should get index" do 5 | get api_v1_dashboards_index_url 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /test/controllers/api/v1/executions_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Api::V1::ExecutionsControllerTest < ActionDispatch::IntegrationTest 4 | test "should get create" do 5 | get api_v1_executions_create_url 6 | assert_response :success 7 | end 8 | 9 | test "should get update" do 10 | get api_v1_executions_update_url 11 | assert_response :success 12 | end 13 | 14 | end 15 | -------------------------------------------------------------------------------- /test/controllers/api/v1/favorites_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Api::V1::FavoritesControllerTest < ActionDispatch::IntegrationTest 4 | test "should get index" do 5 | get api_v1_favorites_index_url 6 | assert_response :success 7 | end 8 | 9 | test "should get create" do 10 | get api_v1_favorites_create_url 11 | assert_response :success 12 | end 13 | 14 | test "should get destroy" do 15 | get api_v1_favorites_destroy_url 16 | assert_response :success 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /test/controllers/api/v1/movies_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Api::V1::MoviesControllerTest < ActionDispatch::IntegrationTest 4 | test "should get show" do 5 | get api_v1_movies_show_url 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /test/controllers/api/v1/recommendations_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Api::V1::RecommendationsControllerTest < ActionDispatch::IntegrationTest 4 | test "should get index" do 5 | get api_v1_recommendations_index_url 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /test/controllers/api/v1/reviews_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Api::V1::ReviewsControllerTest < ActionDispatch::IntegrationTest 4 | test "should get index" do 5 | get api_v1_reviews_index_url 6 | assert_response :success 7 | end 8 | 9 | test "should get create" do 10 | get api_v1_reviews_create_url 11 | assert_response :success 12 | end 13 | 14 | end 15 | -------------------------------------------------------------------------------- /test/controllers/api/v1/searches_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Api::V1::SearchesControllerTest < ActionDispatch::IntegrationTest 4 | test "should get index" do 5 | get api_v1_searches_index_url 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /test/controllers/api/v1/series_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Api::V1::SeriesControllerTest < ActionDispatch::IntegrationTest 4 | test "should get show" do 5 | get api_v1_series_show_url 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /test/controllers/home_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class HomeControllerTest < ActionDispatch::IntegrationTest 4 | test "should get index" do 5 | get home_index_url 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/categories.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | name: MyString 5 | 6 | two: 7 | name: MyString 8 | -------------------------------------------------------------------------------- /test/fixtures/favorites.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | favoritable: one 5 | favoritable_type: Favoritable 6 | user: one 7 | 8 | two: 9 | favoritable: two 10 | favoritable_type: Favoritable 11 | user: two 12 | -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/test/fixtures/files/.keep -------------------------------------------------------------------------------- /test/fixtures/movies.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | title: MyString 5 | description: MyText 6 | thumbnail_key: MyString 7 | video_key: MyString 8 | episode_number: 1 9 | featured_thumbnail_key: MyString 10 | serie: one 11 | category: one 12 | thumbnail_cover_key: MyString 13 | 14 | two: 15 | title: MyString 16 | description: MyText 17 | thumbnail_key: MyString 18 | video_key: MyString 19 | episode_number: 1 20 | featured_thumbnail_key: MyString 21 | serie: two 22 | category: two 23 | thumbnail_cover_key: MyString 24 | -------------------------------------------------------------------------------- /test/fixtures/players.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | start_date: 2018-05-19 14:37:55 5 | end_date: 2018-05-19 14:37:55 6 | elapsed_time: 2018-05-19 14:37:55 7 | movie: one 8 | user: one 9 | 10 | two: 11 | start_date: 2018-05-19 14:37:55 12 | end_date: 2018-05-19 14:37:55 13 | elapsed_time: 2018-05-19 14:37:55 14 | movie: two 15 | user: two 16 | -------------------------------------------------------------------------------- /test/fixtures/reviews.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | rating: 1 5 | description: MyText 6 | reviewable: one 7 | reviewable_type: Reviewable 8 | user: one 9 | 10 | two: 11 | rating: 1 12 | description: MyText 13 | reviewable: two 14 | reviewable_type: Reviewable 15 | user: two 16 | -------------------------------------------------------------------------------- /test/fixtures/series.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | title: MyString 5 | description: MyText 6 | thumbnail_key: MyString 7 | category: one 8 | featured_thumbnail_key: MyString 9 | thumbnail_cover_key: MyString 10 | 11 | two: 12 | title: MyString 13 | description: MyText 14 | thumbnail_key: MyString 15 | category: two 16 | featured_thumbnail_key: MyString 17 | thumbnail_cover_key: MyString 18 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | # This model initially had no columns defined. If you add columns to the 4 | # model remove the '{}' from the fixture names and add the columns immediately 5 | # below each fixture, per the syntax in the comments below 6 | # 7 | one: {} 8 | # column: value 9 | # 10 | two: {} 11 | # column: value 12 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/test/models/.keep -------------------------------------------------------------------------------- /test/models/category_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CategoryTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/favorite_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class FavoriteTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/movie_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class MovieTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/player_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PlayerTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/review_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ReviewTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/serie_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class SerieTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/user_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UserTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/system/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/test/system/.keep -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require_relative '../config/environment' 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/tmp/.keep -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneBitCodeBlog/onebitflix/e6dac387b21ebfe4341c2e0735af88c2f17a50e6/vendor/.keep --------------------------------------------------------------------------------