Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final Capstone Project: Rent-Eaze Booking System - Merge Request #55

Merged
merged 153 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
995df9d
Initialize RoR
lRebornsl Oct 26, 2023
86c42ef
Install linters
lRebornsl Oct 26, 2023
800f955
Modify linters
lRebornsl Oct 26, 2023
b0fa08b
Install and configure rack-cors
Luffytaro22 Oct 26, 2023
a299e0a
Update LICENSE
grauJavier Oct 26, 2023
0c27450
Linters fix
grauJavier Oct 26, 2023
29c024c
Merge pull request #37 from grauJavier/feature/setup-RoR
grauJavier Oct 26, 2023
551c428
Installed devise, devise-jwt and jsonapi-serializer gems
Luffytaro22 Oct 26, 2023
adca278
Install devise configuration
Luffytaro22 Oct 26, 2023
217d429
Config devise
Luffytaro22 Oct 26, 2023
07542c8
Add 'Reservations' model
grauJavier Oct 26, 2023
0e6daba
Create user model and migration
Luffytaro22 Oct 26, 2023
42743d9
Add reservation association
Luffytaro22 Oct 26, 2023
f837e57
Add accommodations model
lRebornsl Oct 26, 2023
17cf4a4
Add accommodation details model
lRebornsl Oct 26, 2023
acc93f6
Fixed linters
Luffytaro22 Oct 26, 2023
5422ba9
Add user validation
Luffytaro22 Oct 26, 2023
268dba2
Fix linters
lRebornsl Oct 26, 2023
b64b192
Add 'City' models
grauJavier Oct 26, 2023
3cf9a8b
Merge pull request #39 from grauJavier/feature/User_Model
Luffytaro22 Oct 26, 2023
cf46cfd
Merge pull request #38 from grauJavier/feature/create-reservation-model
lRebornsl Oct 26, 2023
37affc6
Merge pull request #40 from grauJavier/feature/create-accommodation-m…
lRebornsl Oct 26, 2023
7460275
Create migrations
lRebornsl Oct 26, 2023
ee0c2da
Linters fix
grauJavier Oct 26, 2023
1f853b9
Change the associations between accommodation and details
Luffytaro22 Oct 26, 2023
daa5f10
Merge pull request #41 from grauJavier/feature/database-migrations
lRebornsl Oct 26, 2023
17844d4
Add 'env' credentials
grauJavier Oct 26, 2023
6e3f3e5
Add an authorization to the rack config
Luffytaro22 Oct 26, 2023
3c7222a
Create user controllers
Luffytaro22 Oct 26, 2023
d3956c4
Add routes to the user session and registration
Luffytaro22 Oct 26, 2023
db87d5a
Add parameter permissions to the devise sanitizer
Luffytaro22 Oct 26, 2023
9886ecf
Add a jwt credential
Luffytaro22 Oct 26, 2023
9e060e3
Add the jwt configuration
Luffytaro22 Oct 26, 2023
2db33c7
Create a jti migration for the users table
Luffytaro22 Oct 26, 2023
a330370
Add the jwt validation
Luffytaro22 Oct 26, 2023
f8c2dc6
Create a user serializer
Luffytaro22 Oct 26, 2023
ad4ce28
Add the login and logout logic in the user controllers
Luffytaro22 Oct 26, 2023
8efb164
Add a rack sessions fix file
Luffytaro22 Oct 26, 2023
6db8fa5
Include the new rack file in the user controllers
Luffytaro22 Oct 26, 2023
1b92a45
Update schema
Luffytaro22 Oct 26, 2023
0458d5f
Modify migrations for accommodation
lRebornsl Oct 26, 2023
49b3e3b
Create CRUD methods for accommodations
lRebornsl Oct 26, 2023
6c60908
Add 'Reservations' controller
grauJavier Oct 26, 2023
9cf816d
Fix linters
lRebornsl Oct 26, 2023
54d503d
Merge pull request #42 from grauJavier/feature/crud-accommodation
lRebornsl Oct 26, 2023
4cacebe
Fixed linters
Luffytaro22 Oct 26, 2023
363fbac
Merge branch 'dev' into feature/crud-for-reservations
grauJavier Oct 26, 2023
89b1aab
Merge pull request #44 from grauJavier/feature/User_authentication
Luffytaro22 Oct 26, 2023
82b3221
Merge pull request #43 from grauJavier/feature/crud-for-reservations
grauJavier Oct 26, 2023
106046e
Add accommodation seeds
grauJavier Oct 27, 2023
00b45cb
Add routes for accommodation_details
grauJavier Oct 27, 2023
3617b25
Add accommodation_details controller
grauJavier Oct 27, 2023
2e55489
Create cities controller
Luffytaro22 Oct 27, 2023
f1daf59
Config routes
lRebornsl Oct 27, 2023
fd7ad32
Config seeds
lRebornsl Oct 27, 2023
e381ecf
Fix linters
lRebornsl Oct 27, 2023
8e99d07
Merge pull request #45 from grauJavier/feature/improve-controllers
grauJavier Oct 27, 2023
a04f271
Rename models, controllers and files
grauJavier Oct 27, 2023
7236bc2
Modify migrations and models
lRebornsl Oct 27, 2023
faa0510
Merge pull request #46 from grauJavier/feature/refactor-database
grauJavier Oct 27, 2023
c701624
Add endpoint for reservations
grauJavier Oct 27, 2023
1c5ddbb
Insert new seeds
lRebornsl Oct 27, 2023
e44839b
Merge pull request #47 from grauJavier/feature/endpoint-reservations
grauJavier Oct 27, 2023
896f146
Merge pull request #48 from grauJavier/feature/seeds-config
Luffytaro22 Oct 27, 2023
d992fc7
Add a city variable
Luffytaro22 Oct 27, 2023
babb949
Make changes in controllers
lRebornsl Oct 30, 2023
e1bec9d
Solving n+1 issues
lRebornsl Oct 30, 2023
55a9e66
Fix linters
lRebornsl Oct 30, 2023
8bcb98e
Merge pull request #49 from grauJavier/feature/improve-api
lRebornsl Oct 30, 2023
898bbc9
Install rspec and factory bot
lRebornsl Oct 30, 2023
25c1d41
Install faker
lRebornsl Oct 30, 2023
5a3a2ce
Add factories reservations
grauJavier Oct 30, 2023
c58ef7f
Add factories files
lRebornsl Oct 30, 2023
97f6091
Add 'shoulda/matchers' gem
grauJavier Oct 30, 2023
2d30b7d
Config rails_helper
lRebornsl Oct 30, 2023
b999d46
Merge branch 'feature/tests' of github.com:grauJavier/final-capstone-…
lRebornsl Oct 30, 2023
e9f5820
Linters Fix
grauJavier Oct 30, 2023
35cacc4
Update for reservations functioning
grauJavier Oct 30, 2023
1bac205
Add city to factories
grauJavier Oct 30, 2023
bfac14f
Fix operator
grauJavier Oct 30, 2023
40df367
Add test for reservation model
grauJavier Oct 30, 2023
7473ff7
Delete unnecesary test folder
grauJavier Oct 30, 2023
cfbadf1
Create the user model test
Luffytaro22 Oct 30, 2023
3ba2d60
Install rails-controller-testing gem
Luffytaro22 Oct 30, 2023
6037024
Fix name length
grauJavier Oct 30, 2023
0aaa9f1
Add test for reservations request
grauJavier Oct 30, 2023
903cd49
Merge branch 'feature/tests' of github.com:grauJavier/final-capstone-…
Luffytaro22 Oct 30, 2023
ff83119
Create user request tests
Luffytaro22 Oct 30, 2023
288a209
Create cities request and model tests
Luffytaro22 Oct 30, 2023
d44eaa1
Create model test for place and detail
lRebornsl Oct 30, 2023
de3aea4
Create requests tests for place and detail
lRebornsl Oct 30, 2023
590deb4
Fix linters
lRebornsl Oct 30, 2023
345340b
Fix date value on test
grauJavier Oct 31, 2023
1bc4014
Merge pull request #50 from grauJavier/feature/tests
grauJavier Oct 31, 2023
cc6b476
Change database migrations
Luffytaro22 Oct 31, 2023
b3112ff
Change models associations
Luffytaro22 Oct 31, 2023
e9cbbb0
Modify reservation routes with places routes
Luffytaro22 Oct 31, 2023
10c6a16
Change the controllers following the new associations
Luffytaro22 Oct 31, 2023
6c3ecdc
Modify the tests with the new changes
Luffytaro22 Oct 31, 2023
c6abce1
Merge pull request #52 from grauJavier/feature/Refactor-DB
lRebornsl Oct 31, 2023
95f1f57
Modify to create one 'Place' per 'City'
grauJavier Nov 2, 2023
7c27000
Update photo urls for seeds
grauJavier Nov 2, 2023
0d6dd57
Update photo api fetch for square images
grauJavier Nov 2, 2023
3ff71e8
Update reservation index controller to include city and place
Luffytaro22 Nov 2, 2023
8418850
Linters Fix
grauJavier Nov 2, 2023
93532b5
Linters Fix
grauJavier Nov 2, 2023
f4e0746
Add functionality to filter all 'Places' by params
grauJavier Nov 2, 2023
f60556b
Modify seed
lRebornsl Nov 5, 2023
88327ce
Change json reservation response when creating a new one
Luffytaro22 Nov 7, 2023
f0aa601
Merge branch 'dev' of github.com:grauJavier/final-capstone-back-end i…
Luffytaro22 Nov 7, 2023
f171305
Linter fix
grauJavier Nov 7, 2023
549a690
Add query filter by user_id
grauJavier Nov 7, 2023
40663be
Include city_id on render json
grauJavier Nov 7, 2023
b97677e
Modify place model
lRebornsl Nov 7, 2023
14f97f4
Merge branch 'dev' of github.com:grauJavier/final-capstone-back-end i…
lRebornsl Nov 7, 2023
0f2236f
Add new users and seed places with all of them
grauJavier Nov 8, 2023
08798fb
Add city name to the API reply for details
grauJavier Nov 8, 2023
d2e6b93
Merge branch 'dev' of https://github.com/grauJavier/final-capstone-ba…
grauJavier Nov 8, 2023
39f8ce4
Add city name to JSON response in PlacesController
grauJavier Nov 8, 2023
222331e
Add dynamic property names and types to seed data
grauJavier Nov 8, 2023
582686d
Modify test
lRebornsl Nov 8, 2023
28995c8
Install rswag gem
Luffytaro22 Nov 9, 2023
26596cc
Add rswag configuration files
Luffytaro22 Nov 10, 2023
92d27da
Add user_spec into integration folder
lRebornsl Nov 10, 2023
210b3dd
Add cities_spec into integration folder
lRebornsl Nov 10, 2023
02138e1
Add places_spec into integration folder
lRebornsl Nov 10, 2023
7c642c6
Add details_spec into integration folder
lRebornsl Nov 10, 2023
7ad6a4a
Add reservations_spec into integration folder
lRebornsl Nov 10, 2023
224e7a0
Add swagger file
lRebornsl Nov 10, 2023
f1984a6
Modify routes
lRebornsl Nov 10, 2023
fa0485d
Modify routes
lRebornsl Nov 10, 2023
e0102dc
Modify swagger
lRebornsl Nov 10, 2023
364bb5c
Fix linters
Luffytaro22 Nov 13, 2023
6f865d1
Merge pull request #53 from grauJavier/feature/API-documentation
Luffytaro22 Nov 14, 2023
870cda2
Update production database configuration to use
grauJavier Nov 14, 2023
51ffef7
Modify README file
lRebornsl Nov 14, 2023
ffd0fba
Modify devise.rb
lRebornsl Nov 14, 2023
62e062f
Change Puma config and swagger.yaml file
Luffytaro22 Nov 14, 2023
41c8c6f
Merge pull request #54 from grauJavier/feature/Deploy
Luffytaro22 Nov 14, 2023
baffa31
Modify user devise jwt token
Luffytaro22 Nov 14, 2023
c4c3a9c
Modify the json response when the place is created
Luffytaro22 Nov 14, 2023
0e05e54
Fix linters
lRebornsl Nov 15, 2023
14f1eb8
Add LinkedIn profile link for Javier Grau
grauJavier Nov 15, 2023
4c7f963
Linter Fix
grauJavier Nov 15, 2023
d558160
Merge branch 'dev' of https://github.com/grauJavier/final-capstone-ba…
grauJavier Nov 15, 2023
24ecb76
Modify the jwt token in the credentials
Luffytaro22 Nov 15, 2023
cdddb2c
Resolve syntax error
Luffytaro22 Nov 15, 2023
17191dd
Fix linters
Luffytaro22 Nov 15, 2023
beea431
Handle errors when removing a place or reservation
Luffytaro22 Nov 15, 2023
84603db
Modify README file
lRebornsl Nov 16, 2023
d090ade
Merge branch 'dev' of github.com:grauJavier/final-capstone-back-end i…
lRebornsl Nov 16, 2023
44d8cf0
Add credentials setup
Luffytaro22 Nov 16, 2023
5e274fc
Update README.md
grauJavier Nov 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.

# Ignore git directory.
/.git/

# Ignore bundler config.
/.bundle

# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all default key files.
/config/master.key
/config/credentials/*.key

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

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

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/.keep
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.

# Mark the database schema as having been generated.
db/schema.rb linguist-generated

# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
config/credentials/*.yml.enc diff=rails_credentials
config/credentials.yml.enc diff=rails_credentials
30 changes: 30 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Linters

on: pull_request

env:
FORCE_COLOR: 1

jobs:
rubocop:
name: Rubocop
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-ruby@v1
with:
ruby-version: 3.1.x
- name: Setup Rubocop
run: |
gem install --no-document rubocop -v '>= 1.0, < 2.0' # https://docs.rubocop.org/en/stable/installation/
[ -f .rubocop.yml ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.rubocop.yml
- name: Rubocop Report
run: rubocop --color
nodechecker:
name: node_modules checker
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Check node_modules existence
run: |
if [ -d "node_modules/" ]; then echo -e "\e[1;31mThe node_modules/ folder was pushed to the repo. Please remove it from the GitHub repository and try again."; echo -e "\e[1;32mYou can set up a .gitignore file with this folder included on it to prevent this from happening in the future." && exit 1; fi
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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 environment files (except templates).
/.env*
!/.env*.erb

# 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 storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

# Ignore master key for decrypting credentials and more.
/config/master.key
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/final-capstone-back-end.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
60 changes: 60 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
AllCops:
NewCops: enable
Exclude:
- "db/**/*"
- "bin/*"
- "config/**/*"
- "Guardfile"
- "Rakefile"
- "node_modules/**/*"

DisplayCopNames: true

Layout/LineLength:
Max: 120
Metrics/MethodLength:
Include:
- "app/controllers/*"
- "app/models/*"
Max: 20
Metrics/AbcSize:
Include:
- "app/controllers/*"
- "app/models/*"
Max: 50
Metrics/ClassLength:
Max: 150
Metrics/BlockLength:
AllowedMethods: ['describe']
Max: 30

Style/Documentation:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/EachForSimpleLoop:
Enabled: false
Style/AndOr:
Enabled: false
Style/DefWithParentheses:
Enabled: false
Style/FrozenStringLiteralComment:
EnforcedStyle: never

Layout/HashAlignment:
EnforcedColonStyle: key
Layout/ExtraSpacing:
AllowForAlignment: false
Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented
Lint/RaiseException:
Enabled: false
Lint/StructNewOverride:
Enabled: false
Style/HashEachMethods:
Enabled: false
Style/HashTransformKeys:
Enabled: false
Style/HashTransformValues:
Enabled: false
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-3.2.2
59 changes: 59 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# syntax = docker/dockerfile:1

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.2.2
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base

# Rails app lives here
WORKDIR /rails

# Set production environment
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development"


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build gems
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config

# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile

# Copy application code
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/


# Final stage for app image
FROM base

# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl libvips postgresql-client && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /rails /rails

# Run and own only the runtime files as a non-root user for security
RUN useradd rails --create-home --shell /bin/bash && \
chown -R rails:rails db log storage tmp
USER rails:rails

# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]
68 changes: 68 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
source 'https://rubygems.org'

ruby '3.2.2'

# .env file support
gem 'dotenv-rails'

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

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

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

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

# Use Redis adapter to run Action Cable in production
# gem "redis", ">= 4.0.1"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[windows jruby]

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

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

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

# User authentication
gem 'devise'
gem 'devise-jwt'
gem 'jsonapi-serializer'

gem 'rswag-api'
gem 'rswag-ui'

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'debug', platforms: %i[mri windows]
gem 'factory_bot_rails'
gem 'faker'
gem 'httparty'
gem 'rack-test'
gem 'rails-controller-testing'
gem 'rspec-rails', '>= 3.9.0'
gem 'rswag-specs'
gem 'shoulda-matchers'
end

group :development do
gem 'bullet', group: 'development'
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
end

gem 'rubocop', '>= 1.0', '< 2.0'
Loading
Loading