Skip to content

Commit

Permalink
Lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
ok200paul authored and github-actions[bot] committed Jan 28, 2025
1 parent e0516d2 commit 870d3e9
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 65 deletions.
81 changes: 40 additions & 41 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,58 +258,57 @@
]
);


/**
* My Teams
*/
Route::post('/my-teams', [ApiMyTeamsController::class, 'store'])
->name('api.v1.my-teams.post')
->middleware(
[
'abilities:' .
PersonalAccessTokenAbility::SUPER_ADMIN->value . ',' .
PersonalAccessTokenAbility::MY_TEAM_CREATE->value,
]
);
->name('api.v1.my-teams.post')
->middleware(
[
'abilities:' .
PersonalAccessTokenAbility::SUPER_ADMIN->value . ',' .
PersonalAccessTokenAbility::MY_TEAM_CREATE->value,
]
);
Route::get('/my-teams', [ApiMyTeamsController::class, 'index'])
->name('api.v1.my-teams.getMany')
->middleware(
[
'abilities:' .
PersonalAccessTokenAbility::SUPER_ADMIN->value . ',' .
PersonalAccessTokenAbility::MY_TEAM_READ->value,
]
);
->name('api.v1.my-teams.getMany')
->middleware(
[
'abilities:' .
PersonalAccessTokenAbility::SUPER_ADMIN->value . ',' .
PersonalAccessTokenAbility::MY_TEAM_READ->value,
]
);

Route::get('/my-teams/{id}', [ApiMyTeamsController::class, 'show'])
->name('api.v1.my-teams.get')
->middleware(
[
'abilities:' .
PersonalAccessTokenAbility::SUPER_ADMIN->value . ',' .
PersonalAccessTokenAbility::MY_TEAM_READ->value,
]
);
->name('api.v1.my-teams.get')
->middleware(
[
'abilities:' .
PersonalAccessTokenAbility::SUPER_ADMIN->value . ',' .
PersonalAccessTokenAbility::MY_TEAM_READ->value,
]
);

Route::put('/my-teams/{id}', [ApiMyTeamsController::class, 'update'])
->name('api.v1.my-teams.put')
->middleware(
[
'abilities:' .
PersonalAccessTokenAbility::SUPER_ADMIN->value . ',' .
PersonalAccessTokenAbility::MY_TEAM_UPDATE->value,
]
);
->name('api.v1.my-teams.put')
->middleware(
[
'abilities:' .
PersonalAccessTokenAbility::SUPER_ADMIN->value . ',' .
PersonalAccessTokenAbility::MY_TEAM_UPDATE->value,
]
);

Route::delete('/my-teams/{id}', [ApiMyTeamsController::class, 'destroy'])
->name('api.v1.my-teams.delete')
->middleware(
[
'abilities:' .
PersonalAccessTokenAbility::SUPER_ADMIN->value . ',' .
PersonalAccessTokenAbility::MY_TEAM_DELETE->value,
]
);
->name('api.v1.my-teams.delete')
->middleware(
[
'abilities:' .
PersonalAccessTokenAbility::SUPER_ADMIN->value . ',' .
PersonalAccessTokenAbility::MY_TEAM_DELETE->value,
]
);

/**
* My Search
Expand Down
30 changes: 15 additions & 15 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
Route::get('/my-voucher-set-merchant-team-approval-request/{approvalRequestId}', function (Request $request, $approvalRequestId) {

$approvalRequest = VoucherSetMerchantTeamApprovalRequest::where('merchant_user_id', Auth::id())
->find($approvalRequestId);
->find($approvalRequestId);

if (!$approvalRequest) {
return Redirect::to('/');
Expand Down Expand Up @@ -139,16 +139,16 @@
* User's team is NOT a merchant of the voucher's service team
*/
$teamMerchant = TeamMerchantTeam::where('team_id', $voucher->allocated_to_service_team_id)
->where('merchant_team_id', $team->id)
->first();
->where('merchant_team_id', $team->id)
->first();

/**
* User's team is NOT a merchant for the voucher set
*/
$teamMerchantOfVoucherSet = VoucherSetMerchantTeam::where('voucher_set_id', $voucherSetId)
->where('merchant_team_id', $team->id)
->whereNotNull('voucher_set_merchant_team_approval_request_id')
->first();
->where('merchant_team_id', $team->id)
->whereNotNull('voucher_set_merchant_team_approval_request_id')
->first();

if (!$teamMerchant || !$teamMerchantOfVoucherSet) {
return Inertia::render('App/ErrorMessagePage', [
Expand Down Expand Up @@ -196,15 +196,15 @@
* User's team is NOT a merchant of the voucher's service team
*/
$teamMerchant = TeamMerchantTeam::where('team_id', $voucher->allocated_to_service_team_id)
->where('merchant_team_id', $team->id)
->first();
->where('merchant_team_id', $team->id)
->first();

/**
* User's team is NOT a merchant for the voucher set
*/
$teamMerchantOfVoucherSet = VoucherSetMerchantTeam::where('voucher_set_id', $voucher->voucher_set_id)
->where('merchant_team_id', $team->id)
->first();
->where('merchant_team_id', $team->id)
->first();

if (($voucher->created_by_team_id != $team->id && $voucher->allocated_to_service_team_id != $team->id) && !$teamMerchant && !$teamMerchantOfVoucherSet) {
return Inertia::render('App/ErrorMessagePage', [
Expand Down Expand Up @@ -250,15 +250,15 @@
* User's team is NOT a merchant of the voucher set's service team
*/
$teamMerchant = TeamMerchantTeam::where('team_id', $voucherSet->allocated_to_service_team_id)
->where('merchant_team_id', $team->id)
->first();
->where('merchant_team_id', $team->id)
->first();

/**
* User's team is NOT a merchant for the voucher set
*/
$teamMerchantOfVoucherSet = VoucherSetMerchantTeam::where('voucher_set_id', $voucherSetId)
->where('merchant_team_id', $team->id)
->first();
->where('merchant_team_id', $team->id)
->first();

if (($voucherSet->created_by_team_id != $team->id && $voucherSet->allocated_to_service_team_id != $team->id) && !$teamMerchant && !$teamMerchantOfVoucherSet) {
return Inertia::render('App/ErrorMessagePage', [
Expand Down Expand Up @@ -301,7 +301,7 @@
Route::get('/switch-team/{id}', function ($id) {

$teamUserForThisTeam = TeamUser::where('user_id', Auth::id())
->where('team_id', $id)->first();
->where('team_id', $id)->first();

if ($teamUserForThisTeam) {
Auth::user()->current_team_id = $id;
Expand Down
1 change: 0 additions & 1 deletion tests/Feature/API/App/MyProfile/MyProfileDeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class MyProfileDeleteTest extends BaseAPITestCase
{

protected string $endPoint = '/my-profile';

#[Test]
Expand Down
4 changes: 0 additions & 4 deletions tests/Feature/API/App/MyProfile/MyProfileGetTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php


namespace Tests\Feature\API\App\MyProfile;

use App\Enums\PersonalAccessTokenAbility;
Expand All @@ -12,7 +11,6 @@

class MyProfileGetTest extends BaseAPITestCase
{

protected string $endPoint = '/my-profile';

#[Test]
Expand Down Expand Up @@ -76,6 +74,4 @@ public function itCanGetDataFromIdSuffix()
$this->assertEquals($responseObj->data->current_team_id, $this->user->current_team_id);
$this->assertEquals($responseObj->data->name, $this->user->name);
}


}
2 changes: 0 additions & 2 deletions tests/Feature/API/App/MyProfile/MyProfilePostTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
namespace Tests\Feature\API\App\MyProfile;

use App\Enums\PersonalAccessTokenAbility;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Sanctum\Sanctum;
use PHPUnit\Framework\Attributes\Test;
use Tests\Feature\API\BaseAPITestCase;

class MyProfilePostTest extends BaseAPITestCase
{

protected string $endPoint = '/my-profile';

#[Test]
Expand Down
2 changes: 0 additions & 2 deletions tests/Feature/API/App/MyProfile/MyProfilePutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public function itCanNotUpdateNoNumbers()

}


#[Test]
public function itCanNotUpdateNoSymbols()
{
Expand Down Expand Up @@ -129,5 +128,4 @@ public function itCanNotUpdateNoStEnoughCharacters()
$response->assertStatus(400);

}

}

0 comments on commit 870d3e9

Please sign in to comment.