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

Release 0.3 - Settings, Accounts & Transactions #109

Merged
merged 40 commits into from May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
42901af
Added stubbed out controllers and settings page
danpastori Jan 12, 2024
0a8c8bd
Added default currency to users
danpastori Jan 13, 2024
0d40e19
Stubbed out controllers
danpastori Jan 13, 2024
6c95006
Added animations CSS
danpastori Jan 13, 2024
fb9da0c
Created Global Notification component
danpastori Jan 13, 2024
289f439
Installed VueUse
danpastori Jan 13, 2024
ce8ee27
Working on settings and transactions pages
danpastori Jan 13, 2024
1d4be2f
Defaulted notification to show false
danpastori Jan 13, 2024
a70768e
Hide notification after 3 seconds
danpastori Jan 13, 2024
274a878
Wrapped up Portfolio page
danpastori Jan 13, 2024
69ad2e1
Added default categories
danpastori Jan 13, 2024
46d7d64
Building out category controller
danpastori Jan 13, 2024
7880140
Fixed typo, thanks @cbaconnier !
danpastori Jan 13, 2024
947701b
Deletion of categories and pagination complete
danpastori Jan 13, 2024
e30c423
Category management complete
danpastori Jan 17, 2024
e8a80ab
Created institutions table
danpastori Jan 19, 2024
027b074
Added institution model
danpastori Jan 19, 2024
d90a664
Added institutions controller
danpastori Jan 19, 2024
e8c5784
Stubbed out institution routes
danpastori Jan 19, 2024
43b32e0
Institution management crud ready for v.03
danpastori Jan 19, 2024
e0dea16
Added JPY and INR to settings page ref discussion #111
danpastori Jan 20, 2024
dbfa97d
Added tables for different account types
danpastori Jan 20, 2024
80d7464
Added cash account model
danpastori Jan 20, 2024
39ec6af
Added models for loans and credit cards
danpastori Jan 20, 2024
1f9128a
Working on account creation
danpastori Jan 24, 2024
721ee67
Added chart JS and working on the account screen
danpastori Feb 2, 2024
82b7d3c
Added loan functionality
danpastori Feb 2, 2024
f9543da
Started working on transactions
danpastori Feb 3, 2024
bc23d1f
Merge branch 'main' into release/0.3
jaydrogers Feb 9, 2024
c37fa8c
About 70 percent done with importing
danpastori May 7, 2024
9844779
Merge branch 'release/0.3' of github.com:serversideup/financial-freed…
danpastori May 7, 2024
c1ebddd
Release v0.3 PR Ready for review
danpastori May 16, 2024
4dacdef
Removed Mariadb
jaydrogers May 16, 2024
7d2ba3c
Removed old spin
jaydrogers May 16, 2024
301af9b
Set env example
jaydrogers May 16, 2024
7901820
chore: Update contribution guidelines link in README.md
jaydrogers May 16, 2024
e1a785b
Upgrade Spin and to serversideup/php v3
jaydrogers May 16, 2024
faea957
Cleaned up deployment process
jaydrogers May 16, 2024
1808ef6
chore: Update environment configuration and Traefik setup
jaydrogers May 16, 2024
db290ab
Merge branch 'main' into release/0.3
jaydrogers May 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Expand Up @@ -8,6 +8,7 @@ APP_ENV=production # Change to "local" for development
APP_DEBUG=false # Change to "true" for development
APP_URL=https://financialfreedom.dev.test
APP_KEY=base64:1234567890abcdefghijklmnopqrstuvwxyz # Run `php artisan key:generate`
VITE_APP_NAME="Financial Freedom"

# Database Settings
DB_ROOT_PASSWORD=myrootpassword
Expand Down
Empty file.
Empty file.
26 changes: 26 additions & 0 deletions app/Http/Controllers/CategoryController.php
@@ -0,0 +1,26 @@
<?php

namespace App\Http\Controllers;

use App\Services\Categories\IndexCategories;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;

class CategoryController extends Controller
{
public function index( Request $request )
{
return Inertia::render('Settings/Categories/Index', [
'group' => 'settings',
'subGroup' => 'categories',
'categories' => fn () => ( new IndexCategories() )->index( $request ),
]);
}

public function update()
{
return redirect()->back();
}
}
4 changes: 3 additions & 1 deletion app/Http/Controllers/DashboardController.php
Expand Up @@ -13,6 +13,8 @@ class DashboardController extends Controller
{
public function index( Request $request ): Response
{
return Inertia::render( 'Dashboard/Index' );
return Inertia::render( 'Dashboard/Index', [
'group' => 'dashboard'
] );
}
}
Empty file.
18 changes: 18 additions & 0 deletions app/Http/Controllers/PortfolioController.php
@@ -0,0 +1,18 @@
<?php

namespace App\Http\Controllers;

use App\Http\Requests\Portfolio\UpdatePortfolioRequest;
use App\Services\Portfolio\UpdatePortfolio;
use Illuminate\Http\RedirectResponse;
use Inertia\Inertia;
use Inertia\Response;

class PortfolioController extends Controller
{
public function update( UpdatePortfolioRequest $request ): RedirectResponse
{
( new UpdatePortfolio() )->update( $request );
return redirect()->back();
}
}
19 changes: 19 additions & 0 deletions app/Http/Controllers/SettingsController.php
@@ -0,0 +1,19 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;

class SettingsController extends Controller
{
public function index(): Response
{
return Inertia::render( 'Settings/Index', [
'group' => 'settings',
'subGroup' => 'portfolio'
] );
}
}
16 changes: 16 additions & 0 deletions app/Http/Controllers/TransactionsController.php
@@ -0,0 +1,16 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;

class TransactionsController extends Controller
{
public function index(): Response
{
return Inertia::render( 'Transactions/Index' );
}
}
21 changes: 21 additions & 0 deletions app/Http/Requests/Portfolio/UpdatePortfolioRequest.php
@@ -0,0 +1,21 @@
<?php

namespace App\Http\Requests\Portfolio;

use Illuminate\Foundation\Http\FormRequest;

class UpdatePortfolioRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => ['required', 'string'],
'defualt_currency' => ['required', 'string'],
danpastori marked this conversation as resolved.
Show resolved Hide resolved
];
}
}
28 changes: 28 additions & 0 deletions app/Listeners/Registered/SeedDefaultCategories.php
@@ -0,0 +1,28 @@
<?php

namespace App\Listeners\Registered;

use App\Services\Categories\SeedUserCategories;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class SeedDefaultCategories
{
/**
* Create the event listener.
*/
public function __construct()
{
//
}

/**
* Handle the event.
*/
public function handle(object $event): void
{
$user = $event->user;

( new SeedUserCategories() )->seed( $user );
}
}
35 changes: 35 additions & 0 deletions app/Models/Category.php
@@ -0,0 +1,35 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
use HasFactory;

protected $table = 'categories';
protected $appends = ['parent_name'];
protected $fillable = [
'user_id',
'parent_id',
'name',
'color'
];

public function subCategories()
{
return $this->hasMany('App\Models\Category', 'parent_id');
}

public function parent()
{
return $this->hasOne('App\Models\Category', 'id', 'parent_id');
}

public function getParentNameAttribute()
{
return $this->parent_id != null ? $this->parent->name : '';
}
}
1 change: 1 addition & 0 deletions app/Models/User.php
Expand Up @@ -21,6 +21,7 @@ class User extends Authenticatable
'name',
'email',
'password',
'default_currency'
];

/**
Expand Down
2 changes: 2 additions & 0 deletions app/Providers/EventServiceProvider.php
Expand Up @@ -2,6 +2,7 @@

namespace App\Providers;

use App\Listeners\Registered\SeedDefaultCategories;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
Expand All @@ -17,6 +18,7 @@ class EventServiceProvider extends ServiceProvider
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
SeedDefaultCategories::class,
],
];

Expand Down
48 changes: 48 additions & 0 deletions app/Services/Categories/IndexCategories.php
@@ -0,0 +1,48 @@
<?php

namespace App\Services\Categories;

use App\Models\Category;

class IndexCategories
{
private $request;
private $query;
private $paginate = true;
private $take = 10;
private $term;

public function index( $request )
{
$this->request = $request;
$this->query = Category::query();

$this->applySearch();
$this->applyOrder();

$this->query->with('parent');

if( $this->paginate ){
$categories = $this->query->paginate( $this->take );
}else{
$categories = $this->query->get();
}

return $categories;
}

private function applySearch()
{
if( $this->request->has('term') ){
$this->query->where( 'name', 'LIKE', "%{$this->term}%" );
}
}

private function applyOrder()
{
$this->query->orderBy(
$this->request->input('orderBy', 'name'),
$this->request->input('orderDirection', 'asc')
);
}
}