Skip to content

Commit

Permalink
first commit (because I'm insane)
Browse files Browse the repository at this point in the history
  • Loading branch information
DevDaveFrame committed Aug 29, 2020
0 parents commit 3be7ec5
Show file tree
Hide file tree
Showing 75 changed files with 1,412 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore uploaded files in development.
/storage/*
!/storage/.keep
.byebug_history

# Ignore master key for decrypting credentials and more.
/config/master.key
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-2.6.1
45 changes: 45 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.1'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.2'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

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

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
gem 'rack-cors'

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
gem 'listen', '~> 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'jwt'
gem 'faker'
gem 'fast_jsonapi'
177 changes: 177 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.3.2)
actionpack (= 6.0.3.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.2)
actionpack (= 6.0.3.2)
activejob (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
mail (>= 2.7.1)
actionmailer (6.0.3.2)
actionpack (= 6.0.3.2)
actionview (= 6.0.3.2)
activejob (= 6.0.3.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.3.2)
actionview (= 6.0.3.2)
activesupport (= 6.0.3.2)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.2)
actionpack (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
nokogiri (>= 1.8.5)
actionview (6.0.3.2)
activesupport (= 6.0.3.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.3.2)
activesupport (= 6.0.3.2)
globalid (>= 0.3.6)
activemodel (6.0.3.2)
activesupport (= 6.0.3.2)
activerecord (6.0.3.2)
activemodel (= 6.0.3.2)
activesupport (= 6.0.3.2)
activestorage (6.0.3.2)
actionpack (= 6.0.3.2)
activejob (= 6.0.3.2)
activerecord (= 6.0.3.2)
marcel (~> 0.3.1)
activesupport (6.0.3.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
bcrypt (3.1.13)
bootsnap (1.4.8)
msgpack (~> 1.0)
builder (3.2.4)
byebug (11.1.3)
concurrent-ruby (1.1.7)
crass (1.0.6)
erubi (1.9.0)
faker (2.13.0)
i18n (>= 1.6, < 2)
fast_jsonapi (1.5)
activesupport (>= 4.2)
ffi (1.13.1)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
jwt (2.2.1)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.6.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (1.0.0)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.1)
msgpack (1.3.3)
nio4r (2.5.2)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
pg (1.2.3)
puma (4.3.5)
nio4r (~> 2.0)
rack (2.2.3)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.0.3.2)
actioncable (= 6.0.3.2)
actionmailbox (= 6.0.3.2)
actionmailer (= 6.0.3.2)
actionpack (= 6.0.3.2)
actiontext (= 6.0.3.2)
actionview (= 6.0.3.2)
activejob (= 6.0.3.2)
activemodel (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
bundler (>= 1.3.0)
railties (= 6.0.3.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.0.3.2)
actionpack (= 6.0.3.2)
activesupport (= 6.0.3.2)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rake (13.0.1)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
spring (2.1.1)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (1.0.1)
thread_safe (0.3.6)
tzinfo (1.2.7)
thread_safe (~> 0.1)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.4.0)

PLATFORMS
ruby

DEPENDENCIES
bcrypt (~> 3.1.7)
bootsnap (>= 1.4.2)
byebug
faker
fast_jsonapi
jwt
listen (~> 3.2)
pg (>= 0.18, < 2.0)
puma (~> 4.1)
rack-cors
rails (~> 6.0.3, >= 6.0.3.2)
spring
spring-watcher-listen (~> 2.0.0)
tzinfo-data

RUBY VERSION
ruby 2.6.1p33

BUNDLED WITH
2.1.4
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# README

This README would normally document whatever steps are necessary to get the
application up and running.

Things you may want to cover:

* Ruby version

* System dependencies

* Configuration

* Database creation

* Database initialization

* How to run the test suite

* Services (job queues, cache servers, search engines, etc.)

* Deployment instructions

* ...
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative 'config/application'

Rails.application.load_tasks
4 changes: 4 additions & 0 deletions app/channels/application_cable/channel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
4 changes: 4 additions & 0 deletions app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
17 changes: 17 additions & 0 deletions app/channels/match_chat_channel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class MatchChatChannel < ApplicationCable::Channel
def subscribed
stream_from "match_chat_channel"
end

def unsubscribed
# Any cleanup needed when channel is unsubscribed
end

def create(opts)
Message.create(
content: opts.fetch('content'),
user_id: opts.fetch('user_id'),
match_chat_id: opts.fetch('match_chat_id')
)
end
end
13 changes: 13 additions & 0 deletions app/controllers/api/v1/auth_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Api::V1::AuthController < ApplicationController
skip_before_action :logged_in?, only: [:create]
def create

user = User.find_by(email: params[:email])
if user && user.authenticate(params[:password])
render json: {user: UserSerializer.new(user), token: encode_token({user_id: user.id})}
else
render json: {error: "Invalid email or password"}
end
end

end
2 changes: 2 additions & 0 deletions app/controllers/api/v1/genres_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class GenresController < ApplicationController
end
3 changes: 3 additions & 0 deletions app/controllers/api/v1/match_chats_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class MatchChatsController < ApplicationController

end
2 changes: 2 additions & 0 deletions app/controllers/api/v1/messages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class MessagesController < ApplicationController
end
2 changes: 2 additions & 0 deletions app/controllers/api/v1/photos_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class PhotosController < ApplicationController
end
2 changes: 2 additions & 0 deletions app/controllers/api/v1/songs_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class SongsController < ApplicationController
end
36 changes: 36 additions & 0 deletions app/controllers/api/v1/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
class Api::V1::UsersController < ApplicationController
skip_before_action :logged_in?, only: [:create]
before_action :find_user, only: [:show, :update]
def create
user = User.new(user_params)
options = {include: [:messages]}
if user.save
render json: {user: UserSerializer.new(user, option).serializable_hash, token: encode_token({user_id: user.id})}
else
render json: {errors: "OH NO! > o < "}
end
end

def show
user = User.find(params[:id])
options = {include: [:messages]}
render json: {user: UserSerializer.new(user, options).serializable_hash, token: encode_token({user_id: user.id})}
end

def update
user.update(user_params)
options = {include: [:messages]}
render json: {user: UserSerializer.new(user, options).serializable_hash, token: encode_token({user_id: user.id})}
end

private

def user_params
params.require(:user).permit(:name, :email, :password, :password_confirmation, :seeking, :bio, :location, :img_url)
end

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

end
Loading

0 comments on commit 3be7ec5

Please sign in to comment.