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

Full-Stack Capstone - Booking an Appointment Application. #33

Merged
merged 131 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 111 commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
d407f76
Install Rails and linters
Wineshuga Nov 30, 2023
8553d50
Fix Linters
Wineshuga Nov 30, 2023
20a8416
Merge pull request #19 from tan12082001/setup_backend
hetrox8 Nov 30, 2023
a64796a
add database
hetrox8 Dec 1, 2023
60d0dd2
add dependancies
hetrox8 Dec 2, 2023
a1ad0a3
revert changes , mistake for wrong repo
hetrox8 Dec 2, 2023
cd9ad72
fix rubocop
hetrox8 Dec 2, 2023
316af0d
Update schema.rb
hetrox8 Dec 3, 2023
5fddb4b
add migrations
hetrox8 Dec 3, 2023
37bc714
Delete reservation migration file
Wineshuga Dec 3, 2023
afcb7fa
Create join table for user and cars
Wineshuga Dec 3, 2023
fd45069
Create schema file
Wineshuga Dec 3, 2023
7894059
Make database.yml file DRY
Wineshuga Dec 3, 2023
e57a395
Remove port from configuration
Wineshuga Dec 3, 2023
1ea39dd
Merge pull request #20 from tan12082001/setup_database
Wineshuga Dec 3, 2023
c9c2d2b
add models
hetrox8 Dec 4, 2023
bdb81cc
Merge pull request #21 from tan12082001/models_users
hetrox8 Dec 4, 2023
a251ccb
Create cars_controller index, show and create actions
Wineshuga Dec 4, 2023
2890f9b
Create api routes
Wineshuga Dec 4, 2023
a763574
Modify models
Wineshuga Dec 4, 2023
3d0b9e5
Merge pull request #22 from tan12082001/item_controller
Wineshuga Dec 4, 2023
6edff41
add authentication for user
hetrox8 Dec 4, 2023
ca90c1b
solve rubocop
hetrox8 Dec 4, 2023
61a90dc
modify file
hetrox8 Dec 5, 2023
ebfd222
Create index action for reservations
Wineshuga Dec 5, 2023
e23fe60
Add route for reservation index
Wineshuga Dec 5, 2023
2c0b83e
Update my reservation index to find user with id
Wineshuga Dec 5, 2023
5ce2227
Modify my reservation index route to use user id
Wineshuga Dec 5, 2023
5f98a8e
Add authentication to controller
Wineshuga Dec 5, 2023
f948e2b
add index
hetrox8 Dec 5, 2023
cc41cda
Add my reservation create action method
Wineshuga Dec 5, 2023
2692c30
Modify routes to create pages
Wineshuga Dec 5, 2023
aa5b8f8
Fix location and params errors
Wineshuga Dec 5, 2023
6411c8f
Fix rubocop issues
Wineshuga Dec 5, 2023
ab0a582
Merge pull request #25 from tan12082001/user_authentication
hetrox8 Dec 5, 2023
3e4d07e
Merge branch 'dev' of https://github.com/tan12082001/Vehicle-Booking-…
Wineshuga Dec 5, 2023
cbb70ef
Add user authentication in application controller
Wineshuga Dec 5, 2023
c1fce9b
Fix before action for authenticate api user
Wineshuga Dec 5, 2023
310c4ad
Add authentication on reservation controller
Wineshuga Dec 5, 2023
97ef622
Modify routes
Wineshuga Dec 5, 2023
dfcf31c
Add sample to seeds.rb
Wineshuga Dec 5, 2023
6c25064
implement delete
hetrox8 Dec 5, 2023
f8c9927
revert changes
hetrox8 Dec 6, 2023
1eff38e
revert changes
hetrox8 Dec 6, 2023
5d7274a
Merge branch 'dev' of https://github.com/tan12082001/Vehicle-Booking-…
hetrox8 Dec 6, 2023
1a12c7c
Merge pull request #26 from tan12082001/my_reservation_controller
Wineshuga Dec 6, 2023
3620c35
add delete functionality
hetrox8 Dec 6, 2023
430f9a0
solve rubocop
hetrox8 Dec 6, 2023
ec0c2b4
solve rubocop
hetrox8 Dec 6, 2023
da7051b
solve rubocop
hetrox8 Dec 6, 2023
40a8bfe
solve rubocop
hetrox8 Dec 6, 2023
f0e6652
enable authentication. left overs
hetrox8 Dec 6, 2023
a83928b
solve rubocop
hetrox8 Dec 6, 2023
2505c44
solve rubocop
hetrox8 Dec 6, 2023
56d4623
solve rubocop
hetrox8 Dec 6, 2023
3db7f4b
Merge pull request #27 from tan12082001/delete_actions
hetrox8 Dec 6, 2023
6bf1543
Modify cors.rb
Wineshuga Dec 6, 2023
cfa3bcf
Change localhost port to 4000
Wineshuga Dec 6, 2023
5aa2a41
Add jwt configuration
Wineshuga Dec 6, 2023
8c54d7a
Fix attribute name to username
Wineshuga Dec 6, 2023
9c6567e
Add jti migration
Wineshuga Dec 6, 2023
795df07
Add devise migration
Wineshuga Dec 6, 2023
47dbcf3
Update schema file
Wineshuga Dec 6, 2023
8fdc26a
Modify User model
Wineshuga Dec 6, 2023
3421186
Modify registration controller
Wineshuga Dec 6, 2023
167d7b9
Fix rubocop issue
Wineshuga Dec 6, 2023
3b60cec
Add authentication to cars controller
Wineshuga Dec 6, 2023
5909bd2
Change url path in create action
Wineshuga Dec 7, 2023
108dad8
Change url path in create action
Wineshuga Dec 7, 2023
d59a8cc
Configure cookie store
Wineshuga Dec 7, 2023
7688088
Modify create and destroy actions
Wineshuga Dec 7, 2023
ff749c0
Merge pull request #28 from tan12082001/fix_authentication_with_jwt
Wineshuga Dec 7, 2023
29aa308
Fix redirection path
Wineshuga Dec 9, 2023
95511e9
Remove unnecessary query
Wineshuga Dec 9, 2023
1294a6c
Extend jwt expiration time
Wineshuga Dec 9, 2023
159ede9
Fix exclusion of deleted cars from query
Wineshuga Dec 9, 2023
bdd52e3
Add image column to users table
Wineshuga Dec 9, 2023
5248e75
Include image to required params for cars
Wineshuga Dec 9, 2023
4ce7bc4
Add image column to cars table
Wineshuga Dec 9, 2023
78d22a1
Add image validation to car model
Wineshuga Dec 9, 2023
8e3d398
Show all data of car
Wineshuga Dec 9, 2023
b3abd90
create tests for models
hetrox8 Dec 11, 2023
9910e74
Fix session destroy method
Wineshuga Dec 11, 2023
c8e2bf5
Fix rubocop issues
Wineshuga Dec 11, 2023
7517f9b
modify tests, modify order for associations in models
hetrox8 Dec 11, 2023
312a5e5
Merge pull request #29 from tan12082001/fix_bugs
Wineshuga Dec 11, 2023
849c1ac
Update README.md
hetrox8 Dec 11, 2023
0905323
Merge branch 'dev' into test-models
hetrox8 Dec 12, 2023
0c09917
Update rails_helper.rb
hetrox8 Dec 12, 2023
a6cdadc
Update spec_helper.rb
hetrox8 Dec 12, 2023
993bddd
Update spec_helper.rb
hetrox8 Dec 12, 2023
8dcf457
Update Gemfile
hetrox8 Dec 12, 2023
d13dfd2
Update Gemfile
hetrox8 Dec 12, 2023
068b3c5
Update Gemfile
hetrox8 Dec 12, 2023
a6da522
Update Gemfile
hetrox8 Dec 12, 2023
391620b
Update README.md
hetrox8 Dec 12, 2023
8a6caf7
Update README.md
hetrox8 Dec 12, 2023
2774efc
Update README.md
hetrox8 Dec 12, 2023
d08f3b7
Install helpers
Wineshuga Dec 12, 2023
9431d77
Fix rubocop issues
Wineshuga Dec 12, 2023
03f47c0
Create cars_controller tests
Wineshuga Dec 12, 2023
7da1530
Create my_reservations_controller tests
Wineshuga Dec 12, 2023
2e36afe
Create registrations_controller tests
Wineshuga Dec 12, 2023
08cd76a
Create sessions_controller tests
Wineshuga Dec 12, 2023
8094999
Merge pull request #30 from tan12082001/test-models
hetrox8 Dec 12, 2023
6458fb3
solved failing test for car
hetrox8 Dec 12, 2023
7a56d9f
Merge pull request #32 from tan12082001/test-models-fix
hetrox8 Dec 12, 2023
8713a3b
all test pass
hetrox8 Dec 12, 2023
1596f8b
Merge pull request #31 from tan12082001/controllers_tests
hetrox8 Dec 12, 2023
50ae9db
update the origins path
tan12082001 Dec 13, 2023
843d310
Merge pull request #34 from tan12082001/update-cors-config
Wineshuga Dec 13, 2023
3f9bdd1
add gems for api documentation
hetrox8 Dec 13, 2023
4bf1f3a
try fix api
hetrox8 Dec 13, 2023
42a1c27
Update the index response body by car ref from soft deletes
tan12082001 Dec 13, 2023
bc35fd5
solve agin
hetrox8 Dec 14, 2023
1ec8f7c
swagger fixed
hetrox8 Dec 14, 2023
e818b9d
Image Validation
Simpleshaikh1 Dec 14, 2023
bdc97fc
Merge pull request #35 from tan12082001/reservations-response-bug-fix
tan12082001 Dec 14, 2023
915d2f1
Image Validation
Simpleshaikh1 Dec 14, 2023
a4479df
Image Validation
Simpleshaikh1 Dec 14, 2023
e8a0bb2
Merge branch 'dev' of https://github.com/tan12082001/Vehicle-Booking-…
Simpleshaikh1 Dec 14, 2023
2e2c572
Merge pull request #36 from tan12082001/Image-Fix
Simpleshaikh1 Dec 14, 2023
f8e498a
Modify documentation
Wineshuga Dec 14, 2023
7fbbe5e
Edit README
Wineshuga Dec 14, 2023
b789686
Delete test folder as suggested
Wineshuga Dec 14, 2023
b5491a8
Add schemas and delete car path
Wineshuga Dec 14, 2023
1f14db9
Merge branch 'dev' into api-documentation
Wineshuga Dec 14, 2023
a1d8493
Fix rubocop issues
Wineshuga Dec 14, 2023
ac73cd2
Add api docs details to readme file
Wineshuga Dec 14, 2023
15547c8
fix descriptions in api-doc
Wineshuga Dec 14, 2023
2b5a6a0
Merge pull request #37 from tan12082001/api-documentation
Wineshuga Dec 14, 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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The mobile view has not been implemented yet. I understand this is a work in progress or a future update.

tip: If you feel you've completed 90% of the features, kindly say in your PR description what features will be left out to give a heads-up to the final evaluator and reviewers.


# 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
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
64 changes: 64 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 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/

# Adjust binfiles to be executable on Linux
RUN chmod +x bin/* && \
sed -i "s/\r$//g" bin/* && \
sed -i 's/ruby\.exe$/ruby/' bin/*


# 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"]
46 changes: 46 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
source 'https://rubygems.org'
ruby '3.2.2'

# 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"
gem 'psych', '~> 4.0.1'
gem 'rails', '~> 7.1.2'

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 'rspec-rails'
end

group :development do
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
gem 'devise', '~> 4.9'
gem 'rails-controller-testing'
end

gem 'database_cleaner'
gem 'devise-jwt'
gem 'factory_bot_rails'
gem 'paranoia', '~> 2.5'
gem 'rack-cors'
gem 'rswag'
gem 'shoulda-matchers'
Loading
Loading