Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
indpurvesh committed Feb 6, 2022
2 parents b8e8245 + cbdaffc commit f98fe66
Show file tree
Hide file tree
Showing 24 changed files with 4,286 additions and 98 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ jobs:

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}


services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: avored_ecommerce_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: avored_ecommerce_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Checkout code
Expand All @@ -56,3 +55,11 @@ jobs:
run: vendor/bin/phpunit
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}

- name: phpunit-coverage-badge
uses: timkrase/phpunit-coverage-badge@v1.2.0
with:
report: build/logs/clover.xml
coverage_badge_path: "badge-coverage.svg"
push_badge: true
repo_token: ${{ secrets.USER_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

.DS_Store
/build/
/build/coverage
/build/coverage.txt
/build/report.junit.xml
/vendor/
/node_modules/
.phpunit.result.cache
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<a href="https://packagist.org/packages/avored/framework"><img src="https://poser.pugx.org/avored/framework/downloads" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/avored/framework"><img src="https://poser.pugx.org/avored/framework/v/stable" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/avored/framework"><img src="https://poser.pugx.org/avored/framework/license" alt="License"></a>
<a href="https://packagist.org/packages/avored/framework"><img src="https://raw.githubusercontent.com/avored/framework/develop/badge-coverage.svg" alt="Test Coverage"></a>
</p>


Expand All @@ -26,7 +27,7 @@ Once this is finished, you will need to run a few commands to finish up and then
## Publish the files
Publish the AvoRed E-commerce framework config file and assets (JS/CSS and images):

php artisan vendor:publish --provider="AvoRed\Framework\AvoRedProvider"
php artisan vendor:publish --provider="AvoRed\Framework\AvoRedServiceProvider"

Once all the files are published, we can run the command to install the required database tables.

Expand Down
16 changes: 16 additions & 0 deletions badge-coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions build/framework-build
4,142 changes: 4,142 additions & 0 deletions build/logs/clover.xml

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@
"AvoRed\\Framework\\AvoRedServiceProvider"
],
"aliases": {
"Menu": "AvoRed\\Framework\\Menu\\Menu",
"Module": "AvoRed\\Framework\\Module\\Module",
"Cart": "AvoRed\\Framework\\Cart\\Cart",
"Breadcrumb": "AvoRed\\Framework\\Breadcrumb\\Breadcrumb",
"Document": "AvoRed\\Framework\\Document\\Document",
"Menu": "AvoRed\\Framework\\Menu\\Menu",
"Payment": "AvoRed\\Framework\\Payment\\Payment",
"Permission": "AvoRed\\Framework\\Permission\\Permission",
"Shipping": "AvoRed\\Framework\\Shipping\\Shipping"
"Shipping": "AvoRed\\Framework\\Shipping\\Shipping",
"Tab": "AvoRed\\Framework\\Tab\\Tab"
},
"dont-discover": [
"rebing/graphql-laravel"
Expand Down
10 changes: 5 additions & 5 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
<env name="DB_PORT" value="3306" />
</php>

<!-- <coverage>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="/build/coverage"/>
<html outputDirectory="./build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage> -->
<!-- <logging>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging> -->
</logging>
</phpunit>
Binary file added resources/images/avored_logo.ico
Binary file not shown.
1 change: 1 addition & 0 deletions resources/lang/en/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

'login_to_avored_admin' => 'Login to avored admin',
'failed' => 'These credentials do not match our records.',
'forgot_password' => 'Forgot your password?',
'remember_me' => 'Remember me',
'email_address' => 'Email Address',
Expand Down
24 changes: 19 additions & 5 deletions src/Graphql/Mutations/Auth/RegisterMutation.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
namespace AvoRed\Framework\Graphql\Mutations\Auth;

use AvoRed\Framework\Database\Contracts\CustomerModelInterface;
use AvoRed\Framework\Database\Contracts\VisitorModelInterface;
use AvoRed\Framework\Database\Models\Customer;
use Closure;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use Illuminate\Support\Str;
use Laravel\Passport\Client;
use Laravel\Passport\Http\Controllers\AccessTokenController;
use Rebing\GraphQL\Support\Facades\GraphQL;
Expand Down Expand Up @@ -47,6 +44,21 @@ public function type(): Type
return GraphQL::type('token');
}

/**
* Setup the Validation rules for register mutation
*
* @return array $rules
*/
protected function rules(array $rules = []): array
{
return [
'first_name' => ['required', 'max:255'],
'last_name' => ['required', 'max:255'],
'email' => ['required', 'email', 'max:255'],
'password' => ['required', 'confirmed', 'max:255'],
];
}

public function args(): array
{
return [
Expand All @@ -66,14 +78,16 @@ public function args(): array
'name' => 'password',
'type' => Type::nonNull(Type::string())
],
'password_confirmation' => [
'name' => 'password_confirmation',
'type' => Type::nonNull(Type::string())
],
];
}

public function resolve($root, $args, $context, ResolveInfo $resolveInfo, Closure $getSelectFields)
{

$customer = $this->customerRepository->create($args);


$client = $customer->getPassportClient();

Expand Down
8 changes: 4 additions & 4 deletions src/Graphql/Mutations/Auth/ResetPasswordMutation.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public function broker()
/**
* Reset the given user's password.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @param string $password
* @param \AvoRed\Framework\Database\Models\AdminUser $user
* @param string $password
* @return void
*/
protected function resetPassword($user, $password)
Expand All @@ -108,8 +108,8 @@ protected function resetPassword($user, $password)
/**
* Set the user's password.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @param string $password
* @param \AvoRed\Framework\Database\Models\AdminUser $user
* @param string $password
* @return void
*/
protected function setUserPassword($user, $password)
Expand Down
2 changes: 1 addition & 1 deletion src/Graphql/Queries/AllCategoryQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ public function args(): array
*/
public function resolve($root, $args, $context, ResolveInfo $resolveInfo, Closure $getSelectFields): Collection
{
return $this->categoryRepository->all();
return $this->categoryRepository->query()->whereNull('parent_id')->get();
}
}
16 changes: 15 additions & 1 deletion src/Graphql/Types/CategoryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ public function fields(): array
'products' => [
'type' => GraphQL::paginate('product'),
'description' => 'Category Product'
]
],
'children' => [
'type' => Type::listOf(GraphQL::type('category')),
'description' => 'Child Category'
],
];
}

Expand All @@ -85,6 +89,16 @@ protected function resolveFilterField($category, $args)
return $categoryFilterRepository->findByCategoryId($category->id);
}

/**
* @param \AvoRed\Framework\Database\Models\Category $category
* @param array $args
* @return \Illuminate\Support\Collection $titleCollection
*/
protected function resolveChildrenField($category, $args)
{
return $category->children;
}

/**
* @param \AvoRed\Framework\Database\Models\Category $category
* @param array $args
Expand Down
4 changes: 2 additions & 2 deletions src/Permission/PermissionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ public function label($label = null);
* @param string $routes
* @return $routes|self
*/
public function routes($icon = null);
}
public function routes($route = null);
}
2 changes: 1 addition & 1 deletion src/Permission/PermissionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ function (PermissionItem $permission) {
'hasPermission',
function ($routeName) {
$condition = false;
/** @var AdminUser */
/** @var \AvoRed\Framework\Database\Models\AdminUser $user */
$user = Auth::guard('admin')->user();
if (! $user) {
$condition = $user->hasPermission($routeName) ?: false;
Expand Down
5 changes: 1 addition & 4 deletions src/System/Components/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

namespace AvoRed\Framework\System\Components;

use AvoRed\Framework\Breadcrumb\Breadcrumb;
use AvoRed\Framework\Menu\Menu;
use Illuminate\Support\Facades\Route;
use Illuminate\View\Component;

class Layout extends Component
{

Expand All @@ -18,7 +15,7 @@ class Layout extends Component

/**
* The admin Menus.
* @var collection
* @var \Illuminate\Support\Collection
*/
public $adminMenus;

Expand Down
2 changes: 1 addition & 1 deletion src/System/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function handle()
$this->createRoleAction->handle(['name' => Role::ADMIN]);

if ($this->confirm('Would you like to install Dummy Data?')) {
$this->call('avored:module:install', ['identifier' => 'avored-demodata']);
$this->call('avored:module:install', ['identifier' => 'avored-dummy-data']);
}

$this->call('avored:admin:make');
Expand Down
16 changes: 3 additions & 13 deletions src/System/Controllers/ConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,39 @@

class ConfigurationController extends Controller
{
/**
/**
* Configuration Repository for the Install Command.
* @var \AvoRed\Framework\Database\Repository\ConfigurationRepository
*/
protected $configurationRepository;
/**
* Currency Repository for the Install Command.
* @var \AvoRed\Framework\Database\Repository\CurrencyRepository
*/
protected $currencyRepository;

/**
* Construct for the AvoRed configuration controller.
* @param \AvoRed\Framework\Database\Contracts\ConfigurationModelInterface $configurationRepository
*/
public function __construct(
ConfigurationModelInterface $configurationRepository
// CurrencyModelInterface $currencyRepository
) {
$this->configurationRepository = $configurationRepository;
// $this->currencyRepository = $currencyRepository;
}

/**
* Show Configuration of an AvoRed Admin.
* @return \Illuminate\View\View
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
*/
public function index()
{
// $currencyOptions = $this->currencyRepository->all()->pluck('name', 'id');

$tabs = Tab::get('system.configuration');

return view('avored::system.configuration.index')
->with('tabs', $tabs)
->with('repository', $this->configurationRepository)
// ->with('currencyOptions', $currencyOptions)
;
}

/**
* Show Configuration of an AvoRed Admin.
* @return \Illuminate\Http\RedirectResponse
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
*/
public function store(Request $request)
{
Expand Down
Loading

0 comments on commit f98fe66

Please sign in to comment.