An open API service indexing awesome lists of open source software.

https://github.com/edd-ie/pockets-b

Api for financial tracking and budgeting web application
https://github.com/edd-ie/pockets-b

api finance finance-tracker rails

Last synced: 7 months ago
JSON representation

Api for financial tracking and budgeting web application

Awesome Lists containing this project

README

          

# [POCKETS(backend)](https://ai-hub-1.vercel.app/)

The API to [Pockets](https://pocketswatch.vercel.app/)

## Table of Contents

1. [Getting started](#Getting-started)
2. [Usage](#Usage)
3. [Relationships](#relations)
3. [Models](#Methods)
- [Users](#user)
- [Cards](#card)
- [Sim](#sim)
- [Saving](#saving)
- [Card savings](#save_cards)
- [Sim savings](#save_sims)
4. [Routes](#routes)
6. [Contributors](#contributors)
7. [Licenses](#license)
8. [Resources](#Sources)

## Getting started

The project runs on rails and postgesql

### 1. Website

You can access the site on [pockets-backend](https://pockets.onrender.com/)

### 2. Cloning

**Clone** the project files to your local repository:

- HTTPS => `https://github.com/edd-ie/pockets-b.git`
- SSH => `git@github.com:edd-ie/pockets-b.git`
- Git CLI => `gh repo clone edd-ie/pockets-b`

Open the terminal and install all dependencies using.

```
bundle install
```

After installation run this command to start the rails server

```
rails s
```

Your default browser will be launched and the homepage will be rendered

## Relationships
![Alt text](database.drawio.png)

### One-to-Many
Users has many:
- Cards
- Sims
- Savings

Card has many:
- Transactions
- Save contributions

Sim has many:
- Transactions
- Save contributions

Card has many:
- Card contributions
- sim contributions

### Many-to-Many
User has many:
- Card transactions through cards
- Sim transactions through sims
- Sim contributions through savings
- Card contributions through savings

Savings has many:
- Cards through cards savings
- Sims through sim savings

Card has many:
- Savings through card savings

Sim has many:
- Savings through Sim savings

## Models

This handles the logic for the data sourcing from the data
- User - User logic

- Card - card Logic

- Sim - sim Logic

- Saving - savings logic

- SaveCard - Card savings logic

- SaveSim - Sim saving logic

## Routes
The routes the have full http requests functionality(GET, POST, DELETE, PATCH, PUT)
```
/users
/savings
/cards
/sims
/save_cards
/save_sims
/sessions
```

### Custom routes
For added functionality some custom routes were created to help get specific data from database
```
patch "/changePass", to: "users#changePass"

get "/simCat/:id", to: "users#simCat"
get "/cardCat/:id", to: "users#cardCat"

post '/addSaveCard/:id', to: "savings#addCardSave"
post '/addSaveSim/:id', to: "savings#addSimSave"

get "/topSim/:id", to: "users#topSim"
get "/topCard/:id", to: "users#topCard"

get "/userSims/:id", to: "users#userSim"
get "/userCards/:id", to: "users#userCard"

get "/simUsage/:id", to: "users#simUsage"
get "/cardUsage/:id", to: "users#cardUsage"

get '/uSimBal/:id', to: "users#simBal"
get '/uCardBal/:id', to: "users#cardBal"

get '/userSaves/:id', to: "users#userSavings"

post "/login", to: "sessions#create"
post "/signup", to: "users#create"
get "/me", to: "users#show"
delete "/logout", to: "sessions#destroy"
```

## Contributors

This project was a team effort from the following individuals :

- [Edd.ie](https://github.com/edd-ie)
- [Glory](https://github.com/Nkathaglow)
- [Austin](https://github.com/Naulikha)

## Licenses

The project is licensed under the [BSD 3-Clause "New" or "Revised" License](https://github.com/highlightjs/highlight.js/blob/main/LICENSE), thus redistribution and use in source and binary forms are permitted provided that the conditions are met

## Resources
WebPage -> [pockets backend](https://pockets.onrender.com/)

Database hosting-> [Postgres](https://dashboard.render.com/)