Skip to content

Commit

Permalink
Merge pull request #100 from fleetbase/dev-v0.4.23
Browse files Browse the repository at this point in the history
v0.4.23
  • Loading branch information
roncodes authored Mar 27, 2024
2 parents db46be9 + 3f981c0 commit 12f92d8
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 32 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fleetbase/fleetops-api",
"version": "0.4.22",
"version": "0.4.23",
"description": "Fleet & Transport Management Extension for Fleetbase",
"keywords": [
"fleetbase-extension",
Expand All @@ -22,7 +22,7 @@
],
"require": {
"php": "^8.0",
"fleetbase/core-api": "^1.4.14",
"fleetbase/core-api": "^1.4.15",
"barryvdh/laravel-dompdf": "^2.0",
"brick/geo": "0.7.2",
"cknow/laravel-money": "^7.1",
Expand Down
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Fleet-Ops",
"version": "0.4.22",
"version": "0.4.23",
"description": "Fleet & Transport Management Extension for Fleetbase",
"repository": "https://github.com/fleetbase/fleetops",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fleetbase/fleetops-engine",
"version": "0.4.22",
"version": "0.4.23",
"description": "Fleet & Transport Management Extension for Fleetbase",
"fleetbase": {
"route": "fleet-ops"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function handle()
['model' => \Fleetbase\FleetOps\Models\Order::class, 'columns' => ['customer_type', 'facilitator_type']],
['model' => \Fleetbase\FleetOps\Models\Place::class, 'columns' => ['owner_type']],
['model' => \Fleetbase\FleetOps\Models\Entity::class, 'columns' => ['customer_type']],
['model' => \Fleetbase\FleetOps\Models\PurchaseRate::class, 'columns' => ['customer_type']],
['model' => \Fleetbase\FleetOps\Models\PurchaseRate::class, 'columns' => ['customer_type']]
];

foreach ($models as $modelConfig) {
Expand Down
7 changes: 4 additions & 3 deletions server/src/Http/Controllers/Api/v1/DriverController.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ public function verifyCode(Request $request)
return response()->apiError($e->getMessage());
}

// $driver->update(['auth_token' => $token->plainTextToken]);
$driver->update(['auth_token' => $token->plainTextToken]);
$driver->token = $token->plainTextToken;

return new DriverResource($driver);
Expand Down Expand Up @@ -597,7 +597,8 @@ public function switchOrganization(string $id, SwitchOrganizationRequest $reques
}

// Assign user to company and update their session
$user->assignCompany($company);
$user->update(['company_uuid' => $company->uuid]);

Auth::setSession($user);

return new Organization($company);
Expand Down Expand Up @@ -772,4 +773,4 @@ private static function phone(?string $phone = null): string

return $phone;
}
}
}
15 changes: 6 additions & 9 deletions server/src/Http/Controllers/Api/v1/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ public function update($id, UpdateOrderRequest $request)
public function query(Request $request)
{
$results = Order::queryWithRequest($request, function (&$query, $request) {
$query->where('company_uuid', session('company'));
if ($request->has('payload')) {
$query->whereHas('payload', function ($q) use ($request) {
$q->where('public_id', $request->input('payload'));
Expand Down Expand Up @@ -495,9 +496,9 @@ public function query(Request $request)
});
}

if ($request->has('on')) {
$on = Carbon::fromString($request->input('on'));

if ($request->filled('on')) {
$on = Carbon::parse($request->input('on'));
$query->where(function ($q) use ($on) {
$q->whereDate('created_at', $on);
$q->orWhereDate('scheduled_at', $on);
Expand Down Expand Up @@ -1401,14 +1402,10 @@ public function getEditableEntityFields(string $id, Request $request)

// Get entity editing settings
$savedEntityEditingSettings = Setting::where('key', 'fleet-ops.entity-editing-settings')->value('value');

if ($orderConfigId && $savedEntityEditingSettings) {
$resolvedEntityEditingSettings = data_get($savedEntityEditingSettings, $orderConfigId, []);
if ($resolvedEntityEditingSettings) {
$entityEditingSettings = data_get($resolvedEntityEditingSettings, 'editable_entity_fields', []);
}
$entityEditingSettings = data_get($savedEntityEditingSettings, $orderConfigId, []);
}

return response()->json($entityEditingSettings);
}
}
}
6 changes: 0 additions & 6 deletions server/src/Http/Controllers/FleetOpsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,4 @@ class FleetOpsController extends FleetbaseController
* The package namespace used to resolve from.
*/
public string $namespace = '\\Fleetbase\\FleetOps';

public function test()
{
$order = Order::where('public_id', '')->first();
dd($order->config()->getNextActivity());
}
}
2 changes: 1 addition & 1 deletion server/src/Http/Filter/OrderFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function ($q) {

public function queryForPublic()
{
$this->builder->where('company_uuid', $this->session->get('company'))->whereHas('trackingNumber')->whereHas('payload');
$this->builder->where('company_uuid', $this->session->get('company'));
}

public function unassigned(bool $unassigned)
Expand Down
2 changes: 1 addition & 1 deletion server/src/Http/Requests/CreateContactRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CreateContactRequest extends FleetbaseRequest
*/
public function authorize()
{
return request()->session()->has('storefront_key') || request()->session()->has('api_credential');
return request()->session()->has('storefront_key') || request()->session()->has('api_credential') || request()->session()->has('is_sanctum_token');;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion server/src/Http/Requests/CreateDriverRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CreateDriverRequest extends FleetbaseRequest
*/
public function authorize()
{
return request()->is('navigator/v1/*') || request()->session()->has('api_credential');
return request()->is('navigator/v1/*') || request()->session()->has('api_credential') || request()->session()->has('is_sanctum_token');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion server/src/Http/Requests/CreateEntityRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CreateEntityRequest extends FleetbaseRequest
*/
public function authorize()
{
return request()->session()->has('api_credential');
return request()->session()->has('api_credential') || request()->session()->has('is_sanctum_token');;
}

/**
Expand Down
15 changes: 15 additions & 0 deletions server/src/Http/Requests/CreateIssueRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@

class CreateIssueRequest extends FleetbaseRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return request()->session()->has('api_credential') || request()->session()->has('is_sanctum_token');;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
Expand Down
4 changes: 1 addition & 3 deletions server/src/Http/Requests/CreatePlaceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ class CreatePlaceRequest extends FleetbaseRequest
*/
public function authorize()
{
return request()
->session()
->has('api_credential');
return request()->session()->has('api_credential') || request()->session()->has('is_sanctum_token');;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion server/src/Http/Requests/CreateVehicleRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CreateVehicleRequest extends FleetbaseRequest
*/
public function authorize()
{
return request()->session()->has('api_credential');
return request()->session()->has('api_credential') || request()->session()->has('is_sanctum_token');;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion server/src/Http/Resources/v1/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function toArray($request)
'city' => data_get($this, 'city', Utils::getCapitalCityFromCountryCode($this->country)),
'online' => data_get($this, 'online', false),
'status' => $this->status,
'token' => data_get($this, 'token'),
'token' => $this->auth_token,
'meta' => $this->meta,
'updated_at' => $this->updated_at,
'created_at' => $this->created_at,
Expand Down

0 comments on commit 12f92d8

Please sign in to comment.