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

Fix 71 rewrite the abstract routes #72

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d0edfb1
Update the resource routes so they work now...
Mar 24, 2021
e54b839
Apply fixes from StyleCI
austinkregel Mar 24, 2021
f42d0a9
Add query scope
Apr 10, 2021
23fcb91
Merge branch 'fix-71-rewrite-the-abstract-routes' of github.com:austi…
Apr 10, 2021
fd58aae
Apply fixes from StyleCI
austinkregel Apr 10, 2021
2a26663
Update the env
Apr 30, 2021
19cba76
Merge branch 'fix-71-rewrite-the-abstract-routes' of github.com:austi…
Apr 30, 2021
65de3c5
Apply fixes from StyleCI
austinkregel Apr 30, 2021
5b1f38c
Update Budget.php
May 7, 2021
6b3d5ce
Update the budget controller to properly scope down shit
May 14, 2021
e8f13d7
Merge branch 'fix-71-rewrite-the-abstract-routes' of github.com:austi…
May 14, 2021
730aef0
Apply fixes from StyleCI
austinkregel May 14, 2021
27e8df2
Update the action
May 14, 2021
0d40014
Merge branch 'fix-71-rewrite-the-abstract-routes' of github.com:austi…
May 14, 2021
dad1604
Rename
May 14, 2021
a5d71c9
Update the composer json to include phpcs.
May 14, 2021
29fb9aa
Update the phpcs formatting
May 14, 2021
993e9c7
Fixing cs
May 14, 2021
990b21c
Apply fixes from StyleCI
austinkregel May 14, 2021
861391d
update th filter'
May 14, 2021
0b856e0
Add seed for data
May 14, 2021
0c63d0f
Merge branch 'fix-71-rewrite-the-abstract-routes' of github.com:austi…
May 14, 2021
b8aa664
Apply fixes from StyleCI
austinkregel May 14, 2021
a377ff9
Remove docker 7.4
May 15, 2021
e8a5ccf
Update the listener
May 15, 2021
0927004
Add config files for docker horizon and crontab systems
May 15, 2021
ab642cb
Update the docker-compose.yml file for a crontab and horizon container
May 15, 2021
b970891
Merge branch 'fix-71-rewrite-the-abstract-routes' of github.com:austi…
May 15, 2021
d410db0
Rename
May 15, 2021
19af08f
Update the pipelines env and the run-tests.yml
May 15, 2021
e312401
CS fix the things
May 15, 2021
f10e8c8
Apply fixes from StyleCI
austinkregel May 15, 2021
2b69e85
CS fix the things
May 15, 2021
fe18c6f
Update the pipelienes again
May 15, 2021
8afb535
Update the cs pipeline
May 15, 2021
65555cf
Stupid rename
May 15, 2021
41efb5c
Update the compile-asssets thing
Jul 5, 2021
c0872fb
update generated resources
Jul 15, 2021
4217f36
Update the token controller
Jul 15, 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: 12 additions & 12 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_NAME=Laravel
APP_NAME=Finance
APP_ENV=local
APP_KEY=
APP_DEBUG=true
Expand All @@ -7,19 +7,19 @@ APP_URL=http://localhost
LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=testing
DB_USERNAME=root
DB_PASSWORD=root

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=database
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

Expand All @@ -45,5 +45,5 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

SLACK_WEBHOOK_URL=
DISCORD_WEBHOOK_URL=
DISCORD_TOKEN=

49 changes: 49 additions & 0 deletions .env.pipelines
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
APP_NAME=Finance
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=testing
DB_USERNAME=root
DB_PASSWORD=root

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PLAID_ENV=sandbox
PLAID_SECRET=
PLAID_CLIENT_ID=
PLAID_LANGUAGE=en
PLAID_COUNTRY_CODES=US

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

SLACK_WEBHOOK_URL=
DISCORD_WEBHOOK_URL=

12 changes: 12 additions & 0 deletions .github/scripts/cs-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
TARGET_BRANCH=main
if [ "$TARGET_BRANCH" = "" ]; then
FILES="."
else
FILES=$(git diff --diff-filter=d --name-only origin/${TARGET_BRANCH} --);
fi
for FILE in $FILES
do
echo "Checking CS for: ${FILE}"
vendor/bin/phpcs "$FILE" --standard=phpcs.xml -q #| vendor/bin/cs2pr
done
10 changes: 10 additions & 0 deletions .github/scripts/install-php.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php -y
sudo apt install -y php8.0-{common,cli,gd,curl,mysql,mbstring,dom,xml,simplexml}
curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
23 changes: 23 additions & 0 deletions .github/workflows/compile-and-commit-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Commit Assets
on: [ push ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Create local changes
run: |
...
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
author_email: 'deploy@changed.to'
author_name: "Deploy Bot"
coauthor_email: "austin@kregel.co"
coauthor_name: "Austin Kregel"
message: "BOT: JS Autobuild"
branch: "${{ github.ref }}"
29 changes: 0 additions & 29 deletions .github/workflows/run-checks.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/run-cs-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "CS Checks"

on:
pull_request:
paths:
- "**.php"
- "phpcs.xml"
- ".github/workflows/phpcs.yml"

jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # important!
- name: setup php
run: bash .github/scripts/install-php.sh
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: install check style
run: composer require staabm/annotate-pull-request-from-checkstyle
- name: Run CS Checks
env:
SOURCE_BRANCH: ${{ github.head_ref }}
TARGET_BRANCH: ${{ github.base_ref }}
run: |
if [ "$TARGET_BRANCH" = "" ]; then
FILES="."
else
FILES=$(git diff --diff-filter=d --name-only origin/${TARGET_BRANCH} --);
fi
for FILE in $FILES
do
echo "Checking CS for: ${FILE}"
vendor/bin/phpcs "$FILE" --standard=phpcs.xml -q --report=checkstyle | vendor/bin/cs2pr
done
25 changes: 25 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Checks
on: [ pull_request ]
jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # important!
- name: setup php
run: bash .github/scripts/install-php.sh
- name: Install dependencies
run: |
sudo systemctl start mysql.service
mysql -uroot -h127.0.0.1 -proot -e 'CREATE DATABASE IF NOT EXISTS testing;'
sudo apt update && sudo apt install -y php-mysql
composer install --prefer-dist --no-progress --no-suggest
- name: Run tests
run: |
cp .env.pipelines .env
touch database/database.sqlite
php artisan key:generate

php vendor/bin/phpunit
13 changes: 0 additions & 13 deletions .styleci.yml

This file was deleted.

1 change: 1 addition & 0 deletions app/Actions/Action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App\Actions;

Expand Down
1 change: 1 addition & 0 deletions app/Actions/EmitRefreshEvent.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App\Actions;

Expand Down
1 change: 1 addition & 0 deletions app/Actions/FetchTransactions.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App\Actions;

Expand Down
1 change: 1 addition & 0 deletions app/Actions/HistoricalSync.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App\Actions;

Expand Down
1 change: 1 addition & 0 deletions app/Actions/RefreshAccountsFor.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App\Actions;

Expand Down
1 change: 1 addition & 0 deletions app/Activity.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App;

Expand Down
22 changes: 20 additions & 2 deletions app/Budget.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App;

Expand All @@ -8,10 +9,12 @@
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Validation\Rule;
use Kregel\LaravelAbstract\AbstractEloquentModel;
use Kregel\LaravelAbstract\AbstractModelTrait;
use RRule\RRule;
use Spatie\QueryBuilder\AllowedFilter;
use Spatie\Tags\HasTags;
use Znck\Eloquent\Traits\BelongsToThrough;

Expand Down Expand Up @@ -74,14 +77,20 @@ public static function booted(): void
$budget->user_id = auth()->id();
}
});

static::addGlobalScope('user_filter', function ($query): void {
if (auth()->check()) {
$query->where('user_id', auth()->id());
}
});
}

public static function getTagClassName(): string
{
return Tag::class;
}

public function findTotalSpends($startingPeriod):? int
public function findTotalSpends($startingPeriod): float
{
return Transaction::crossJoin('taggables', 'taggables.taggable_id', '=', 'transactions.id')
->whereIn('taggables.tag_id', $this->tags()->select('id'))
Expand Down Expand Up @@ -125,9 +134,18 @@ public function getValidationUpdateRules(): array
];
}

public function scopeRecentTransactions(Builder $query, $value): void
{
$query->with([
'tags.transactions' => fn ($builder) => $builder->where('date', '>=', Carbon::parse($value))
]);
}

public function getAbstractAllowedFilters(): array
{
return [];
return [
AllowedFilter::scope('recent_transactions'),
];
}

public function getAbstractAllowedRelationships(): array
Expand Down
1 change: 1 addition & 0 deletions app/Condition.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App;

Expand Down
1 change: 1 addition & 0 deletions app/Console/Commands/CheckBudgetBreachCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App\Console\Commands;

Expand Down
1 change: 1 addition & 0 deletions app/Console/Commands/GenerateChannelsAndAlertsFile.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App\Console\Commands;

Expand Down
Loading