Skip to content

bnjtgly/Rent-API

Repository files navigation

SimpleRent Tenant Application API

Prerequisites

Ruby Style Guide Ruby Style Guide

First-time setup

  1. install Ruby
  2. download and install postgresql. https://www.postgresql.org/download
  3. install RubyMine. https://www.jetbrains.com/ruby/download/#section=windows
  4. Run the following command.
$ gem install rails
$ bundle install

Database and Master key

Ask for the database.yml and master.key files.

Setup Database

$ rails db:create
$ rails db:migrate
$ rails db:seed

Running app on Docker

  1. Change the host in config/database.yml to 'db'.
  2. Install Docker. https://docs.docker.com/desktop/windows/install/
  3. Run the following command. Or click on the Run icon beside services in docker-compose.yml.
$ docker-compose up
  1. Run in a another terminal to migrate and seed data.
$ docker-compose run web rake db:create db:migrate db:seed

The server will run on localhost:3000.


Running app on localhost

  1. Clone the repo or pull deploy-to-dev branch.
  2. Run the following command.
$ cd sr_tenant_application_api
$ bundle install
$ rails s

The server will run on localhost:3000.


Local Setup as of February 18, 2022

  1. Follow the instructions in First-time setup. (Note: Set the password of postgres to root when installing postgresql.)
  2. Get a copy of database.yml and master.key.
  3. Clone the repository.
  4. Checkout to the development branch.
$ git fetch && git checkout deploy-to-dev
  1. Copy the database.yml and master.key to /config.
  2. Run the following command to setup the database.
$ rails db:create db:migrate db:seed
  1. Make sure that the postgresql is running. (In Ubuntu's case, run the following command)
$ sudo service postgresql start
  1. Run the following command to setup the project.
$ cd sr_tenant_application_api
$ bundle install
$ rails s

The server will run on localhost:3000.


Testing

$ rspec spec/requests

Folder Structure

  1. Model - It contains the models and data stored in our application's database.
  2. View - This folder contains the display templates to fill data in our application.
  3. Controller - All the controller files are stored here. A controller handles all the web requests from the user.
  4. Interactors - This folder have the appilcations business logic. It is called in controllers or organizers.
  5. Queries - It is a query object pattern that helps in decomposing the fat ActiveRecord models and keeping the code slim and readable by extracting complex SQL queries or scopes into the separated classes that are easy to reuse and test. This is currently used in Profile.
  6. Serializers - It convert a given object into a JSON format. Serializers control the particular attributes rendered when an object or model is converted into a JSON format.
  7. Uploaders - Carrierwave stores the configuration in this folder. Uploaders are included into some models.
  8. Validators - Custom validation for interactors.
  9. Services - It is a object pattern that can help separate business logic from controllers and models, enabling the models to be simply data layers and the controller entry point to the API. In the app, it is used to manipulate data. Such as; calculations, profile completion, getting the top agents or properties, etc.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages