├── .gitignore ├── .rspec ├── .rubocop.yml ├── .ruby-version ├── .stickler.yml ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Procfile ├── Procfile.dev ├── README.md ├── Rakefile ├── app ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── api │ │ └── v1 │ │ │ ├── event_followers_controller.rb │ │ │ └── events_controller.rb │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ ├── user_token_controller.rb │ └── users_controller.rb ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── application_record.rb │ ├── concerns │ │ └── .keep │ ├── event.rb │ ├── event_follower.rb │ └── user.rb ├── serializers │ ├── event_follower_serializer.rb │ ├── event_serializer.rb │ └── user_serializer.rb └── views │ └── layouts │ ├── mailer.html.erb │ └── mailer.text.erb ├── bin ├── bundle ├── rails ├── rake ├── setup └── spring ├── client ├── .eslintrc.json ├── .gitignore ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt ├── src │ ├── App.js │ ├── App.scss │ ├── components │ │ ├── Event.js │ │ ├── Event.scss │ │ ├── EventDescription.js │ │ ├── EventDescription.scss │ │ ├── EventsContainer.js │ │ ├── EventsContainer.scss │ │ ├── EventsList.js │ │ ├── Login.js │ │ ├── Login.scss │ │ ├── Logout.js │ │ ├── MyEventsContainer.js │ │ ├── NotFound.js │ │ └── SignUp.js │ ├── index.js │ └── redux │ │ ├── actions │ │ ├── actionTypes.js │ │ ├── authActions.js │ │ ├── eventActions.js │ │ └── followActions.js │ │ ├── reducers │ │ ├── authReducer.js │ │ ├── eventsReducer.js │ │ ├── followReducer.js │ │ └── rootReducer.js │ │ └── store.js └── yarn.lock ├── config.ru ├── config ├── application.rb ├── application.yml ├── boot.rb ├── cable.yml ├── credentials.yml.enc ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── application_controller_renderer.rb │ ├── backtrace_silencers.rb │ ├── cors.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── knock.rb │ ├── mime_types.rb │ ├── time_as_json.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── puma.rb ├── routes.rb ├── spring.rb └── storage.yml ├── db ├── migrate │ ├── 20200120200544_create_users.rb │ ├── 20200120200904_create_events.rb │ ├── 20200120203113_create_event_followers.rb │ └── 20200126201844_add_password_to_user.rb ├── schema.rb └── seeds.rb ├── lib ├── Events_Scheduler_Screenshot.png └── tasks │ └── .keep ├── log └── .keep ├── package.json ├── public └── robots.txt ├── spec ├── controllers │ ├── api │ │ └── v1 │ │ │ ├── event_followers_controller_spec.rb │ │ │ └── events_controller_spec.rb │ └── users_controller_spec.rb ├── factories │ ├── event_followers.rb │ ├── events.rb │ └── users.rb ├── models │ ├── event_follower_spec.rb │ ├── event_spec.rb │ └── user_spec.rb ├── rails_helper.rb └── spec_helper.rb ├── storage └── .keep ├── tmp └── .keep ├── vendor └── .keep └── yarn.lock /.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 | !/storage/.keep 19 | .byebug_history 20 | 21 | # Ignore master key for decrypting credentials and more. 22 | /config/master.key 23 | 24 | .idea 25 | Guardfile 26 | node_modules 27 | 28 | .envrc 29 | 30 | # Ignore application configuration 31 | /config/application.yml 32 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --require spec_helper 2 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Exclude: 3 | - "db/**/*" 4 | - "bin/*" 5 | - "config/**/*" 6 | - "Guardfile" 7 | - "Rakefile" 8 | - "README.md" 9 | - "node_modules/**/*" 10 | 11 | DisplayCopNames: true 12 | 13 | Layout/LineLength: 14 | Max: 120 15 | Metrics/MethodLength: 16 | Include: 17 | - "app/controllers/*" 18 | - "app/models/*" 19 | Max: 20 20 | Metrics/AbcSize: 21 | Include: 22 | - "app/controllers/*" 23 | - "app/models/*" 24 | Max: 50 25 | Metrics/ClassLength: 26 | Max: 150 27 | Metrics/BlockLength: 28 | ExcludedMethods: ['describe'] 29 | Max: 30 30 | 31 | Style/Documentation: 32 | Enabled: false 33 | Style/ClassAndModuleChildren: 34 | Enabled: false 35 | Style/EachForSimpleLoop: 36 | Enabled: false 37 | Style/AndOr: 38 | Enabled: false 39 | Style/DefWithParentheses: 40 | Enabled: false 41 | Style/FrozenStringLiteralComment: 42 | EnforcedStyle: never 43 | 44 | Layout/HashAlignment: 45 | EnforcedColonStyle: key 46 | Layout/ExtraSpacing: 47 | AllowForAlignment: false 48 | Layout/MultilineMethodCallIndentation: 49 | Enabled: true 50 | EnforcedStyle: indented -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.6.5 2 | -------------------------------------------------------------------------------- /.stickler.yml: -------------------------------------------------------------------------------- 1 | # add the linters you want stickler to use for this project 2 | linters: 3 | eslint: 4 | config: './client/.eslintrc.json' 5 | 6 | rubocop: 7 | display_cop_names: true 8 | config: './rubocop.yml' 9 | 10 | files: 11 | ignore: 12 | - "bin/*" 13 | - "db/*" 14 | - "config/*" 15 | - "Guardfile" 16 | - "Rakefile" 17 | - "README.md" 18 | - "node_modules/**/*" -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | ruby '2.6.5' 5 | 6 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 7 | gem 'rails', '~> 6.0.2', '>= 6.0.2.1' 8 | # Use postgresql as the database for Active Record 9 | gem 'pg', '>= 0.18', '< 2.0' 10 | # Use Puma as the app server 11 | gem 'puma', '~> 4.3' 12 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 13 | # gem 'jbuilder', '~> 2.7' 14 | # Use Redis adapter to run Action Cable in production 15 | # gem 'redis', '~> 4.0' 16 | # Use Active Model has_secure_password 17 | # gem 'bcrypt', '~> 3.1.7' 18 | 19 | # Use Active Storage variant 20 | # gem 'image_processing', '~> 1.2' 21 | 22 | # Reduces boot times through caching; required in config/boot.rb 23 | gem 'bootsnap', '>= 1.4.2', require: false 24 | 25 | # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible 26 | gem 'rack-cors' 27 | 28 | # Gem Figaro 29 | gem 'figaro' 30 | 31 | # Devise 32 | gem 'active_model_serializers' 33 | gem 'bcrypt' 34 | gem 'jwt' 35 | gem 'knock' 36 | 37 | group :development, :test do 38 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 39 | gem 'byebug', platforms: %i[mri mingw x64_mingw] 40 | gem 'factory_bot_rails' 41 | gem 'guard-rspec', require: false 42 | gem 'rspec-rails', '~> 3.4', '>= 3.4.2' 43 | end 44 | 45 | group :development do 46 | gem 'listen', '>= 3.0.5', '< 3.2' 47 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 48 | gem 'spring' 49 | gem 'spring-watcher-listen', '~> 2.0.0' 50 | end 51 | 52 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 53 | gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] 54 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (6.0.2.1) 5 | actionpack (= 6.0.2.1) 6 | nio4r (~> 2.0) 7 | websocket-driver (>= 0.6.1) 8 | actionmailbox (6.0.2.1) 9 | actionpack (= 6.0.2.1) 10 | activejob (= 6.0.2.1) 11 | activerecord (= 6.0.2.1) 12 | activestorage (= 6.0.2.1) 13 | activesupport (= 6.0.2.1) 14 | mail (>= 2.7.1) 15 | actionmailer (6.0.2.1) 16 | actionpack (= 6.0.2.1) 17 | actionview (= 6.0.2.1) 18 | activejob (= 6.0.2.1) 19 | mail (~> 2.5, >= 2.5.4) 20 | rails-dom-testing (~> 2.0) 21 | actionpack (6.0.2.1) 22 | actionview (= 6.0.2.1) 23 | activesupport (= 6.0.2.1) 24 | rack (~> 2.0, >= 2.0.8) 25 | rack-test (>= 0.6.3) 26 | rails-dom-testing (~> 2.0) 27 | rails-html-sanitizer (~> 1.0, >= 1.2.0) 28 | actiontext (6.0.2.1) 29 | actionpack (= 6.0.2.1) 30 | activerecord (= 6.0.2.1) 31 | activestorage (= 6.0.2.1) 32 | activesupport (= 6.0.2.1) 33 | nokogiri (>= 1.8.5) 34 | actionview (6.0.2.1) 35 | activesupport (= 6.0.2.1) 36 | builder (~> 3.1) 37 | erubi (~> 1.4) 38 | rails-dom-testing (~> 2.0) 39 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 40 | active_model_serializers (0.10.10) 41 | actionpack (>= 4.1, < 6.1) 42 | activemodel (>= 4.1, < 6.1) 43 | case_transform (>= 0.2) 44 | jsonapi-renderer (>= 0.1.1.beta1, < 0.3) 45 | activejob (6.0.2.1) 46 | activesupport (= 6.0.2.1) 47 | globalid (>= 0.3.6) 48 | activemodel (6.0.2.1) 49 | activesupport (= 6.0.2.1) 50 | activerecord (6.0.2.1) 51 | activemodel (= 6.0.2.1) 52 | activesupport (= 6.0.2.1) 53 | activestorage (6.0.2.1) 54 | actionpack (= 6.0.2.1) 55 | activejob (= 6.0.2.1) 56 | activerecord (= 6.0.2.1) 57 | marcel (~> 0.3.1) 58 | activesupport (6.0.2.1) 59 | concurrent-ruby (~> 1.0, >= 1.0.2) 60 | i18n (>= 0.7, < 2) 61 | minitest (~> 5.1) 62 | tzinfo (~> 1.1) 63 | zeitwerk (~> 2.2) 64 | bcrypt (3.1.13) 65 | bootsnap (1.4.6) 66 | msgpack (~> 1.0) 67 | builder (3.2.4) 68 | byebug (11.1.1) 69 | case_transform (0.2) 70 | activesupport 71 | coderay (1.1.2) 72 | concurrent-ruby (1.1.6) 73 | crass (1.0.6) 74 | diff-lcs (1.3) 75 | erubi (1.9.0) 76 | factory_bot (5.1.1) 77 | activesupport (>= 4.2.0) 78 | factory_bot_rails (5.1.1) 79 | factory_bot (~> 5.1.0) 80 | railties (>= 4.2.0) 81 | ffi (1.12.2) 82 | figaro (1.1.1) 83 | thor (~> 0.14) 84 | formatador (0.2.5) 85 | globalid (0.4.2) 86 | activesupport (>= 4.2.0) 87 | guard (2.16.1) 88 | formatador (>= 0.2.4) 89 | listen (>= 2.7, < 4.0) 90 | lumberjack (>= 1.0.12, < 2.0) 91 | nenv (~> 0.1) 92 | notiffany (~> 0.0) 93 | pry (>= 0.9.12) 94 | shellany (~> 0.0) 95 | thor (>= 0.18.1) 96 | guard-compat (1.2.1) 97 | guard-rspec (4.7.3) 98 | guard (~> 2.1) 99 | guard-compat (~> 1.1) 100 | rspec (>= 2.99.0, < 4.0) 101 | i18n (1.8.2) 102 | concurrent-ruby (~> 1.0) 103 | jsonapi-renderer (0.2.2) 104 | jwt (1.5.6) 105 | knock (2.1.1) 106 | bcrypt (~> 3.1) 107 | jwt (~> 1.5) 108 | rails (>= 4.2) 109 | listen (3.1.5) 110 | rb-fsevent (~> 0.9, >= 0.9.4) 111 | rb-inotify (~> 0.9, >= 0.9.7) 112 | ruby_dep (~> 1.2) 113 | loofah (2.4.0) 114 | crass (~> 1.0.2) 115 | nokogiri (>= 1.5.9) 116 | lumberjack (1.2.4) 117 | mail (2.7.1) 118 | mini_mime (>= 0.1.1) 119 | marcel (0.3.3) 120 | mimemagic (~> 0.3.2) 121 | method_source (0.9.2) 122 | mimemagic (0.3.4) 123 | mini_mime (1.0.2) 124 | mini_portile2 (2.4.0) 125 | minitest (5.14.0) 126 | msgpack (1.3.3) 127 | nenv (0.3.0) 128 | nio4r (2.5.2) 129 | nokogiri (1.10.9) 130 | mini_portile2 (~> 2.4.0) 131 | notiffany (0.1.3) 132 | nenv (~> 0.1) 133 | shellany (~> 0.0) 134 | pg (1.2.3) 135 | pry (0.12.2) 136 | coderay (~> 1.1.0) 137 | method_source (~> 0.9.0) 138 | puma (4.3.5) 139 | nio4r (~> 2.0) 140 | rack (2.2.3) 141 | rack-cors (1.1.1) 142 | rack (>= 2.0.0) 143 | rack-test (1.1.0) 144 | rack (>= 1.0, < 3) 145 | rails (6.0.2.1) 146 | actioncable (= 6.0.2.1) 147 | actionmailbox (= 6.0.2.1) 148 | actionmailer (= 6.0.2.1) 149 | actionpack (= 6.0.2.1) 150 | actiontext (= 6.0.2.1) 151 | actionview (= 6.0.2.1) 152 | activejob (= 6.0.2.1) 153 | activemodel (= 6.0.2.1) 154 | activerecord (= 6.0.2.1) 155 | activestorage (= 6.0.2.1) 156 | activesupport (= 6.0.2.1) 157 | bundler (>= 1.3.0) 158 | railties (= 6.0.2.1) 159 | sprockets-rails (>= 2.0.0) 160 | rails-dom-testing (2.0.3) 161 | activesupport (>= 4.2.0) 162 | nokogiri (>= 1.6) 163 | rails-html-sanitizer (1.3.0) 164 | loofah (~> 2.3) 165 | railties (6.0.2.1) 166 | actionpack (= 6.0.2.1) 167 | activesupport (= 6.0.2.1) 168 | method_source 169 | rake (>= 0.8.7) 170 | thor (>= 0.20.3, < 2.0) 171 | rake (13.0.1) 172 | rb-fsevent (0.10.3) 173 | rb-inotify (0.10.1) 174 | ffi (~> 1.0) 175 | rspec (3.9.0) 176 | rspec-core (~> 3.9.0) 177 | rspec-expectations (~> 3.9.0) 178 | rspec-mocks (~> 3.9.0) 179 | rspec-core (3.9.1) 180 | rspec-support (~> 3.9.1) 181 | rspec-expectations (3.9.1) 182 | diff-lcs (>= 1.2.0, < 2.0) 183 | rspec-support (~> 3.9.0) 184 | rspec-mocks (3.9.1) 185 | diff-lcs (>= 1.2.0, < 2.0) 186 | rspec-support (~> 3.9.0) 187 | rspec-rails (3.9.1) 188 | actionpack (>= 3.0) 189 | activesupport (>= 3.0) 190 | railties (>= 3.0) 191 | rspec-core (~> 3.9.0) 192 | rspec-expectations (~> 3.9.0) 193 | rspec-mocks (~> 3.9.0) 194 | rspec-support (~> 3.9.0) 195 | rspec-support (3.9.2) 196 | ruby_dep (1.5.0) 197 | shellany (0.0.1) 198 | spring (2.1.0) 199 | spring-watcher-listen (2.0.1) 200 | listen (>= 2.7, < 4.0) 201 | spring (>= 1.2, < 3.0) 202 | sprockets (4.0.0) 203 | concurrent-ruby (~> 1.0) 204 | rack (> 1, < 3) 205 | sprockets-rails (3.2.1) 206 | actionpack (>= 4.0) 207 | activesupport (>= 4.0) 208 | sprockets (>= 3.0.0) 209 | thor (0.20.3) 210 | thread_safe (0.3.6) 211 | tzinfo (1.2.6) 212 | thread_safe (~> 0.1) 213 | websocket-driver (0.7.1) 214 | websocket-extensions (>= 0.1.0) 215 | websocket-extensions (0.1.5) 216 | zeitwerk (2.3.0) 217 | 218 | PLATFORMS 219 | ruby 220 | 221 | DEPENDENCIES 222 | active_model_serializers 223 | bcrypt 224 | bootsnap (>= 1.4.2) 225 | byebug 226 | factory_bot_rails 227 | figaro 228 | guard-rspec 229 | jwt 230 | knock 231 | listen (>= 3.0.5, < 3.2) 232 | pg (>= 0.18, < 2.0) 233 | puma (~> 4.3) 234 | rack-cors 235 | rails (~> 6.0.2, >= 6.0.2.1) 236 | rspec-rails (~> 3.4, >= 3.4.2) 237 | spring 238 | spring-watcher-listen (~> 2.0.0) 239 | tzinfo-data 240 | 241 | RUBY VERSION 242 | ruby 2.6.5p114 243 | 244 | BUNDLED WITH 245 | 1.17.2 246 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 AndresFMoya 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec rails s 2 | release: bin/rake db:migrate -------------------------------------------------------------------------------- /Procfile.dev: -------------------------------------------------------------------------------- 1 | web: PORT=3000 yarn --cwd client start 2 | api: PORT=3001 rails s 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |

Rails API, React & Redux - Event Scheduler

3 |

4 |
5 |

6 | 7 | ruby version 8 | 9 | 10 | rails version 11 | 12 |

13 | 14 | This project consist of building a mobile web app for an Events Scheduler using Rails API as backend, and ReactJS as frontend. 15 | 16 | [![Events Scheduler Video](https://img.youtube.com/vi/YYvNv9WAFgM/0.jpg)](https://www.youtube.com/watch?v=YYvNv9WAFgM) 17 | 18 | In this project, we will build a Web App with the following technologies: 19 | - API 20 | - Ruby on Rails 21 | - PostgreSQL 22 | 23 | - Frontend (Inside /client folder) 24 | - React 25 | - Redux 26 | 27 | ## Technologies used 28 | 29 | - Ruby on Rails 30 | - RSpec 31 | - PostgreSQL 32 | - ReactJS 33 | - Redux 34 | - Git 35 | - Bootstrap 36 | - HTML & CSS 37 | - Heroku 38 | 39 | ## Live Version 40 | [Events Scheduler Web App](https://rocky-reef-66767.herokuapp.com) 41 | 42 | ## Prerequisites 43 | 44 | - [Ruby](https://www.ruby-lang.org/en/): we recommend using 45 | [rbenv](https://github.com/rbenv/rbenv) to install the Ruby version listed on 46 | the badge. 47 | - [Yarn](https://yarnpkg.com/): please refer to their 48 | [installation guide](https://yarnpkg.com/en/docs/install). 49 | - [PostgreSQL](https://www.postgresql.org/) 11.5 or higher. 50 | 51 | ## Installation 52 | - To get started with the app, first clone the repo and `cd` into the directory: 53 | 54 | ``` 55 | $ git clone https://github.com/AndresFMoya/react-rails_event_scheduler.git 56 | $ cd react-rails_event_scheduler 57 | ``` 58 | - You need to install the gems: 59 | - You may need to first run `bundle install` if you have older gems in your environment from previous Rails work. If you get an error message like `Your Ruby version is 2.x.x, but your Gemfile specified 2.4.4` then you need to install the ruby version 2.6.4 using `rvm` or `rbenv`. 60 | - Using **rvm**: `rvm install 2.6.4` followed by `rvm use 2.6.4` 61 | - Using **rbenv**: `rbenv install 2.6.4` followed by `rbenv local 2.6.4` 62 | - Install gems with `bundle install --without production` from the rails root folder, to install the gems you'll need, excluding those needed only in production. 63 | - Run `rails db:create` followed by `rails db:migrate` to set up the database 64 | - Install static assets (like external javascript libraries, fonts) with `yarn install` 65 | - To launch the app locally run: `heroku local -f Procfile.dev`. 66 | 67 | ## 🤝 Contributing 68 | 69 | Contributions, issues and feature requests are welcome! Feel free to check [issues page](https://github.com/AndresFMoya/react-rails_event_scheduler/issues). 70 | 71 | 1. Fork it (https://github.com/AndresFMoya/react-rails_event_scheduler/fork) 72 | 2. Create your working branch (git checkout -b [choose-a-name]) 73 | 3. Commit your changes (git commit -am 'what this commit will fix/add/improve') 74 | 4. Push to the branch (git push origin [chosen-name]) 75 | 5. Create a new pull request 76 | 77 | 78 | ## Contributors 79 | 80 | Andrés Moya - [GitHub](https://github.com/andresfmoya) 81 | 82 | ## Show your support 83 | 84 | Give a ⭐️ if you like this project! 85 | 86 | ## License 87 | 88 | This project is [MIT](https://github.com/AndresFMoya/react-rails_event_scheduler/blob/develop/LICENSE) licensed. 89 | 90 | ## 📞 Get in Touch! 91 | I will love to hear about you at one of the following places! :heart: 92 | 93 | - [LinkedIn](https://www.linkedin.com/in/andres-f-moya/) 94 | - [Twitter](https://www.twitter.com/andmedev/) 95 | - . 96 | 97 |

98 | 99 | andresmoya.me 100 | 101 |

102 | -------------------------------------------------------------------------------- /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/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/event_followers_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::EventFollowersController < ApplicationController 2 | before_action :find_event, only: [:destroy] 3 | before_action :authenticate_user 4 | 5 | def create 6 | @event_follower = current_user.event_followers.build(event_follower_params) 7 | if @event_follower&.save 8 | render json: @event_follower 9 | else 10 | render json: { message: @event_follower.errors }, status: 400 11 | end 12 | end 13 | 14 | def destroy 15 | if @event_follower.destroy 16 | render json: @event_follower 17 | else 18 | render json: { message: 'Unable to remove item' }, status: 400 19 | end 20 | end 21 | 22 | def find_event 23 | @event_follower = current_user.event_followers.find_by(event_follower_params) 24 | end 25 | 26 | def event_follower_params 27 | params.require(:event_follower).permit(:event_id) 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /app/controllers/api/v1/events_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::EventsController < ApplicationController 2 | def index 3 | events = Event.all 4 | render json: events 5 | end 6 | 7 | def show 8 | event = Event.find(params[:id]) 9 | render json: event 10 | end 11 | 12 | def create 13 | event = Event.create(event_params) 14 | render json: event 15 | end 16 | 17 | def update 18 | event = Event.find(params[:id]) 19 | event.update_attributes(event_params) 20 | render json: event 21 | end 22 | 23 | def destroy 24 | event = Event.find(params[:id]) 25 | event.destroy 26 | head :no_content, status: :ok 27 | end 28 | 29 | private 30 | 31 | def event_params 32 | params.require(:event).permit(:title, :description, :date_start, :date_end, :status, :city) 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::API 2 | include Knock::Authenticable 3 | def fallback_index_html 4 | render file: 'public/index.html' 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/user_token_controller.rb: -------------------------------------------------------------------------------- 1 | class UserTokenController < Knock::AuthTokenController 2 | skip_before_action :verify_authenticity_token 3 | 4 | private 5 | 6 | def auth_params 7 | params.require(:auth).permit(:username, :password, :email) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | def find 3 | @user = User.find_by(username: params[:user][:username]) 4 | if @user 5 | render json: @user 6 | else 7 | @errors = @user.errors.full_messages 8 | render json: @errors 9 | end 10 | end 11 | 12 | def create 13 | @user = User.new(user_params) 14 | if @user.valid? && @user.save 15 | render json: @user 16 | else 17 | render json: @user.errors, status: 400 18 | end 19 | end 20 | 21 | def find_events 22 | @user = User.find_by(username: params[:user][:username]) 23 | render json: @user.event_followers 24 | end 25 | 26 | private 27 | 28 | def user_params 29 | params.require(:user).permit(:username, :email, :password) 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | # Automatically retry jobs that encountered a deadlock 3 | # retry_on ActiveRecord::Deadlocked 4 | 5 | # Most jobs are safe to ignore if the underlying records are no longer available 6 | # discard_on ActiveJob::DeserializationError 7 | end 8 | -------------------------------------------------------------------------------- /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/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/event.rb: -------------------------------------------------------------------------------- 1 | class Event < ApplicationRecord 2 | has_many :event_followers, dependent: :destroy 3 | has_many :users, through: :event_followers 4 | validates_presence_of :title, :description, :date_start, :date_end, :status, :city 5 | validates :title, uniqueness: { scope: %i[description city date_start date_end] } 6 | end 7 | -------------------------------------------------------------------------------- /app/models/event_follower.rb: -------------------------------------------------------------------------------- 1 | class EventFollower < ApplicationRecord 2 | belongs_to :event 3 | belongs_to :user 4 | end 5 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | has_secure_password 3 | validates :username, presence: true, length: { minimum: 4, maximum: 20 }, uniqueness: true 4 | validates :email, uniqueness: true 5 | validates :password, presence: true 6 | has_many :event_followers, dependent: :destroy 7 | has_many :events, through: :event_followers 8 | 9 | def self.from_token_request(request) 10 | username = request.params['auth'] && request.params['auth']['username'] 11 | find_by username: username 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/serializers/event_follower_serializer.rb: -------------------------------------------------------------------------------- 1 | class EventFollowerSerializer < ActiveModel::Serializer 2 | attributes :event_id 3 | end 4 | -------------------------------------------------------------------------------- /app/serializers/event_serializer.rb: -------------------------------------------------------------------------------- 1 | class EventSerializer < ActiveModel::Serializer 2 | def attributes(*_args) 3 | object.attributes.symbolize_keys 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/serializers/user_serializer.rb: -------------------------------------------------------------------------------- 1 | class UserSerializer < ActiveModel::Serializer 2 | attributes :id 3 | end 4 | -------------------------------------------------------------------------------- /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 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'bundle' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "rubygems" 12 | 13 | m = Module.new do 14 | module_function 15 | 16 | def invoked_as_script? 17 | File.expand_path($0) == File.expand_path(__FILE__) 18 | end 19 | 20 | def env_var_version 21 | ENV["BUNDLER_VERSION"] 22 | end 23 | 24 | def cli_arg_version 25 | return unless invoked_as_script? # don't want to hijack other binstubs 26 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` 27 | bundler_version = nil 28 | update_index = nil 29 | ARGV.each_with_index do |a, i| 30 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN 31 | bundler_version = a 32 | end 33 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ 34 | bundler_version = $1 || ">= 0.a" 35 | update_index = i 36 | end 37 | bundler_version 38 | end 39 | 40 | def gemfile 41 | gemfile = ENV["BUNDLE_GEMFILE"] 42 | return gemfile if gemfile && !gemfile.empty? 43 | 44 | File.expand_path("../../Gemfile", __FILE__) 45 | end 46 | 47 | def lockfile 48 | lockfile = 49 | case File.basename(gemfile) 50 | when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) 51 | else "#{gemfile}.lock" 52 | end 53 | File.expand_path(lockfile) 54 | end 55 | 56 | def lockfile_version 57 | return unless File.file?(lockfile) 58 | lockfile_contents = File.read(lockfile) 59 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ 60 | Regexp.last_match(1) 61 | end 62 | 63 | def bundler_version 64 | @bundler_version ||= begin 65 | env_var_version || cli_arg_version || 66 | lockfile_version || "#{Gem::Requirement.default}.a" 67 | end 68 | end 69 | 70 | def load_bundler! 71 | ENV["BUNDLE_GEMFILE"] ||= gemfile 72 | 73 | # must dup string for RG < 1.8 compatibility 74 | activate_bundler(bundler_version.dup) 75 | end 76 | 77 | def activate_bundler(bundler_version) 78 | if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0") 79 | bundler_version = "< 2" 80 | end 81 | gem_error = activation_error_handling do 82 | gem "bundler", bundler_version 83 | end 84 | return if gem_error.nil? 85 | require_error = activation_error_handling do 86 | require "bundler/version" 87 | end 88 | return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION)) 89 | warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`" 90 | exit 42 91 | end 92 | 93 | def activation_error_handling 94 | yield 95 | nil 96 | rescue StandardError, LoadError => e 97 | e 98 | end 99 | end 100 | 101 | m.load_bundler! 102 | 103 | if m.invoked_as_script? 104 | load Gem.bin_path("bundler", "bundle") 105 | end 106 | -------------------------------------------------------------------------------- /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 | 4 | # path to your application root. 5 | APP_ROOT = File.expand_path('..', __dir__) 6 | 7 | def system!(*args) 8 | system(*args) || abort("\n== Command #{args} failed ==") 9 | end 10 | 11 | FileUtils.chdir APP_ROOT do 12 | # This script is a way to setup or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at anytime and get an expectable outcome. 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 | # puts "\n== Copying sample files ==" 21 | # unless File.exist?('config/database.yml') 22 | # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' 23 | # end 24 | 25 | puts "\n== Preparing database ==" 26 | system! 'bin/rails db:prepare' 27 | 28 | puts "\n== Removing old logs and tempfiles ==" 29 | system! 'bin/rails log:clear tmp:clear' 30 | 31 | puts "\n== Restarting application server ==" 32 | system! 'bin/rails restart' 33 | end 34 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /client/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es6": true, 5 | "jest": true 6 | }, 7 | "parserOptions": { 8 | "ecmaFeatures": { 9 | "jsx": true 10 | }, 11 | "ecmaVersion": 2018, 12 | "sourceType": "module" 13 | }, 14 | "extends": ["airbnb", "plugin:react/recommended"], 15 | "plugins": ["react"], 16 | "rules": { 17 | "react/jsx-filename-extension": ["warn", { "extensions": [".js", ".jsx"] }], 18 | "import/no-unresolved": "off", 19 | "no-shadow": "off", 20 | "arrow-parens":"off" 21 | } 22 | } -------------------------------------------------------------------------------- /client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "proxy": "http://localhost:3001", 6 | "dependencies": { 7 | "@testing-library/jest-dom": "^4.2.4", 8 | "@testing-library/react": "^9.3.2", 9 | "@testing-library/user-event": "^7.1.2", 10 | "axios": "^0.19.2", 11 | "dateformat": "^3.0.3", 12 | "isomorphic-fetch": "^2.2.1", 13 | "node-sass": "^4.13.1", 14 | "prop-types": "^15.7.2", 15 | "react": "^16.12.0", 16 | "react-bootstrap": "^1.0.0-beta.16", 17 | "react-dom": "^16.12.0", 18 | "react-redux": "^7.1.3", 19 | "react-router": "^5.1.2", 20 | "react-router-dom": "^5.1.2", 21 | "react-scripts": "3.3.0", 22 | "redux": "^4.0.5", 23 | "redux-persist": "^6.0.0", 24 | "redux-thunk": "^2.3.0" 25 | }, 26 | "scripts": { 27 | "start": "react-scripts start", 28 | "build": "react-scripts build", 29 | "test": "react-scripts test", 30 | "eject": "react-scripts eject" 31 | }, 32 | "eslintConfig": { 33 | "extends": "react-app" 34 | }, 35 | "browserslist": { 36 | "production": [ 37 | ">0.2%", 38 | "not dead", 39 | "not op_mini all" 40 | ], 41 | "development": [ 42 | "last 1 chrome version", 43 | "last 1 firefox version", 44 | "last 1 safari version" 45 | ] 46 | }, 47 | "devDependencies": { 48 | "eslint": "^6.8.0", 49 | "eslint-config-airbnb": "^18.0.1", 50 | "eslint-config-airbnb-base": "^14.0.0", 51 | "eslint-plugin-import": "^2.20.0", 52 | "eslint-plugin-jsx-a11y": "^6.2.3", 53 | "eslint-plugin-react": "^7.18.0" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/client/public/favicon.ico -------------------------------------------------------------------------------- /client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /client/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/client/public/logo192.png -------------------------------------------------------------------------------- /client/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/client/public/logo512.png -------------------------------------------------------------------------------- /client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /client/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /client/src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | BrowserRouter as Router, Route, Switch, Link, 4 | } from 'react-router-dom'; 5 | import { connect } from 'react-redux'; 6 | import PropTypes from 'prop-types'; 7 | import EventsContainer from './components/EventsContainer'; 8 | import NotFound from './components/NotFound'; 9 | import EventDescription from './components/EventDescription'; 10 | import Login from './components/Login'; 11 | import './App.scss'; 12 | import SignUp from './components/SignUp'; 13 | import MyEventsContainer from './components/MyEventsContainer'; 14 | import Logout from './components/Logout'; 15 | 16 | 17 | const App = (props) => { 18 | const { isAuthenticated } = props; 19 | 20 | // const handleLogout = (e) => { 21 | // e.preventDefault(); 22 | // props.logout(); 23 | // return ; 24 | // }; 25 | 26 | return ( 27 | 28 | {isAuthenticated 29 | ? ( 30 |
31 | Logout 32 | My Events 33 | All Events 34 |
35 | ) 36 | : ( 37 |
38 | Login 39 | Sign Up 40 | All Events 41 |
42 | ) } 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
54 | ); 55 | }; 56 | 57 | const mapStateToProps = (state) => ({ 58 | isAuthenticated: state.auth.isAuthenticated, 59 | user: state.auth.currentUser, 60 | }); 61 | 62 | App.propTypes = { 63 | isAuthenticated: PropTypes.bool.isRequired, 64 | }; 65 | 66 | export default connect(mapStateToProps, null)(App); 67 | -------------------------------------------------------------------------------- /client/src/App.scss: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: 'Montserrat', sans-serif; 3 | box-sizing: border-box; 4 | } 5 | 6 | .login { 7 | color: #59499e; 8 | font-weight: bolder; 9 | } -------------------------------------------------------------------------------- /client/src/components/Event.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { useHistory } from 'react-router-dom'; 4 | import { connect } from 'react-redux'; 5 | import { createEventFollower, deleteEventFollower } from '../redux/actions/followActions'; 6 | import './Event.scss'; 7 | 8 | 9 | const Event = (props) => { 10 | const { 11 | event, isAuthenticated, followedEvents, 12 | } = props; 13 | 14 | const history = useHistory(); 15 | 16 | const [state, setState] = useState({ 17 | isFollowed: null, 18 | }); 19 | 20 | const handleSubmit = (e) => { 21 | e.preventDefault(); 22 | if (props.createEventFollower(event.id) && state.isFollowed !== true) { 23 | setState({ 24 | isFollowed: true, 25 | }); 26 | } 27 | }; 28 | 29 | const handleRemove = (e) => { 30 | e.preventDefault(); 31 | if (props.deleteEventFollower(event.id)) { 32 | setState({ 33 | isFollowed: false, 34 | }); 35 | } 36 | }; 37 | 38 | const checkFollowed = () => { 39 | if ((followedEvents.filter(el => el.event_id === props.event.id)).length > 0) { 40 | return ( 41 | 44 | ); 45 | } 46 | return ( 47 | 50 | ); 51 | }; 52 | 53 | const handleEventDescription = () => { 54 | history.push(`events/${event.id}`); 55 | }; 56 | 57 | return ( 58 |
  • 59 |

    { event.date_start && `${event.date_start.slice(0, 10)} ${event.date_start.slice(11, 16)}` }

    60 |
    61 | 65 | { isAuthenticated ? checkFollowed() :
    } 66 |
    67 |
  • 68 | ); 69 | }; 70 | 71 | Event.propTypes = { 72 | event: PropTypes.oneOfType([PropTypes.object]).isRequired, 73 | followedEvents: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.object])).isRequired, 74 | isAuthenticated: PropTypes.bool.isRequired, 75 | createEventFollower: PropTypes.func.isRequired, 76 | deleteEventFollower: PropTypes.func.isRequired, 77 | }; 78 | 79 | const mapStateToProps = (state) => ({ 80 | isAuthenticated: state.auth.isAuthenticated, 81 | followedEvents: state.followed_events, 82 | }); 83 | 84 | export default connect(mapStateToProps, { createEventFollower, deleteEventFollower })(Event); 85 | -------------------------------------------------------------------------------- /client/src/components/Event.scss: -------------------------------------------------------------------------------- 1 | $purple-color: #59499e; 2 | $cyan-color: #25bee0; 3 | $lightPurple-color: #8589ef; 4 | $lightGreen-color:#18cebb; 5 | 6 | .date-start { 7 | color: $cyan-color; 8 | } 9 | 10 | .event-info { 11 | width: 80%; 12 | } 13 | 14 | .event-button-add { 15 | width: 10%; 16 | background-color: $lightPurple-color; 17 | text-align: center; 18 | padding-right: 0.5rem; 19 | color: white; 20 | font-size: 0.5rem; 21 | } 22 | 23 | .button-add { 24 | writing-mode: vertical-rl; 25 | } 26 | 27 | .event-button-remove { 28 | width: 10%; 29 | writing-mode: vertical-rl; 30 | background-color: $lightGreen-color; 31 | text-align: center; 32 | padding-right: 0.5rem; 33 | color: white; 34 | font-size: 0.5rem; 35 | } 36 | 37 | .event-title { 38 | padding: 5% 0 0 5%; 39 | color: $purple-color; 40 | font-weight: bolder; 41 | font-size: 0.8rem; 42 | } 43 | 44 | .event-city { 45 | color: $purple-color; 46 | font-size: 1rem; 47 | padding: 5% 0 0 5%; 48 | } 49 | 50 | ul.timeline { 51 | list-style-type: none; 52 | position: relative; 53 | 54 | &:before { 55 | content: ' '; 56 | background: #d4d9df; 57 | display: inline-block; 58 | position: absolute; 59 | left: 29px; 60 | width: 2px; 61 | height: 100%; 62 | z-index: 400; 63 | } 64 | 65 | > li { 66 | margin: 20px 0; 67 | padding-left: 20px; 68 | 69 | &:before { 70 | content: ' '; 71 | background: white; 72 | display: inline-block; 73 | position: absolute; 74 | border-radius: 50%; 75 | border: 3px solid $cyan-color; 76 | left: 20px; 77 | width: 20px; 78 | height: 20px; 79 | z-index: 400; 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /client/src/components/EventDescription.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import axios from 'axios'; 3 | import PropTypes from 'prop-types'; 4 | import './EventDescription.scss'; 5 | import { connect } from 'react-redux'; 6 | 7 | const EventDescription = (props) => { 8 | const initialEventState = { 9 | event: {}, 10 | loading: true, 11 | }; 12 | 13 | const [event, setEvent] = useState(initialEventState); 14 | 15 | useEffect(() => { 16 | const getEvent = async () => { 17 | const { data } = await axios(`/api/v1/events/${props.match.params.id}`); 18 | await setEvent(data); 19 | }; 20 | getEvent(); 21 | }, []); 22 | 23 | const goBack = () => { 24 | props.history.goBack(); 25 | }; 26 | 27 | return ( 28 |
    29 |
    30 |
    31 |
    32 |
    { event.title }
    33 |
    34 |
    35 |
    36 | 37 |
    38 |
    Date & Time
    39 |
    { event.date_start && `${event.date_start.slice(0, 10)} ${event.date_start.slice(11, 16)}` }
    40 |
    41 |
    42 |
    43 | 44 |
    45 |
    City
    46 |
    { event.city }
    47 |
    48 |
    49 |
    50 |
    51 | 52 |
    53 | Description 54 |
    { event.description }
    55 |
    56 | 57 |
    58 | Location 59 |
    { event.location }
    60 |
    61 | 62 |
    63 | Status 64 |
    { event.status }
    65 |
    66 |
    67 | ); 68 | }; 69 | 70 | EventDescription.propTypes = { 71 | history: PropTypes.objectOf(PropTypes.object).isRequired, 72 | match: PropTypes.objectOf(PropTypes.object).isRequired, 73 | }; 74 | 75 | const mapStateToProps = (state) => ({ 76 | isAuthenticated: state.auth.isAuthenticated, 77 | user: state.auth.currentUser, 78 | }); 79 | 80 | export default connect(mapStateToProps, null)(EventDescription); 81 | -------------------------------------------------------------------------------- /client/src/components/EventDescription.scss: -------------------------------------------------------------------------------- 1 | $purple-color: #59499e; 2 | $cyan-color: #25bee0; 3 | $lightPurple-color: #8589ef; 4 | $lightGreen-color:#18cebb; 5 | 6 | .top-event-description { 7 | background-color: $lightPurple-color; 8 | } 9 | 10 | .back-icon-container { 11 | width: 10% 12 | } 13 | 14 | .back-icon { 15 | font-size: 2rem; 16 | color: white; 17 | width: 100%; 18 | } 19 | 20 | .event-description-title { 21 | font-size: 1.3rem; 22 | color: white; 23 | font-weight: bold; 24 | } 25 | 26 | .icon { 27 | font-size: 1.3rem; 28 | display: inline-block; 29 | border-radius: 60px; 30 | box-shadow: 0px 0px 2px $cyan-color; 31 | padding: 0.5em 0.6em; 32 | background-color: $cyan-color; 33 | color: white; 34 | } 35 | 36 | .date-label { 37 | color: $lightPurple-color 38 | } 39 | 40 | .city{ 41 | color: $purple-color 42 | } 43 | 44 | .date{ 45 | color: $purple-color 46 | } 47 | 48 | .add-to-schedule { 49 | background-color: $cyan-color; 50 | } 51 | 52 | .add-label { 53 | color: white; 54 | } 55 | 56 | .infoLabel { 57 | color: $purple-color; 58 | font-size: 1.2rem; 59 | font-weight: 700; 60 | margin-bottom: 3 3 3 0; 61 | } 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /client/src/components/EventsContainer.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import axios from 'axios'; 3 | import { connect } from 'react-redux'; 4 | import PropTypes from 'prop-types'; 5 | import loadEvents from '../redux/actions/eventActions'; 6 | import EventsList from './EventsList'; 7 | import './EventsContainer.scss'; 8 | 9 | const EventsContainer = (props) => { 10 | const { events, dispatch } = props; 11 | 12 | const fetchEvents = () => { 13 | axios.get('/api/v1/events') 14 | .then(response => { 15 | dispatch(loadEvents(response.data)); 16 | }) 17 | .catch(error => (error)); 18 | }; 19 | 20 | useEffect(() => { 21 | fetchEvents(); 22 | }, []); 23 | 24 | return ( 25 |
    26 |
    Agenda
    27 | 28 |
    29 | ); 30 | }; 31 | 32 | EventsContainer.propTypes = { 33 | events: PropTypes.arrayOf(PropTypes.object).isRequired, 34 | dispatch: PropTypes.func.isRequired, 35 | }; 36 | 37 | const mapStateToProps = (state) => ({ 38 | events: state.events, 39 | dispatch: state.dispatch, 40 | user: state.auth.currentUser, 41 | }); 42 | 43 | export default connect(mapStateToProps, null)(EventsContainer); 44 | -------------------------------------------------------------------------------- /client/src/components/EventsContainer.scss: -------------------------------------------------------------------------------- 1 | $purple-color: #59499e; 2 | $cyan-color: #25bee0; 3 | 4 | .title { 5 | background-color: $purple-color; 6 | line-height: 50px; 7 | height: 50px; 8 | color: white; 9 | font-weight: 700; 10 | font-size: 1.5rem; 11 | text-align: center; 12 | } -------------------------------------------------------------------------------- /client/src/components/EventsList.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import Event from './Event'; 4 | 5 | const EventsList = (props) => { 6 | const { events } = props; 7 | 8 | return ( 9 |
      10 | {events.map((event) => ( 11 | 12 | ))} 13 |
    14 | ); 15 | }; 16 | 17 | EventsList.propTypes = { 18 | events: PropTypes.arrayOf(PropTypes.object).isRequired, 19 | }; 20 | 21 | export default EventsList; 22 | -------------------------------------------------------------------------------- /client/src/components/Login.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { connect } from 'react-redux'; 3 | import PropTypes from 'prop-types'; 4 | import { authenticate } from '../redux/actions/authActions'; 5 | import { loadEventsFollowed } from '../redux/actions/followActions'; 6 | import './Login.scss'; 7 | 8 | const Login = (props) => { 9 | const [state, setState] = useState({ 10 | username: '', 11 | password: '', 12 | }); 13 | 14 | const handleChange = (e) => { 15 | const { name, value } = e.target; 16 | if (name === 'username') { 17 | setState({ 18 | username: value, 19 | password: state.password, 20 | }); 21 | } 22 | if (name === 'password') { 23 | setState({ 24 | username: state.username, 25 | password: value, 26 | }); 27 | } 28 | }; 29 | 30 | const handleSubmit = (e) => { 31 | e.preventDefault(); 32 | if (props.authenticate(state)) { 33 | props.loadEventsFollowed(state); 34 | props.history.push('/'); 35 | } 36 | }; 37 | 38 | return ( 39 |
    40 |
    41 |

    Login

    42 | 51 | 60 |
    61 | 62 |
    63 |
    64 |
    65 | ); 66 | }; 67 | 68 | Login.propTypes = { 69 | authenticate: PropTypes.func.isRequired, 70 | history: PropTypes.oneOfType([PropTypes.object]).isRequired, 71 | loadEventsFollowed: PropTypes.func.isRequired, 72 | }; 73 | 74 | 75 | export default connect(null, { authenticate, loadEventsFollowed })(Login); 76 | -------------------------------------------------------------------------------- /client/src/components/Login.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/client/src/components/Login.scss -------------------------------------------------------------------------------- /client/src/components/Logout.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { connect } from 'react-redux'; 4 | import { Redirect } from 'react-router-dom'; 5 | import { logout } from '../redux/actions/authActions'; 6 | 7 | const Logout = (props) => { 8 | const { logout } = props; 9 | 10 | useEffect(() => { 11 | logout(); 12 | }, []); 13 | 14 | return ( 15 | 16 | ); 17 | }; 18 | 19 | Logout.propTypes = { 20 | logout: PropTypes.func.isRequired, 21 | }; 22 | 23 | export default connect(null, { logout })(Logout); 24 | -------------------------------------------------------------------------------- /client/src/components/MyEventsContainer.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { connect } from 'react-redux'; 3 | import PropTypes from 'prop-types'; 4 | import EventsList from './EventsList'; 5 | import './EventsContainer.scss'; 6 | 7 | const MyEventsContainer = (props) => { 8 | const { 9 | events, isAuthenticated, followedEvents, 10 | } = props; 11 | 12 | const followedEventsArray = followedEvents.map((obj) => obj.event_id); 13 | 14 | const myEvents = isAuthenticated 15 | ? events.filter( 16 | event => followedEventsArray.includes(event.id), 17 | ) : []; 18 | 19 | return ( 20 |
    21 |
    My Events
    22 | 23 |
    24 | ); 25 | }; 26 | 27 | MyEventsContainer.propTypes = { 28 | events: PropTypes.arrayOf(PropTypes.object).isRequired, 29 | isAuthenticated: PropTypes.bool.isRequired, 30 | followedEvents: PropTypes.arrayOf(PropTypes.object).isRequired, 31 | }; 32 | 33 | const mapStateToProps = (state) => ({ 34 | followedEvents: state.followed_events, 35 | isAuthenticated: state.auth.isAuthenticated, 36 | events: state.events, 37 | dispatch: state.dispatch, 38 | user: state.auth.currentUser, 39 | }); 40 | 41 | export default connect(mapStateToProps, null)(MyEventsContainer); 42 | -------------------------------------------------------------------------------- /client/src/components/NotFound.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const NotFound = () => ( 4 |
    5 |

    404: Not found

    6 |
    7 | ); 8 | 9 | export default NotFound; 10 | -------------------------------------------------------------------------------- /client/src/components/SignUp.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { connect } from 'react-redux'; 3 | import PropTypes from 'prop-types'; 4 | import { signUp } from '../redux/actions/authActions'; 5 | import './Login.scss'; 6 | 7 | const SignUp = (props) => { 8 | const [state, setState] = useState({ 9 | username: '', 10 | password: '', 11 | email: '', 12 | }); 13 | 14 | const handleChange = (e) => { 15 | const { name, value } = e.target; 16 | if (name === 'username') { 17 | setState({ 18 | username: value, 19 | password: state.password, 20 | email: state.email, 21 | }); 22 | } 23 | if (name === 'password') { 24 | setState({ 25 | username: state.username, 26 | password: value, 27 | email: state.email, 28 | }); 29 | } 30 | if (name === 'email') { 31 | setState({ 32 | username: state.username, 33 | password: state.password, 34 | email: value, 35 | }); 36 | } 37 | }; 38 | 39 | const handleSubmit = (e) => { 40 | e.preventDefault(); 41 | if (props.signUp(state)) { 42 | props.history.push('/'); 43 | } 44 | }; 45 | 46 | return ( 47 |
    48 |
    49 |

    Sign Up

    50 | 59 | 68 | 77 |
    78 | 79 |
    80 |
    81 |
    82 | ); 83 | }; 84 | 85 | SignUp.propTypes = { 86 | signUp: PropTypes.func.isRequired, 87 | history: PropTypes.oneOfType([PropTypes.object]).isRequired, 88 | }; 89 | 90 | 91 | export default connect(null, { signUp })(SignUp); 92 | -------------------------------------------------------------------------------- /client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import { Provider } from 'react-redux'; 4 | import { PersistGate } from 'redux-persist/integration/react'; 5 | import App from './App'; 6 | import { store, persistor } from './redux/store'; 7 | 8 | ReactDOM.render( 9 | 10 | 11 | 12 | 13 | , 14 | document.getElementById('root'), 15 | ); 16 | -------------------------------------------------------------------------------- /client/src/redux/actions/actionTypes.js: -------------------------------------------------------------------------------- 1 | export const LOAD_EVENTS = 'LOAD_EVENTS'; 2 | export const LOAD_EVENTS_FOLLOWED = 'LOAD_EVENTS_FOLLOWED'; 3 | 4 | export const AUTHENTICATION_REQUEST = 'AUTHENTICATION_REQUEST'; 5 | export const AUTHENTICATION_SUCCESS = 'AUTHENTICATION_SUCCESS'; 6 | export const AUTHENTICATION_FAILURE = 'AUTHENTICATION_FAILURE'; 7 | export const LOGOUT = 'LOGOUT'; 8 | 9 | export const ADD_EVENT_FOLLOWER = 'ADD_EVENT_FOLLOWER'; 10 | export const LOAD_EVENT_FOLLOWERS = 'LOAD_EVENT_FOLLOWERS'; 11 | export const DELETE_EVENT_FOLLOWER = 'DELETE_EVENT_FOLLOWER'; 12 | 13 | export const RESET = 'RESET'; 14 | -------------------------------------------------------------------------------- /client/src/redux/actions/authActions.js: -------------------------------------------------------------------------------- 1 | import * as types from './actionTypes'; 2 | 3 | const authRequest = () => ({ 4 | type: types.AUTHENTICATION_REQUEST, 5 | }); 6 | 7 | const authSuccess = (user, token) => ({ 8 | type: types.AUTHENTICATION_SUCCESS, 9 | user, 10 | token, 11 | }); 12 | 13 | const authFailure = (errors) => ({ 14 | type: types.AUTHENTICATION_FAILURE, 15 | errors, 16 | }); 17 | 18 | const resetAction = () => ({ 19 | type: types.RESET, 20 | }); 21 | 22 | export const logout = () => dispatch => { 23 | localStorage.clear(); 24 | dispatch(resetAction()); 25 | return dispatch({ 26 | type: types.LOGOUT, 27 | }); 28 | }; 29 | 30 | export const getUser = (credentials) => { 31 | const request = new Request('/find_user', { 32 | method: 'POST', 33 | headers: new Headers({ 34 | 'Content-Type': 'application/json', 35 | Authorization: `Bearer ${localStorage.token}`, 36 | }), 37 | body: JSON.stringify({ user: credentials }), 38 | }); 39 | return fetch(request) 40 | .then(response => response.json()) 41 | .then(userJson => userJson) 42 | .catch(error => error); 43 | }; 44 | 45 | export const authenticate = (credentials) => dispatch => { 46 | dispatch(authRequest()); 47 | return fetch('/login', { 48 | method: 'POST', 49 | headers: { 50 | 'Content-Type': 'application/json', 51 | }, 52 | body: JSON.stringify({ auth: credentials }), 53 | }) 54 | .then(res => res.json()) 55 | .then((response) => { 56 | const token = response.jwt; 57 | localStorage.setItem('token', token); 58 | return getUser(credentials); 59 | }) 60 | .then((user) => { 61 | dispatch(authSuccess(user, localStorage.token)); 62 | }) 63 | .catch((errors) => { 64 | dispatch(authFailure(errors)); 65 | localStorage.clear(); 66 | }); 67 | }; 68 | 69 | export const signUp = (user) => { 70 | const newUser = user; 71 | return dispatch => fetch('/sign_up', { 72 | method: 'POST', 73 | headers: { 74 | Accept: 'application/json', 75 | 'Content-Type': 'application/json', 76 | }, 77 | body: JSON.stringify({ user }), 78 | }) 79 | .then(response => response.json()) 80 | .then(() => { 81 | dispatch(authenticate({ 82 | username: newUser.username, 83 | email: newUser.email, 84 | password: newUser.password, 85 | })); 86 | }) 87 | .catch((errors) => { 88 | dispatch(authFailure(errors)); 89 | }); 90 | }; 91 | -------------------------------------------------------------------------------- /client/src/redux/actions/eventActions.js: -------------------------------------------------------------------------------- 1 | import * as types from './actionTypes'; 2 | 3 | const loadEvents = (events) => ({ 4 | type: types.LOAD_EVENTS, 5 | events, 6 | }); 7 | 8 | export default loadEvents; 9 | -------------------------------------------------------------------------------- /client/src/redux/actions/followActions.js: -------------------------------------------------------------------------------- 1 | import * as types from './actionTypes'; 2 | 3 | const addEventFollower = event => ({ 4 | type: types.ADD_EVENT_FOLLOWER, 5 | event, 6 | }); 7 | 8 | const destroyEventFollower = event => ({ 9 | type: types.DELETE_EVENT_FOLLOWER, 10 | event, 11 | }); 12 | 13 | const loadEventsFollow = (events) => ({ 14 | type: types.LOAD_EVENTS_FOLLOWED, 15 | events, 16 | }); 17 | 18 | export const loadEventsFollowed = (credentials) => dispatch => { 19 | const request = new Request('/find_user_events', { 20 | method: 'POST', 21 | headers: new Headers({ 22 | 'Content-Type': 'application/json', 23 | Authorization: `Bearer ${localStorage.token}`, 24 | }), 25 | body: JSON.stringify({ user: credentials }), 26 | }); 27 | return fetch(request) 28 | .then(response => response.json()) 29 | .then(response => dispatch(loadEventsFollow(response))) 30 | .catch(error => error); 31 | }; 32 | 33 | export const createEventFollower = eventId => (dispatch) => fetch('/api/v1/event_followers', { 34 | method: 'POST', 35 | headers: { 36 | Authorization: `Bearer ${localStorage.token}`, 37 | 'Content-Type': 'application/json', 38 | }, 39 | body: JSON.stringify({ event_id: eventId }), 40 | }) 41 | .then(response => response.json()) 42 | .then(event => { 43 | dispatch(addEventFollower(event)); 44 | }) 45 | .catch(error => (error)); 46 | 47 | export const deleteEventFollower = eventId => (dispatch) => fetch('/api/v1/event_followers', { 48 | method: 'DELETE', 49 | headers: { 50 | Authorization: `Bearer ${localStorage.token}`, 51 | Accept: 'application/json', 52 | 'Content-Type': 'application/json', 53 | }, 54 | body: JSON.stringify({ event_id: eventId }), 55 | }) 56 | .then(response => response.json()) 57 | .then(event => { 58 | dispatch(destroyEventFollower(event)); 59 | }) 60 | .catch(error => (error)); 61 | -------------------------------------------------------------------------------- /client/src/redux/reducers/authReducer.js: -------------------------------------------------------------------------------- 1 | import * as types from '../actions/actionTypes'; 2 | 3 | const initialState = { 4 | isAuthenticated: false, 5 | isAuthenticating: false, 6 | currentUser: {}, 7 | token: null, 8 | errors: [], 9 | }; 10 | 11 | export default (state = initialState, action) => { 12 | switch (action.type) { 13 | case types.AUTHENTICATION_REQUEST: 14 | return { 15 | ...state, 16 | isAuthenticating: true, 17 | }; 18 | 19 | case types.AUTHENTICATION_SUCCESS: 20 | return { 21 | ...state, 22 | isAuthenticated: true, 23 | isAuthenticating: false, 24 | currentUser: action.user, 25 | token: action.token, 26 | }; 27 | 28 | case types.AUTHENTICATION_FAILURE: 29 | return { 30 | isAuthenticated: false, 31 | isAuthenticating: false, 32 | currentUser: {}, 33 | token: null, 34 | errors: action.errors || [], 35 | }; 36 | 37 | case types.LOGOUT: 38 | return { 39 | ...state, 40 | isAuthenticated: false, 41 | isAuthenticating: false, 42 | currentUser: {}, 43 | token: null, 44 | }; 45 | 46 | default: 47 | return state; 48 | } 49 | }; 50 | -------------------------------------------------------------------------------- /client/src/redux/reducers/eventsReducer.js: -------------------------------------------------------------------------------- 1 | import * as types from '../actions/actionTypes'; 2 | 3 | export default (state = [], action) => { 4 | switch (action.type) { 5 | case types.LOAD_EVENTS: 6 | return action.events; 7 | default: 8 | return state; 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /client/src/redux/reducers/followReducer.js: -------------------------------------------------------------------------------- 1 | import * as types from '../actions/actionTypes'; 2 | 3 | const initialState = []; 4 | 5 | export default (state = initialState, action) => { 6 | switch (action.type) { 7 | case types.LOAD_EVENTS_FOLLOWED: 8 | return action.events; 9 | case types.ADD_EVENT_FOLLOWER: 10 | return [...state, action.event]; 11 | case types.DELETE_EVENT_FOLLOWER: 12 | return state.filter(data => data.event_id !== action.event.event_id); 13 | case 'RESET': 14 | return initialState; 15 | default: 16 | return state; 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /client/src/redux/reducers/rootReducer.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from 'redux'; 2 | import eventsReducer from './eventsReducer'; 3 | import authReducer from './authReducer'; 4 | import followReducer from './followReducer'; 5 | 6 | const rootReducer = combineReducers({ 7 | events: eventsReducer, 8 | auth: authReducer, 9 | followed_events: followReducer, 10 | }); 11 | 12 | export default rootReducer; 13 | -------------------------------------------------------------------------------- /client/src/redux/store.js: -------------------------------------------------------------------------------- 1 | import { createStore, applyMiddleware, compose } from 'redux'; 2 | import thunk from 'redux-thunk'; 3 | import { persistStore, persistReducer } from 'redux-persist'; 4 | import storage from 'redux-persist/lib/storage'; 5 | import rootReducer from './reducers/rootReducer'; 6 | 7 | const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; 8 | 9 | const persistConfig = { 10 | key: 'root', 11 | storage, 12 | }; 13 | 14 | const persistedReducer = persistReducer(persistConfig, rootReducer); 15 | 16 | const store = createStore( 17 | persistedReducer, composeEnhancers( 18 | applyMiddleware(thunk), 19 | ), 20 | ); 21 | 22 | const persistor = persistStore(store); 23 | 24 | export { 25 | store, 26 | persistor, 27 | }; 28 | -------------------------------------------------------------------------------- /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' 4 | # Pick the frameworks you want: 5 | require 'active_model/railtie' 6 | require 'active_job/railtie' 7 | require 'active_record/railtie' 8 | require 'active_storage/engine' 9 | require 'action_controller/railtie' 10 | require 'action_mailer/railtie' 11 | require 'action_mailbox/engine' 12 | require 'action_text/engine' 13 | require 'action_view/railtie' 14 | require 'action_cable/engine' 15 | # require 'sprockets/railtie' 16 | # require 'rails/test_unit/railtie' 17 | 18 | # Require the gems listed in Gemfile, including any gems 19 | # you've limited to :test, :development, or :production. 20 | Bundler.require(*Rails.groups) 21 | 22 | module ReactRailsEventScheduler 23 | class Application < Rails::Application 24 | # Initialize configuration defaults for originally generated Rails version. 25 | config.load_defaults 6.0 and config.autoloader = :classic # Settings in config/environments/* take precedence over those specified here. 26 | # Application configuration can go into files in config/initializers 27 | # -- all .rb files in that directory are automatically loaded after loading 28 | # the framework and any gems in your application. 29 | 30 | # Only loads a smaller set of middleware suitable for API only apps. 31 | # Middleware like session, flash, cookies can be added back manually. 32 | # Skip views, helpers and assets when generating a new resource. 33 | config.api_only = true 34 | 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /config/application.yml: -------------------------------------------------------------------------------- 1 | # Add configuration values here, as shown below. 2 | # 3 | # pusher_app_id: "2954" 4 | # pusher_key: 7381a978f7dd7f9a1117 5 | # pusher_secret: abdc3b896a0ffb85d373 6 | # stripe_api_key: sk_test_2J0l093xOyW72XUYJHE4Dv2r 7 | # stripe_publishable_key: pk_test_ro9jV5SNwGb1yYlQfzG17LHK 8 | # 9 | # production: 10 | # stripe_api_key: sk_live_EeHnL644i6zo4Iyq4v1KdV9H 11 | # stripe_publishable_key: pk_live_9lcthxpSIHbGwmdO941O1XVU 12 | 13 | AUTH_SECRET: ee8c2c8ff7f440345c8c1a1c5e312bc55eb385925e843ff72d478f0e381629970ef70ad7aa1d76d8b4451d3a0f1f008f5008dbf0797649a2287f3c167f919e4b 14 | -------------------------------------------------------------------------------- /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: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: react_rails_event_scheduler_production 11 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | XZDKdO9BH4/tEOr77bBKYDWi+elFrBaDYcyQeoRGGA1p70YPUyyMTmtATY7T1iluwYx23Y6oUuZ1fpQfeCbe1/F/i8TvZTjtOtH8O6bc9a6t/rHNwXK2CRwmqQANivY+5mhRO+EbLXUlUQQZ6gHnf0atU5SVMmP9z8LIbSQD4azg8idhbkKJNRPGETzIY6eNPAq05z4Jmhg3RRnV45sxUWhQG7sDzwYpkLsQqj+0GYRb4gNyiGHf0SQexkdK1BUupaEMSvDxERb/EY+LgniT5LWze5oeSLlPaML3kW9s7w6NgHssp2nFWRFS0s1gGwQB315JeQKNF8+AqqglTvMUy3DNWuuu+tmy1/vn0txVDNFhr5Qz5zUl1nnCBwgGxnoCDurIF0u94GDkFX0mGehMgsl8QvoarqKPfYZ+--omlnrUUH/RVDl26k--ko7+gAWOmwbi/SmMx8Jphw== -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.3 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On macOS with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On macOS with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see Rails configuration guide 21 | # https://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 23 | 24 | development: 25 | <<: *default 26 | database: react_rails_event_scheduler_development 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user that initialized the database. 32 | #username: react_rails_event_scheduler 33 | 34 | # The password associated with the postgres role (username). 35 | #password: 36 | 37 | # Connect on a TCP socket. Omitted by default since the client uses a 38 | # domain socket that doesn't need configuration. Windows does not have 39 | # domain sockets, so uncomment these lines. 40 | #host: localhost 41 | 42 | # The TCP port the server listens on. Defaults to 5432. 43 | # If your server runs on a different port number, change accordingly. 44 | #port: 5432 45 | 46 | # Schema search path. The server defaults to $user,public 47 | #schema_search_path: myapp,sharedapp,public 48 | 49 | # Minimum log levels, in increasing order: 50 | # debug5, debug4, debug3, debug2, debug1, 51 | # log, notice, warning, error, fatal, and panic 52 | # Defaults to warning. 53 | #min_messages: notice 54 | 55 | # Warning: The database defined as "test" will be erased and 56 | # re-generated from your development database when you run "rake". 57 | # Do not set this db to the same as development or production. 58 | test: 59 | <<: *default 60 | database: react_rails_event_scheduler_test 61 | 62 | # As with config/credentials.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password as a unix environment variable when you boot 67 | # the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database 68 | # for a full rundown on how to provide these environment variables in a 69 | # production deployment. 70 | # 71 | # On Heroku and other platform providers, you may have a full connection URL 72 | # available as an environment variable. For example: 73 | # 74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 75 | # 76 | # You can use this database configuration with: 77 | # 78 | # production: 79 | # url: <%= ENV['DATABASE_URL'] %> 80 | # 81 | production: 82 | <<: *default 83 | database: react_rails_event_scheduler_production 84 | username: react_rails_event_scheduler 85 | password: <%= ENV['REACT_RAILS_EVENT_SCHEDULER_DATABASE_PASSWORD'] %> 86 | -------------------------------------------------------------------------------- /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 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports. 13 | config.consider_all_requests_local = true 14 | 15 | # Enable/disable caching. By default caching is disabled. 16 | # Run rails dev:cache to toggle caching. 17 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 18 | config.cache_store = :memory_store 19 | config.public_file_server.headers = { 20 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 21 | } 22 | else 23 | config.action_controller.perform_caching = false 24 | 25 | config.cache_store = :null_store 26 | end 27 | 28 | # Store uploaded files on the local file system (see config/storage.yml for options). 29 | config.active_storage.service = :local 30 | 31 | # Don't care if the mailer can't send. 32 | config.action_mailer.raise_delivery_errors = false 33 | 34 | config.action_mailer.perform_caching = false 35 | 36 | # Print deprecation notices to the Rails logger. 37 | config.active_support.deprecation = :log 38 | 39 | # Raise an error on page load if there are pending migrations. 40 | config.active_record.migration_error = :page_load 41 | 42 | # Highlight code that triggered database queries in logs. 43 | config.active_record.verbose_query_logs = true 44 | 45 | # Raises error for missing translations. 46 | # config.action_view.raise_on_missing_translations = true 47 | 48 | # Use an evented file watcher to asynchronously detect changes in source code, 49 | # routes, locales, etc. This feature depends on the listen gem. 50 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 51 | end 52 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | 16 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 17 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 18 | # config.require_master_key = true 19 | 20 | # Disable serving static files from the `/public` folder by default since 21 | # Apache or NGINX already handles this. 22 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 23 | 24 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 25 | # config.action_controller.asset_host = 'http://assets.example.com' 26 | 27 | # Specifies the header that your server uses for sending files. 28 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 29 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 30 | 31 | # Store uploaded files on the local file system (see config/storage.yml for options). 32 | config.active_storage.service = :local 33 | 34 | # Mount Action Cable outside main process or domain. 35 | # config.action_cable.mount_path = nil 36 | # config.action_cable.url = 'wss://example.com/cable' 37 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 38 | 39 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 40 | config.force_ssl = true 41 | 42 | # Use the lowest log level to ensure availability of diagnostic information 43 | # when problems arise. 44 | config.log_level = :debug 45 | 46 | # Prepend all log lines with the following tags. 47 | config.log_tags = [:request_id] 48 | 49 | # Use a different cache store in production. 50 | # config.cache_store = :mem_cache_store 51 | 52 | # Use a real queuing backend for Active Job (and separate queues per environment). 53 | # config.active_job.queue_adapter = :resque 54 | # config.active_job.queue_name_prefix = "react_rails_event_scheduler_production" 55 | 56 | config.action_mailer.perform_caching = false 57 | 58 | # Ignore bad email addresses and do not raise email delivery errors. 59 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 60 | # config.action_mailer.raise_delivery_errors = false 61 | 62 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 63 | # the I18n.default_locale when a translation cannot be found). 64 | config.i18n.fallbacks = true 65 | 66 | # Send deprecation notices to registered listeners. 67 | config.active_support.deprecation = :notify 68 | 69 | # Use default logging formatter so that PID and timestamp are not suppressed. 70 | config.log_formatter = ::Logger::Formatter.new 71 | 72 | # Use a different logger for distributed setups. 73 | # require 'syslog/logger' 74 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 75 | 76 | if ENV['RAILS_LOG_TO_STDOUT'].present? 77 | logger = ActiveSupport::Logger.new(STDOUT) 78 | logger.formatter = config.log_formatter 79 | config.logger = ActiveSupport::TaggedLogging.new(logger) 80 | end 81 | 82 | # Do not dump schema after migrations. 83 | config.active_record.dump_schema_after_migration = false 84 | 85 | # Inserts middleware to perform automatic connection switching. 86 | # The `database_selector` hash is used to pass options to the DatabaseSelector 87 | # middleware. The `delay` is used to determine how long to wait after a write 88 | # to send a subsequent read to the primary. 89 | # 90 | # The `database_resolver` class is used by the middleware to determine which 91 | # database is appropriate to use based on the time delay. 92 | # 93 | # The `database_resolver_context` class is used by the middleware to set 94 | # timestamps for the last write to the primary. The resolver uses the context 95 | # class timestamps to determine how long to wait before reading from the 96 | # replica. 97 | # 98 | # By default Rails will store a last write timestamp in the session. The 99 | # DatabaseSelector middleware is designed as such you can define your own 100 | # strategy for connection switching and pass that into the middleware through 101 | # these configuration options. 102 | # config.active_record.database_selector = { delay: 2.seconds } 103 | # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver 104 | # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session 105 | end 106 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | # The test environment is used exclusively to run your application's 2 | # test suite. You never need to work with it otherwise. Remember that 3 | # your test database is "scratch space" for the test suite and is wiped 4 | # and recreated between test runs. Don't rely on the data there! 5 | 6 | Rails.application.configure do 7 | # Settings specified here will take precedence over those in config/application.rb. 8 | 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. This avoids loading your whole application 12 | # just for the purpose of running a single test. If you are using a tool that 13 | # preloads Rails for running tests, you may have to set it to true. 14 | config.eager_load = false 15 | 16 | # Configure public file server for tests with Cache-Control for performance. 17 | config.public_file_server.enabled = true 18 | config.public_file_server.headers = { 19 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 20 | } 21 | 22 | # Show full error reports and disable caching. 23 | config.consider_all_requests_local = true 24 | config.action_controller.perform_caching = false 25 | config.cache_store = :null_store 26 | 27 | # Raise exceptions instead of rendering exception templates. 28 | config.action_dispatch.show_exceptions = false 29 | 30 | # Disable request forgery protection in test environment. 31 | config.action_controller.allow_forgery_protection = false 32 | 33 | # Store uploaded files on the local file system in a temporary directory. 34 | config.active_storage.service = :test 35 | 36 | config.action_mailer.perform_caching = false 37 | 38 | # Tell Action Mailer not to deliver emails to the real world. 39 | # The :test delivery method accumulates sent emails in the 40 | # ActionMailer::Base.deliveries array. 41 | config.action_mailer.delivery_method = :test 42 | 43 | # Print deprecation notices to the stderr. 44 | config.active_support.deprecation = :stderr 45 | 46 | # Raises error for missing translations. 47 | # config.action_view.raise_on_missing_translations = true 48 | end 49 | -------------------------------------------------------------------------------- /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/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/cors.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.middleware.insert_before 0, Rack::Cors do 2 | allow do 3 | origins 'localhost:3001', 'https://rocky-reef-66767.herokuapp.com' 4 | 5 | resource '*', 6 | headers: :any, 7 | methods: [:get, :post, :put, :patch, :delete, :options, :head] 8 | end 9 | end -------------------------------------------------------------------------------- /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/knock.rb: -------------------------------------------------------------------------------- 1 | Knock.setup do |config| 2 | 3 | ## Expiration claim 4 | ## ---------------- 5 | ## 6 | ## How long before a token is expired. If nil is provided, token will 7 | ## last forever. 8 | ## 9 | ## Default: 10 | config.token_lifetime = 1.day 11 | 12 | 13 | ## Audience claim 14 | ## -------------- 15 | ## 16 | ## Configure the audience claim to identify the recipients that the token 17 | ## is intended for. 18 | ## 19 | ## Default: 20 | # config.token_audience = nil 21 | 22 | ## If using Auth0, uncomment the line below 23 | # config.token_audience = -> { Rails.application.secrets.auth0_client_id } 24 | 25 | ## Signature algorithm 26 | ## ------------------- 27 | ## 28 | ## Configure the algorithm used to encode the token 29 | ## 30 | ## Default: 31 | config.token_signature_algorithm = 'HS256' 32 | 33 | ## Signature key 34 | ## ------------- 35 | ## 36 | ## Configure the key used to sign tokens. 37 | ## 38 | ## Default: 39 | config.token_secret_signature_key = -> { Rails.application.credentials.read } 40 | 41 | ## If using Auth0, uncomment the line below 42 | # config.token_secret_signature_key = -> { JWT.base64url_decode Rails.application.secrets.auth0_client_secret } 43 | 44 | ## Public key 45 | ## ---------- 46 | ## 47 | ## Configure the public key used to decode tokens, if required. 48 | ## 49 | ## Default: 50 | # config.token_public_key = nil 51 | 52 | ## Exception Class 53 | ## --------------- 54 | ## 55 | ## Configure the exception to be used when user cannot be found. 56 | ## 57 | ## Default: 58 | # config.not_found_exception_class_name = 'ActiveRecord::RecordNotFound' 59 | end 60 | -------------------------------------------------------------------------------- /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/time_as_json.rb: -------------------------------------------------------------------------------- 1 | module ActiveSupport 2 | class TimeWithZone 3 | def as_json(options = nil) 4 | if ActiveSupport::JSON::Encoding.use_standard_json_time_format 5 | xmlschema 6 | else 7 | %(#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}) 8 | end 9 | end 10 | end 11 | end -------------------------------------------------------------------------------- /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/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 https://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 | max_threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 } 8 | min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count } 9 | threads min_threads_count, max_threads_count 10 | 11 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 12 | # 13 | port ENV.fetch('PORT') { 3001 } 14 | 15 | # Specifies the `environment` that Puma will run in. 16 | # 17 | environment ENV.fetch('RAILS_ENV') { 'development' } 18 | 19 | # Specifies the `pidfile` that Puma will use. 20 | pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' } 21 | 22 | # Specifies the number of `workers` to boot in clustered mode. 23 | # Workers are forked web server processes. If using threads and workers together 24 | # the concurrency of the application would be max `threads` * `workers`. 25 | # Workers do not work on JRuby or Windows (both of which do not support 26 | # processes). 27 | # 28 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 29 | 30 | # Use the `preload_app!` method when specifying a `workers` number. 31 | # This directive tells Puma to first boot the application and load code 32 | # before forking the application. This takes advantage of Copy On Write 33 | # process behavior so workers use less memory. 34 | # 35 | # preload_app! 36 | 37 | # Allow puma to be restarted by `rails restart` command. 38 | plugin :tmp_restart 39 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | namespace :api, defaults: { format: :json } do 3 | namespace :v1 do 4 | resources :events 5 | resources :event_followers 6 | delete '/event_followers', to: 'event_followers#destroy' 7 | end 8 | end 9 | 10 | delete '/logout', to: 'sessions#destroy' 11 | 12 | post '/login', to: 'user_token#create' 13 | post '/sign_up', to: 'users#create' 14 | post '/find_user' => 'users#find' 15 | post '/find_user_events', to: 'users#find_events' 16 | 17 | 18 | get '*path', to: "application#fallback_index_html", constraints: ->(request) do 19 | !request.xhr? && request.format.html? 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | Spring.watch( 2 | '.ruby-version', 3 | '.rbenv-vars', 4 | 'tmp/restart.txt', 5 | 'tmp/caching-dev.txt' 6 | ) 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 | -------------------------------------------------------------------------------- /db/migrate/20200120200544_create_users.rb: -------------------------------------------------------------------------------- 1 | class CreateUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :users do |t| 4 | t.string :username 5 | t.timestamps 6 | end 7 | add_index :users, :username, unique: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200120200904_create_events.rb: -------------------------------------------------------------------------------- 1 | class CreateEvents < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :events do |t| 4 | t.string :title 5 | t.string :topic 6 | t.datetime :date_start 7 | t.datetime :date_end 8 | t.text :description 9 | t.string :location 10 | t.string :city 11 | t.string :country 12 | t.string :status 13 | t.timestamps 14 | end 15 | add_index :events, [:title, :description, :city, :date_start, :date_end], unique: true, :name => 'event_index' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20200120203113_create_event_followers.rb: -------------------------------------------------------------------------------- 1 | class CreateEventFollowers < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :event_followers do |t| 4 | t.integer :user_id 5 | t.integer :event_id 6 | t.timestamps 7 | end 8 | add_index :event_followers, [:user_id, :event_id], unique: true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20200126201844_add_password_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddPasswordToUser < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :password_digest, :string 4 | add_column :users, :email, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /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 | # This file is the source Rails uses to define your schema when running `rails 6 | # db:schema:load`. When creating a new database, `rails db:schema:load` tends to 7 | # be faster and is potentially less error prone than running all of your 8 | # migrations from scratch. Old migrations may fail to apply correctly if those 9 | # migrations use external dependencies or application code. 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 2020_01_26_201844) do 14 | 15 | # These are extensions that must be enabled in order to support this database 16 | enable_extension "plpgsql" 17 | 18 | create_table "event_followers", force: :cascade do |t| 19 | t.integer "user_id" 20 | t.integer "event_id" 21 | t.datetime "created_at", precision: 6, null: false 22 | t.datetime "updated_at", precision: 6, null: false 23 | t.index ["user_id", "event_id"], name: "index_event_followers_on_user_id_and_event_id", unique: true 24 | end 25 | 26 | create_table "events", force: :cascade do |t| 27 | t.string "title" 28 | t.string "topic" 29 | t.datetime "date_start" 30 | t.datetime "date_end" 31 | t.text "description" 32 | t.string "location" 33 | t.string "city" 34 | t.string "country" 35 | t.string "status" 36 | t.datetime "created_at", precision: 6, null: false 37 | t.datetime "updated_at", precision: 6, null: false 38 | t.index ["title", "description", "city", "date_start", "date_end"], name: "event_index", unique: true 39 | end 40 | 41 | create_table "users", force: :cascade do |t| 42 | t.string "username" 43 | t.datetime "created_at", precision: 6, null: false 44 | t.datetime "updated_at", precision: 6, null: false 45 | t.string "password_digest" 46 | t.string "email" 47 | t.index ["username"], name: "index_users_on_username", unique: true 48 | end 49 | 50 | end 51 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | 9 | user = User.create!(username: 'admin', email: 'admin@example.com', password: 'password') 10 | 11 | event1 = Event.create!(title: 'Strata Data & AI Conferences', 12 | date_start: 'Mar 15 2020 07:00', 13 | date_end: 'Mar 18 2020 22:00', 14 | description: 'A 4-day immersion in the most challenging problems, intriguing use cases, and enticing opportunities in data today.', 15 | location: 'TBD', 16 | city: 'San Francisco, CA', 17 | country: 'USA', 18 | topic: 'Tech', 19 | status: 'Pending') 20 | 21 | event2 = Event.create!(title: 'Deep Learning Summit', 22 | date_start: 'Jan 30 2020 07:00', 23 | date_end: 'Jan 31 2020 22:00', 24 | description: 'Their aim is to bridge the gap between the latest technological research advancements and real-world applications in business and society.', 25 | location: 'Hotel Niko, 222 Mason St', 26 | city: 'San Francisco, CA', 27 | country: 'USA', 28 | topic: 'Tech', 29 | status: 'Pending') 30 | 31 | event3 = Event.create!(title: 'Reinforce AI Conference', 32 | date_start: 'Apr 06 2020 07:00', 33 | date_end: 'Apr 07 2020 22:00', 34 | description: 'See how AI is shaping the world and how your company can use it to fix real-world problems.', 35 | location: 'TBD', 36 | city: 'Budapest', 37 | country: 'Hungary', 38 | topic: 'Tech', 39 | status: 'Pending') 40 | 41 | event4 = Event.create!(title: 'Applied Machine Learning Conference', 42 | date_start: 'Apr 15 2020 07:00', 43 | date_end: 'Apr 16 2020 22:00', 44 | description: 'A unique machine learning conference in its fourth year.', 45 | location: 'TBD', 46 | city: 'Charlottesville, VA', 47 | country: 'USA', 48 | topic: 'Tech', 49 | status: 'Pending') 50 | 51 | EventFollower.create!(user_id: user.id, event_id: event1.id) 52 | -------------------------------------------------------------------------------- /lib/Events_Scheduler_Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/lib/Events_Scheduler_Screenshot.png -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/lib/tasks/.keep -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-rails_event_scheduler", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "repository": "git@github.com:AndresFMoya/react-rails_event_scheduler.git", 6 | "author": "AndresFMoya ", 7 | "license": "MIT", 8 | "engines": { 9 | "node": "10.16.3", 10 | "yarn": "1.19.1" 11 | }, 12 | "scripts": { 13 | "build": "yarn --cwd client install && yarn --cwd client build", 14 | "deploy": "cp -a client/build/. public/", 15 | "heroku-postbuild": "yarn build && yarn deploy" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /spec/controllers/api/v1/event_followers_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Api::V1::EventFollowersController, type: :controller do 4 | end 5 | -------------------------------------------------------------------------------- /spec/controllers/api/v1/events_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Api::V1::EventsController, type: :controller do 4 | describe 'GET #index' do 5 | it 'returns http success' do 6 | get :index 7 | expect(response).to have_http_status(:success) 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/controllers/users_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe UsersController, type: :controller do 4 | end 5 | -------------------------------------------------------------------------------- /spec/factories/event_followers.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :event_follower do 3 | user 4 | event 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/factories/events.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :event do 3 | title { 'SuperBowl LIV' } 4 | topic { 'Sport' } 5 | date_start { 'Feb 2 2020 18:30' } 6 | date_end { 'Feb 2 2020 22:00' } 7 | description do 8 | 'The Super Bowl is the annual championship game of the National Football League (NFL). 9 | The game is the culmination of a regular season that begins in the late summer of the previous year.' 10 | end 11 | location { 'Hard Rock Stadium' } 12 | city { 'Miami, FL' } 13 | country { 'USA' } 14 | status { 'Pending' } 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/factories/users.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :user do 3 | username { 'admin' } 4 | email { 'admin@example.com' } 5 | password { 'password' } 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/models/event_follower_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe EventFollower, type: :model do 4 | let(:event_follower) { FactoryBot.create(:event_follower) } 5 | 6 | it 'must have a user and an event present' do 7 | expect(event_follower).to be_valid 8 | end 9 | 10 | it 'must have a user present' do 11 | event_follower = FactoryBot.build(:event_follower, user_id: nil) 12 | expect(event_follower).to_not be_valid 13 | end 14 | 15 | it 'must have a event present' do 16 | event_follower = FactoryBot.build(:event_follower, event_id: nil) 17 | expect(event_follower).to_not be_valid 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /spec/models/event_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Event, type: :model do 4 | let(:event) { FactoryBot.create(:event) } 5 | 6 | it 'must have title, description, start date, end date, and status present' do 7 | expect(event).to be_valid 8 | end 9 | 10 | it 'must have a title present' do 11 | event = FactoryBot.build(:event, title: nil) 12 | expect(event).to_not be_valid 13 | end 14 | 15 | it 'must have a description present' do 16 | event = FactoryBot.build(:event, description: nil) 17 | expect(event).to_not be_valid 18 | end 19 | 20 | it 'must have a city present' do 21 | event = FactoryBot.build(:event, city: nil) 22 | expect(event).to_not be_valid 23 | end 24 | 25 | it 'must have a start date' do 26 | event = FactoryBot.build(:event, date_start: nil) 27 | expect(event).to_not be_valid 28 | end 29 | 30 | it 'must have a end date' do 31 | event = FactoryBot.build(:event, date_end: nil) 32 | expect(event).to_not be_valid 33 | end 34 | 35 | it 'must have a status' do 36 | event = FactoryBot.build(:event, status: nil) 37 | expect(event).to_not be_valid 38 | end 39 | 40 | it 'could have many followers' do 41 | event = Event.reflect_on_association(:event_followers) 42 | expect(event.macro).to eq(:has_many) 43 | end 44 | 45 | it 'must be unique' do 46 | FactoryBot.create(:event) 47 | event = FactoryBot.build(:event) 48 | expect(event).to_not be_valid 49 | expect(event.errors[:title]).to include('has already been taken') 50 | end 51 | 52 | it 'destroys dependent events of event followers table' do 53 | event = FactoryBot.create(:event, title: 'Concert') 54 | FactoryBot.create(:event_follower, event: event) 55 | expect { event.destroy }.to change { EventFollower.count }.by(-1) 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /spec/models/user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe User, type: :model do 4 | let(:user) { FactoryBot.create(:user) } 5 | 6 | it 'must have a username present' do 7 | expect(user).to be_valid 8 | end 9 | 10 | it 'must not have a too short username' do 11 | user = FactoryBot.build(:user, username: 'adm') 12 | expect(user).to_not be_valid 13 | end 14 | 15 | it 'must be unique' do 16 | FactoryBot.create(:user) 17 | user = FactoryBot.build(:user) 18 | expect(user).to_not be_valid 19 | expect(user.errors[:username]).to include('has already been taken') 20 | end 21 | 22 | it 'must not have a too long username' do 23 | user = FactoryBot.build(:user, username: 'admin' * 20) 24 | expect(user).to_not be_valid 25 | end 26 | 27 | it 'must have a name present' do 28 | user = FactoryBot.build(:user, username: nil) 29 | expect(user).to_not be_valid 30 | end 31 | 32 | it 'could follow many events' do 33 | follower = User.reflect_on_association(:event_followers) 34 | expect(follower.macro).to eq(:has_many) 35 | end 36 | 37 | it 'destroys dependent followers of events' do 38 | user1 = FactoryBot.create(:user, username: 'user') 39 | FactoryBot.create(:event_follower, user: user1) 40 | expect { user1.destroy }.to change { EventFollower.count }.by(-1) 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | require 'spec_helper' 3 | ENV['RAILS_ENV'] ||= 'test' 4 | 5 | require File.expand_path('../config/environment', __dir__) 6 | 7 | # Prevent database truncation if the environment is production 8 | abort('The Rails environment is running in production mode!') if Rails.env.production? 9 | require 'rspec/rails' 10 | # Add additional requires below this line. Rails is not loaded until this point! 11 | 12 | # Requires supporting ruby files with custom matchers and macros, etc, in 13 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 14 | # run as spec files by default. This means that files in spec/support that end 15 | # in _spec.rb will both be required and run as specs, causing the specs to be 16 | # run twice. It is recommended that you do not name files matching this glob to 17 | # end with _spec.rb. You can configure this pattern with the --pattern 18 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 19 | # 20 | # The following line is provided for convenience purposes. It has the downside 21 | # of increasing the boot-up time by auto-requiring all files in the support 22 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 23 | # require only the support files necessary. 24 | # 25 | # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f } 26 | 27 | # Checks for pending migrations and applies them before tests are run. 28 | # If you are not using ActiveRecord, you can remove these lines. 29 | begin 30 | ActiveRecord::Migration.maintain_test_schema! 31 | rescue ActiveRecord::PendingMigrationError => e 32 | puts e.to_s.strip 33 | exit 1 34 | end 35 | RSpec.configure do |config| 36 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 37 | config.fixture_path = "#{::Rails.root}/spec/fixtures" 38 | 39 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 40 | # examples within a transaction, remove the following line or assign false 41 | # instead of true. 42 | config.use_transactional_fixtures = true 43 | 44 | # RSpec Rails can automatically mix in different behaviours to your tests 45 | # based on their file location, for example enabling you to call `get` and 46 | # `post` in specs under `spec/controllers`. 47 | # 48 | # You can disable this behaviour by removing the line below, and instead 49 | # explicitly tag your specs with their type, e.g.: 50 | # 51 | # RSpec.describe UsersController, :type => :controller do 52 | # # ... 53 | # end 54 | # 55 | # The different available types are documented in the features, such as in 56 | # https://relishapp.com/rspec/rspec-rails/docs 57 | config.infer_spec_type_from_file_location! 58 | 59 | # Filter lines from Rails gems in backtraces. 60 | config.filter_rails_from_backtrace! 61 | # arbitrary gems may also be filtered via: 62 | # config.filter_gems_from_backtrace("gem name") 63 | end 64 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all 2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 3 | # The generated `.rspec` file contains `--require spec_helper` which will cause 4 | # this file to always be loaded, without a need to explicitly require it in any 5 | # files. 6 | # 7 | # Given that it is always loaded, you are encouraged to keep this file as 8 | # light-weight as possible. Requiring heavyweight dependencies from this file 9 | # will add to the boot time of your test suite on EVERY test run, even for an 10 | # individual file that may not need all of that loaded. Instead, consider making 11 | # a separate helper file that requires the additional dependencies and performs 12 | # the additional setup, and require it from the spec files that actually need 13 | # it. 14 | # 15 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 16 | RSpec.configure do |config| 17 | # rspec-expectations config goes here. You can use an alternate 18 | # assertion/expectation library such as wrong or the stdlib/minitest 19 | # assertions if you prefer. 20 | config.expect_with :rspec do |expectations| 21 | # This option will default to `true` in RSpec 4. It makes the `description` 22 | # and `failure_message` of custom matchers include text for helper methods 23 | # defined using `chain`, e.g.: 24 | # be_bigger_than(2).and_smaller_than(4).description 25 | # # => "be bigger than 2 and smaller than 4" 26 | # ...rather than: 27 | # # => "be bigger than 2" 28 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 29 | end 30 | 31 | # rspec-mocks config goes here. You can use an alternate test double 32 | # library (such as bogus or mocha) by changing the `mock_with` option here. 33 | config.mock_with :rspec do |mocks| 34 | # Prevents you from mocking or stubbing a method that does not exist on 35 | # a real object. This is generally recommended, and will default to 36 | # `true` in RSpec 4. 37 | mocks.verify_partial_doubles = true 38 | end 39 | 40 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will 41 | # have no way to turn it off -- the option exists only for backwards 42 | # compatibility in RSpec 3). It causes shared context metadata to be 43 | # inherited by the metadata hash of host groups and examples, rather than 44 | # triggering implicit auto-inclusion in groups with matching metadata. 45 | config.shared_context_metadata_behavior = :apply_to_host_groups 46 | 47 | # The settings below are suggested to provide a good initial experience 48 | # with RSpec, but feel free to customize to your heart's content. 49 | # This allows you to limit a spec run to individual examples or groups 50 | # you care about by tagging them with `:focus` metadata. When nothing 51 | # is tagged with `:focus`, all examples get run. RSpec also provides 52 | # aliases for `it`, `describe`, and `context` that include `:focus` 53 | # metadata: `fit`, `fdescribe` and `fcontext`, respectively. 54 | # config.filter_run_when_matching :focus 55 | 56 | # Allows RSpec to persist some state between runs in order to support 57 | # the `--only-failures` and `--next-failure` CLI options. We recommend 58 | # you configure your source control system to ignore this file. 59 | # config.example_status_persistence_file_path = "spec/examples.txt" 60 | 61 | # Limits the available syntax to the non-monkey patched syntax that is 62 | # recommended. For more details, see: 63 | # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ 64 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ 65 | # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode 66 | # config.disable_monkey_patching! 67 | 68 | # Many RSpec users commonly either run the entire suite or an individual 69 | # file, and it's useful to allow more verbose output when running an 70 | # individual spec file. 71 | # if config.files_to_run.one? 72 | # Use the documentation formatter for detailed output, 73 | # unless a formatter has already been configured 74 | # (e.g. via a command-line flag). 75 | # config.default_formatter = "doc" 76 | 77 | # Print the 10 slowest examples and example groups at the 78 | # end of the spec run, to help surface which specs are running 79 | # particularly slow. 80 | # config.profile_examples = 10 81 | 82 | # Run specs in random order to surface order dependencies. If you find an 83 | # order dependency and want to debug it, you can fix the order by providing 84 | # the seed, which is printed after each run. 85 | # --seed 1234 86 | # config.order = :random 87 | 88 | # Seed global randomization in this process using the `--seed` CLI option. 89 | # Setting this allows you to use `--seed` to deterministically reproduce 90 | # test failures related to randomization by passing the same `--seed` value 91 | # as the one that triggered the failure. 92 | # Kernel.srand config.seed 93 | end 94 | -------------------------------------------------------------------------------- /storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/storage/.keep -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/tmp/.keep -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndresFMoya/react-rails_event_scheduler/a4be1b2b04d3295179acae0426fc65e80fee23ba/vendor/.keep -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | encoding@^0.1.11: 6 | version "0.1.12" 7 | resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" 8 | integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= 9 | dependencies: 10 | iconv-lite "~0.4.13" 11 | 12 | iconv-lite@~0.4.13: 13 | version "0.4.24" 14 | resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" 15 | integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== 16 | dependencies: 17 | safer-buffer ">= 2.1.2 < 3" 18 | 19 | is-stream@^1.0.1: 20 | version "1.1.0" 21 | resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" 22 | integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= 23 | 24 | isomorphic-fetch@^2.2.1: 25 | version "2.2.1" 26 | resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" 27 | integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk= 28 | dependencies: 29 | node-fetch "^1.0.1" 30 | whatwg-fetch ">=0.10.0" 31 | 32 | node-fetch@^1.0.1: 33 | version "1.7.3" 34 | resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" 35 | integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== 36 | dependencies: 37 | encoding "^0.1.11" 38 | is-stream "^1.0.1" 39 | 40 | "safer-buffer@>= 2.1.2 < 3": 41 | version "2.1.2" 42 | resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" 43 | integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== 44 | 45 | whatwg-fetch@>=0.10.0: 46 | version "3.0.0" 47 | resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" 48 | integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== 49 | --------------------------------------------------------------------------------