Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
8bac7df
adding in items array for each category fetched or added
kouitayakul Jul 22, 2021
9997770
fixed drag and drop, added buttons for going back and finishing, adde…
kouitayakul Jul 22, 2021
44d0b7a
Generate token during user signup
tmdenddl Jul 26, 2021
e8fcdba
Creating new token during login
tmdenddl Jul 26, 2021
9561361
only update user for settings fields that are changed
chantalchung Jul 26, 2021
80e4bb9
Logout done
tmdenddl Jul 27, 2021
6b0c0f5
Including cred in the post method
tmdenddl Jul 27, 2021
af62f09
Token persists, just need to fetch user on top level
tmdenddl Jul 27, 2021
eb163c4
Logout the user
tmdenddl Jul 27, 2021
161bbdb
Refactoring some codes
tmdenddl Jul 27, 2021
21b17c4
persist items when clicking back, add endpoints for receipt and items
chantalchung Jul 27, 2021
b5a7183
fix update settings
chantalchung Jul 28, 2021
861b79e
use correct addItems for now
chantalchung Jul 28, 2021
1700f15
notification
ktory1 Jul 28, 2021
7cb8a40
Deploy
tmdenddl Jul 28, 2021
84f6e87
Testing it on deploy branch
tmdenddl Jul 28, 2021
578d845
Delete yarn.lock
tmdenddl Jul 28, 2021
eaac0ba
Update package.json
tmdenddl Jul 28, 2021
c5022c5
Removing npm install
tmdenddl Jul 28, 2021
ac00668
Deploy on deploy branch
tmdenddl Jul 28, 2021
e57a6b2
Test deploy
tmdenddl Jul 28, 2021
260aa29
Update package.json
tmdenddl Jul 28, 2021
5f3b44c
Update package.json
tmdenddl Jul 28, 2021
a0ab5d8
test
tmdenddl Jul 28, 2021
a0db1bf
test deploy
chantalchung Jul 28, 2021
c5bac8b
ddd
tmdenddl Jul 28, 2021
b054682
Update package.json
tmdenddl Jul 28, 2021
0c51f9b
test again
chantalchung Jul 28, 2021
5018a0d
Test
tmdenddl Jul 28, 2021
9c6c96a
test deploy again
chantalchung Jul 28, 2021
ee8905e
Deploy
tmdenddl Jul 28, 2021
0c3e2f9
install dependencies
chantalchung Jul 28, 2021
70aa974
Update package.json
tmdenddl Jul 28, 2021
ea7c2a6
test build
chantalchung Jul 28, 2021
82f732c
test deploy
tmdenddl Jul 28, 2021
5a079f3
test changes
chantalchung Jul 28, 2021
9168906
Update deploy.yml
tmdenddl Jul 28, 2021
39f1b30
Merge pull request #48 from chntlc/deploy
tmdenddl Jul 28, 2021
8b7d8ce
don't install after build
chantalchung Jul 28, 2021
7bd7712
change build
chantalchung Jul 28, 2021
9579087
add back build script
chantalchung Jul 28, 2021
0fecdfb
Refactoring the codes
tmdenddl Jul 28, 2021
e1678f1
More refactoring
tmdenddl Jul 28, 2021
afdfbc0
User information refreshed on Dashboard
tmdenddl Jul 28, 2021
99a3de8
test frontend changes
chantalchung Jul 28, 2021
8d6977d
add branches to workflow, add todo, undo test changes
chantalchung Jul 28, 2021
ab144f6
update scripts so we can develop locally
chantalchung Jul 29, 2021
ce4e9ab
Revert "Merge pull request #48 from chntlc/deploy"
chantalchung Jul 29, 2021
e27444e
remove commented code
chantalchung Jul 29, 2021
d8a22a6
remove logging of env variables
chantalchung Jul 29, 2021
c43c6f5
able to fetch user state when refreshing the page
tmdenddl Jul 30, 2021
8b0b999
Handling edge cases for refreshing the page
tmdenddl Jul 30, 2021
2ebc855
conditional routing after submit
chantalchung Jul 30, 2021
c8bce5e
customizable profile pic
ktory1 Jul 30, 2021
f8db0af
Merge pull request #50 from chntlc/project-5-revert
chntlc Jul 31, 2021
915d324
fix workflow and test
chantalchung Jul 31, 2021
e089f7a
undo text changes, remove test-deploy from branches
chantalchung Jul 31, 2021
e0dab2d
Merge branch 'project-5' into test-deploy
chantalchung Jul 31, 2021
5361faf
Refactoring
tmdenddl Jul 31, 2021
06032e5
fix db string
chantalchung Jul 31, 2021
db02a58
Merge pull request #51 from chntlc/test-deploy
chntlc Jul 31, 2021
86b5cca
Merge pull request #53 from chntlc/project5-kevin
tmdenddl Jul 31, 2021
92ef37d
Delete yarn.lock
tmdenddl Jul 31, 2021
488e42d
Merge pull request #54 from chntlc/project5-kevin
tmdenddl Jul 31, 2021
272c41d
Removing localhost api calls
tmdenddl Jul 31, 2021
bac0732
Merge pull request #55 from chntlc/project5-kevin
tmdenddl Jul 31, 2021
3851d3c
merging thomas' work to project5
ktory1 Jul 31, 2021
a5f915e
more merge conflicts resolved
ktory1 Jul 31, 2021
ee2118e
http condition updated
ktory1 Jul 31, 2021
4cffbf1
Merge pull request #56 from chntlc/project-5-thomas
ktory1 Jul 31, 2021
9d8749d
project-5 updates
kouitayakul Jul 31, 2021
fbad82e
fixed merge conflicts
kouitayakul Jul 31, 2021
ae89b87
change to wildcard
ktory1 Jul 31, 2021
2d1ed85
Merge pull request #57 from chntlc/project-5-thomas
ktory1 Jul 31, 2021
5dd215f
Merge pull request #46 from chntlc/project-5-kouitayakul
kouitayakul Jul 31, 2021
a883209
Merge branch 'project-5' into project-5-chantal
chantalchung Jul 31, 2021
7990332
remove comments
chantalchung Jul 31, 2021
c184ad4
Merge pull request #58 from chntlc/project-5-chantal
chntlc Jul 31, 2021
16c24d6
fix window replace, remove buttons
chantalchung Jul 31, 2021
795b932
fix filter view height
chantalchung Jul 31, 2021
dcfeb5d
Merge pull request #60 from chntlc/project-5-chantal
chntlc Jul 31, 2021
c28a764
fix dashboard money digits
ktory1 Jul 31, 2021
343631a
Merge pull request #61 from chntlc/project-5-thomas
ktory1 Jul 31, 2021
b12bbc9
fix bugs on view & report page
ktory1 Jul 31, 2021
de3943d
Merge pull request #62 from chntlc/project-5-thomas
ktory1 Jul 31, 2021
24298bd
Update README.md
chntlc Jul 31, 2021
4038e7f
bugfix for dashboard, adding categories
chantalchung Jul 31, 2021
d70b4e7
update branches for deploy
chantalchung Jul 31, 2021
6bbcd0c
Merge pull request #64 from chntlc/final-project-chantal
chntlc Jul 31, 2021
3da167b
use week starting from midnight to midnight last day
chantalchung Jul 31, 2021
ea325ce
restructured project and delete items from categories when clicking back
kouitayakul Jul 31, 2021
057409a
Merge pull request #65 from chntlc/final-project-chantal
kouitayakul Jul 31, 2021
bf8623b
Router working on production build
tmdenddl Aug 3, 2021
0e7a72a
Making individual calls for pages
tmdenddl Aug 3, 2021
4ea1e2c
Merge pull request #67 from chntlc/final-project-kevin
tmdenddl Aug 3, 2021
c0ae62c
Handling refresh
tmdenddl Aug 3, 2021
a113306
Merge pull request #68 from chntlc/final-project-kevin
tmdenddl Aug 3, 2021
0101c2b
present spendings to two decimal point
ktory1 Aug 4, 2021
8f05b51
Merge branch 'final-project' into final-project-kouitayakul
kouitayakul Aug 4, 2021
7bcf4f5
Refactoring some codes
tmdenddl Aug 4, 2021
4b42a49
Merge pull request #69 from chntlc/final-project-kevin
tmdenddl Aug 4, 2021
d44d6b5
More refactoring
tmdenddl Aug 5, 2021
d99c3b6
Update README.md
tmdenddl Aug 5, 2021
657a41e
Merge pull request #71 from chntlc/final-project-kevin
tmdenddl Aug 5, 2021
02bbb5c
fix minor bug in report page redirection
ktory1 Aug 5, 2021
b1d47e6
merge conflict with final-project branch resolved
ktory1 Aug 5, 2021
2051560
cleanup, put correct category id in default
chantalchung Aug 8, 2021
4a9e28e
Merge pull request #72 from chntlc/final-project-thomas
ktory1 Aug 9, 2021
dbfd474
Merge pull request #73 from chntlc/final-project-chantal
chntlc Aug 9, 2021
9742397
cleaned up code, default categories cannot be editted
kouitayakul Aug 9, 2021
7b5fd82
fixed merge conflicts
kouitayakul Aug 9, 2021
49309b2
took out console logs and prettified files
kouitayakul Aug 9, 2021
efa5d2d
Update README.md
chntlc Aug 9, 2021
bb011fe
cannot edit name to default name
kouitayakul Aug 9, 2021
7baf8cf
Merge pull request #66 from chntlc/final-project-kouitayakul
kouitayakul Aug 9, 2021
5fec7ea
Update README.md
chntlc Aug 9, 2021
74e4040
fetch summary
chantalchung Aug 9, 2021
bc27cad
Merge pull request #75 from chntlc/chntlc-patch-1
chntlc Aug 9, 2021
e4d390b
Merge pull request #76 from chntlc/final-project-chantal-2
chntlc Aug 9, 2021
8e647a0
handle report page with no spending item
ktory1 Aug 9, 2021
2811317
resolving conflicts with final-project
ktory1 Aug 9, 2021
457d44f
Merge pull request #77 from chntlc/final-project-thomas
ktory1 Aug 9, 2021
929386c
hotfix
kouitayakul Aug 9, 2021
71797e3
Merge branch 'final-project' into final-project-kouitayakul
kouitayakul Aug 9, 2021
4e497b0
Merge pull request #78 from chntlc/final-project-kouitayakul
kouitayakul Aug 9, 2021
7b5a42c
cleaned up hotfix
kouitayakul Aug 9, 2021
fe096a1
Merge branch 'final-project-kouitayakul' of https://github.com/chntlc…
kouitayakul Aug 9, 2021
b61fa9a
Merge pull request #79 from chntlc/final-project-kouitayakul
ktory1 Aug 9, 2021
6e38c70
change weekly summary to Sunday - Saturday
chantalchung Aug 10, 2021
3982c48
Merge pull request #80 from chntlc/final-project-chantal-3
ktory1 Aug 10, 2021
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
24 changes: 24 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Workflow to deploy app to heroku
name: heroku-deploy
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main, final-project]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Deploy Heroku
uses: akhileshns/heroku-deploy@v3.0.0
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}
heroku_email: ${{ secrets.HEROKU_EMAIL }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
/backend/node_modules
/backend/bin/config
/backend/uploads/
/profilePics
/backend/.env

# testing
/coverage
Expand All @@ -20,6 +22,7 @@
.env.development.local
.env.test.local
.env.production.local
.env

npm-debug.log*
yarn-debug.log*
Expand Down
106 changes: 87 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,76 @@
# Budgeto

## Project Description
## 1. Project Description
Budgeto is a web application to assist individuals who want to manage their expenses and gain clear insights into their spending patterns. Seamlessly upload your receipts, edit & filter items by categories, and view the trends of your expenses. See more. Spend less. Budgeto.

## 2. Goals

### Minimal Requirements (3-5)
* Create user, login, logout ✅
* Choose a category ✅
* Ability to enter receipt info ✅
* Set a budget ✅
* See spending: daily, monthly (in a plain format) ✅

### "Standard" Requirements (3-7)
* Pie graph for spending ✅
* Line chart for spending ✅
* Show weekly summary on dashboard ✅
* Calendar to show total spending ✅
* Pick a date or specific timeframe (day, month & custom range) ✅

### Stretch Requirements (2-3)
* Warning messages for approaching budget ✅
* Notifications ✅
* Parse a receipt from an image ✅
* Create some kind of grocery list ❗ (╯°□°)╯︵ ┻━┻
* Based on analytics ❗ (╯°□°)╯︵ ┻━┻
* Generate suggestions ❗ (╯°□°)╯︵ ┻━┻
* Look for offers, or find best price for certain items ❗ (╯°□°)╯︵ ┻━┻

## 3. Tech

### Unit 1 (HTML, CSS, Javascript)
We used a global colour scheme and defined variables for these colours that could be used throughout the project. This helped keep our styles clean and consistent as we did not have random hex codes throughout the code. We used JavaScript in our frontend and backend, and specifically JSX with React to produce elements.

### Unit 2 (React)
We used React useState in combination with Redux toolkit for state management.

We fetched our backend APIs to handle CRUD operations while using useEffect hook to perform side effects such as fetching a user custom categories to be displayed on the application.

### Unit 3 (Node & Express)
We created a backend server using ExpressJs, connecting endpoints of HTTP requests from the frontend. We parsed the data fetched from the database, tailoring it to fit our needs before sending it back to the frontend.

### Unit 4 (MongoDB)
We used MongoDB to store user, item, category and receipt information. Each information is stored in a collection created using schemas. We use Mongoose to create collections and schemas and to fetch information from MongoDB.

### Unit 5 (Release Engineering)
We have modified the package.json to install the npm packages and to build a react-app which will be used to render pages on the production environment. We used GitHub actions to have continuous deployment of our app to Heroku. Heroku will start up the server which serves the react-app to render different pages using the production build.

## 4. Above and Beyond Functionality
In addition to allowing users to manually add rows of inputs to add their spendings, we also implemented a functionality where users can upload a receipt to record their transactions. We leveraged an open source OCR library called Tesseract.js to parse a receipt image into base64 text string. Using regular expressions, we were able to filter for information needed to create transactions that capture the user’s spendings.

## 5. Next Steps
We are planning to implement more analytics and provide suggestions to users based on their spending patterns (such as setting budgets for specific categories). As we support receipt uploading and can store items and business data, providing users with relevant store flyers or coupons would be valuable. In the future, we could look for similar items across different establishments and find the best prices. Generating a grocery list for frequently purchased items is also something we'd like to look into in the future.

## 6. Team Contributions

#### Chantal:
I worked on the general design and theme of our web application, choosing colour schemes, setting up reusable CSS variables and React components, and consolidating styles across the project. Also integrated Redux Toolkit for state management and setup the correct scripts and GitHub actions for Heroku deployment. I focused on general team organization, keeping track of issues that need to be worked on, setting reminders, and driving meetings.

#### Kass:
Leveraged Tesseract.js to parse a receipt image in order to extract relevant information to create a transaction. Implemented the flow of filtering receipt transactions by creating components and endpoints for handling CRUD operations on categories. Additionally, an open source library called react-beautiful-dnd was also used to enable an intuitive drag-and-drop functionality when filtering transactions.

#### Kevin:
My main focus in this project was to create a Local Authentication Strategy that uses jwtwebtoken library to create a token to maintain user session. User session will keep the user logged in during refresh of the page. When the user is not authenticated, he/she will not be able to route to different pages. Not authenticated users will only be able to access the Landing page. I have also worked with the team to set up GitHub Action for continuous deployment to Heroku.

#### Thomas:
Focused on the design and functionality of the View and the Report pages of the application. Paid extra attention to make the pages user-friendly and incorporated design libraries such as ‘AntDesign’ and ‘Chart.js’ for the aesthetic touch. Implemented a feature to choose and update the profile image of a user, storing the image as a base64 string in the database.

<hr />

<details><summary>Click for Old Project Description</summary>

### Who is it for?
* People who want to see their spending behaviour

Expand All @@ -29,27 +97,27 @@ Budgeto is a web application to assist individuals who want to manage their expe
## Project Task Requirements

### Minimal Requirements (3-5)
* Create user, login, logout
* Choose a category
* Ability to enter receipt info
* Set a budget
* See spending: daily, monthly (in a plain format)
* Create user, login, logout
* Choose a category
* Ability to enter receipt info
* Set a budget
* See spending: daily, monthly (in a plain format)

### "Standard" Requirements (3-7)
* Pie graph for spending
* Line chart for spending
* Show weekly summary on dashboard
* Calendar to show total spending
* Pick a date or specific timeframe (day, month & custom range)
* Pie graph for spending
* Line chart for spending
* Show weekly summary on dashboard
* Calendar to show total spending
* Pick a date or specific timeframe (day, month & custom range)

### Stretch Requirements (2-3)
* Warning messages for approaching budget
* Notifications
* Parse a receipt from an image
* Create some kind of grocery list
* Based on analytics
* Generate suggestions
* Look for offers, or find best price for certain items
* Warning messages for approaching budget
* Notifications
* Parse a receipt from an image
* Create some kind of grocery list ❗ (╯°□°)╯︵ ┻━┻
* Based on analytics ❗ (╯°□°)╯︵ ┻━┻
* Generate suggestions ❗ (╯°□°)╯︵ ┻━┻
* Look for offers, or find best price for certain items ❗ (╯°□°)╯︵ ┻━┻

## Task Breakdown
Choose a category:
Expand All @@ -69,5 +137,5 @@ Enter receipt info:
* Reports:
![KakaoTalk_20210528_231631916](https://user-images.githubusercontent.com/35110824/120060226-5e0cc300-c00b-11eb-8b3d-21fb815a46de.jpg)
![KakaoTalk_20210528_231631916_01](https://user-images.githubusercontent.com/35110824/120060227-5ea55980-c00b-11eb-9ae5-d972d288d40f.jpg)

</details>

65 changes: 54 additions & 11 deletions backend/app.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,82 @@
var createError = require("http-errors");
var express = require("express");
var path = require("path");
var cookieParser = require("cookie-parser");
var logger = require("morgan");
var cors = require("cors");
const createError = require("http-errors");
const express = require("express");
const path = require("path");
const cookieParser = require("cookie-parser");
const logger = require("morgan");
const cors = require("cors");
const bodyParser = require("body-parser");
const passport = require("passport");

require("./strategies/JwtStrategy");
require("./strategies/LocalStrategy");
require("./strategies/authenticate");

if (process.env.NODE_ENV !== "production") {
// Load environment variables from .env file in non prod environments
require("dotenv").config();
}

const indexRouter = require("./routes/index");
const usersRouter = require("./routes/users");
const dashboardRouter = require("./routes/dashboard");
const viewRouter = require("./routes/view");
const reportRouter = require("./routes/report");
const categoriesRouter = require("./routes/categories");
var app = express();
const receiptsRouter = require("./routes/receipts");

// setup CORS
app.use(cors());
app.options("*", cors());
var app = express();

// view engine setup
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "jade");

// Have Node serve the files for our built React app
app.use(express.static(path.resolve(__dirname, "../build")));

// All other GET requests not handled before will return our React app
app.get("/", (req, res) => {
res.sendFile(path.resolve(__dirname, "../build/index.html"));
});

app.get("/dashboard", (req, res) => {
res.sendFile(path.resolve(__dirname, "../build/index.html"));
});

app.get("/view", (req, res) => {
res.sendFile(path.resolve(__dirname, "../build/index.html"));
});

app.get("/add", (req, res) => {
res.sendFile(path.resolve(__dirname, "../build/index.html"));
});

app.get("/receiptUploaded", (req, res) => {
res.sendFile(path.resolve(__dirname, "../build/index.html"));
});

app.get("/report", (req, res) => {
res.sendFile(path.resolve(__dirname, "../build/index.html"));
});

app.use(logger("dev"));
app.use("/uploads", express.static("uploads"));
app.use(bodyParser.json());
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(cookieParser(process.env.COOKIE_SECRET));
app.use(express.static(path.join(__dirname, "public")));

app.use(cors({ credentials: true }));

app.use(passport.initialize());

app.use("/", indexRouter);
app.use("/users", usersRouter);
app.use("/dashboard", dashboardRouter);
app.use("/view", viewRouter);
app.use("/report", reportRouter);
app.use("/categories", categoriesRouter);
app.use("/receipts", receiptsRouter);

// catch 404 and forward to error handler
app.use(function (req, res, next) {
Expand Down
5 changes: 3 additions & 2 deletions backend/bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
var app = require("../app");
var debug = require("debug")("backend:server");
var http = require("http");
const config = require("./config");
const dotenv = require('dotenv').config({ path: __dirname + '/.env' });
const mongoose = require("mongoose");

/**
* Get port from environment and store in Express.
*/
Expand All @@ -27,7 +28,7 @@ var server = http.createServer(app);

mongoose
.connect(
`mongodb+srv://${config.mongoId}:${config.mongoPw}@budgeto.irn1u.mongodb.net/${config.mongoDb}?retryWrites=true&w=majority`,
`mongodb+srv://${process.env.MONGO_ID}:${process.env.MONGO_PW}@budgeto.irn1u.mongodb.net/${process.env.MONGO_DB}?retryWrites=true&w=majority`,
{
useNewUrlParser: true,
useUnifiedTopology: true,
Expand Down
Loading