-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
229 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,49 @@ | ||
# money | ||
# Money | ||
|
||
## About | ||
This app is a app for managing your finances, you can control many accounts and transfer money between them, so it can be used for domestical purposes but also for a big institution. | ||
|
||
## Design Patterns | ||
In this app I use several design patterns as: | ||
``` | ||
-MVC | ||
-Publisher/Subscriber | ||
-Router | ||
-Proxy | ||
-ORM | ||
``` | ||
|
||
## No Frameworks | ||
I created this app to prove to myself I could created a whole app without using any framework, this app contains my own implementation of important features of some frameworks like JQuery and Laravel. | ||
|
||
### List of features: | ||
|
||
####JQuery | ||
- $("<tag">) and $("css selector") of JQuery | ||
- node.show() and .hide(); | ||
- $.post sending JSON | ||
- etc. | ||
|
||
####Laravel | ||
- Router with path params | ||
- MVC | ||
- Eloquent ORM | ||
- database config file | ||
- middleware of authetification for some routes | ||
|
||
####Node.js | ||
- EventEmitter | ||
|
||
####Moment.js | ||
- now | ||
- formatDate in European/South American format or English format | ||
- etc. | ||
|
||
*But I do use Bootstrap and FontAwesome* | ||
|
||
#### Important | ||
I have a .htaccess file in this page but I can't upload it on github. Anyway, the code is right below. | ||
|
||
RewriteEngine on | ||
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC] | ||
RewriteRule (.*) routes.php [QSA,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
//this index.php is necessary to show that this is a php app to Heroku | ||
//but my .htaccess uses routes.php as the target file of all requests |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
-- MySQL Workbench Forward Engineering | ||
|
||
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; | ||
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; | ||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; | ||
|
||
-- ----------------------------------------------------- | ||
-- Schema money | ||
-- ----------------------------------------------------- | ||
-- ----------------------------------------------------- | ||
-- Schema heroku_5dcc28ee8717c6d | ||
-- ----------------------------------------------------- | ||
|
||
-- ----------------------------------------------------- | ||
-- Table `user` | ||
-- ----------------------------------------------------- | ||
DROP TABLE IF EXISTS `user` ; | ||
|
||
CREATE TABLE IF NOT EXISTS `user` ( | ||
`id` INT NOT NULL AUTO_INCREMENT, | ||
`first_name` VARCHAR(200) NOT NULL, | ||
`last_name` VARCHAR(200) NOT NULL, | ||
`email` VARCHAR(200) NOT NULL, | ||
`password` VARCHAR(200) NOT NULL, | ||
PRIMARY KEY (`id`), | ||
UNIQUE INDEX `email_UNIQUE` (`email` ASC)) | ||
ENGINE = InnoDB; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `account` | ||
-- ----------------------------------------------------- | ||
DROP TABLE IF EXISTS `account` ; | ||
|
||
CREATE TABLE IF NOT EXISTS `account` ( | ||
`id` INT(11) NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(45) NULL DEFAULT 'new account', | ||
`isArchived` INT(11) NOT NULL DEFAULT 0, | ||
`user_id` INT NOT NULL, | ||
PRIMARY KEY (`id`), | ||
INDEX `fk_account_user1_idx` (`user_id` ASC), | ||
CONSTRAINT `fk_account_user` | ||
FOREIGN KEY (`user_id`) | ||
REFERENCES `user` (`id`) | ||
ON DELETE NO ACTION | ||
ON UPDATE NO ACTION) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `category` | ||
-- ----------------------------------------------------- | ||
DROP TABLE IF EXISTS `category` ; | ||
|
||
CREATE TABLE IF NOT EXISTS `category` ( | ||
`id` INT(11) NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(200) NOT NULL, | ||
`isArchived` INT(11) NOT NULL DEFAULT 0, | ||
`user_id` INT NOT NULL, | ||
PRIMARY KEY (`id`), | ||
INDEX `fk_category_user1_idx` (`user_id` ASC), | ||
CONSTRAINT `fk_category_user` | ||
FOREIGN KEY (`user_id`) | ||
REFERENCES `user` (`id`) | ||
ON DELETE NO ACTION | ||
ON UPDATE NO ACTION) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `transaction` | ||
-- ----------------------------------------------------- | ||
DROP TABLE IF EXISTS `transaction` ; | ||
|
||
CREATE TABLE IF NOT EXISTS `transaction` ( | ||
`id` INT(11) NOT NULL AUTO_INCREMENT, | ||
`type` VARCHAR(45) NULL DEFAULT 'spending', | ||
`description` VARCHAR(200) NULL DEFAULT NULL, | ||
`value` DECIMAL(10,2) NULL DEFAULT '0.00', | ||
`date` DATETIME NULL DEFAULT CURRENT_TIMESTAMP, | ||
`account_origin_id` INT(11) NOT NULL, | ||
`account_destiny_id` INT(11) NULL DEFAULT NULL, | ||
`category_id` INT(11) NOT NULL, | ||
PRIMARY KEY (`id`), | ||
INDEX `fk_transactions_account_origin` (`account_origin_id` ASC), | ||
INDEX `fk_transactions_account_destiny` (`account_destiny_id` ASC), | ||
INDEX `fk_transaction_category_id` (`category_id` ASC), | ||
CONSTRAINT `fk_transaction_category` | ||
FOREIGN KEY (`category_id`) | ||
REFERENCES `category` (`id`) | ||
ON DELETE NO ACTION | ||
ON UPDATE NO ACTION, | ||
CONSTRAINT `fk_transactions_account_destiny` | ||
FOREIGN KEY (`account_destiny_id`) | ||
REFERENCES `account` (`id`), | ||
CONSTRAINT `fk_transactions_account_origin` | ||
FOREIGN KEY (`account_origin_id`) | ||
REFERENCES `account` (`id`)) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- View `view_account` | ||
-- ----------------------------------------------------- | ||
DROP VIEW IF EXISTS `view_account` ; | ||
CREATE OR REPLACE VIEW `view_account` AS | ||
SELECT | ||
`id`, `name`, `user_id` | ||
FROM | ||
`account` | ||
WHERE | ||
`isArchived` = 0; | ||
|
||
-- ----------------------------------------------------- | ||
-- View `view_category` | ||
-- ----------------------------------------------------- | ||
DROP VIEW IF EXISTS `view_category` ; | ||
CREATE OR REPLACE VIEW `view_category` AS | ||
SELECT | ||
`id`, `name`, `user_id` | ||
FROM | ||
`category` | ||
WHERE | ||
`isArchived` = 0; | ||
|
||
SET SQL_MODE=@OLD_SQL_MODE; | ||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; | ||
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
function digit2(number) { | ||
return ("0" + number).slice(-2); | ||
} | ||
|
||
function now() { | ||
const date = new Date(); | ||
return formatDateEN(date) | ||
} | ||
|
||
function formatDateEN(date) { | ||
return date.getFullYear() + "-" + digit2(date.getMonth() + 1) + "-" + digit2(date.getDate()); | ||
} | ||
|
||
function formatDateFR(date) { | ||
return digit2(date.getDate()) + "/" + digit2(date.getMonth() + 1) + "/" + date.getFullYear(); | ||
} | ||
|
||
//TODO try to use this later | ||
/* | ||
function buildDate(date) { | ||
let date10 = date.substring(0, 10); | ||
let arrayDate = date10.split('-'); | ||
let arrayFixed = arrayDate.map((item, index) => item - index % 2); | ||
return new Date(...arrayFixed); | ||
} | ||
*/ | ||
|
||
function thisMonth() { | ||
return new Date().getMonth(); | ||
} | ||
|
||
function thisYear() { | ||
return new Date().getFullYear(); | ||
} | ||
|
||
function getLastDate(year, month) { | ||
return new Date(year, month + 1, 0); | ||
} | ||
|
||
function getFirstDate(year, month) { | ||
return new Date(year, month, 1); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters