mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Refactor for API
This commit is contained in:
parent
a331368383
commit
d5d1d7d9a3
@ -147,9 +147,6 @@ class BaseController extends Controller
|
|||||||
|
|
||||||
$data = $this->createCollection($query, $transformer, $this->entity_type);
|
$data = $this->createCollection($query, $transformer, $this->entity_type);
|
||||||
|
|
||||||
if(request()->include_static)
|
|
||||||
$data['static'] = Statics::company(auth()->user()->getCompany()->getLocale());
|
|
||||||
|
|
||||||
return $this->response($data);
|
return $this->response($data);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -195,6 +192,10 @@ class BaseController extends Controller
|
|||||||
$response['meta'] = $meta;
|
$response['meta'] = $meta;
|
||||||
unset($response[$index]['meta']);
|
unset($response[$index]['meta']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(request()->include_static)
|
||||||
|
$response['static'] = Statics::company(auth()->user()->getCompany()->getLocale());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = json_encode($response, JSON_PRETTY_PRINT);
|
$response = json_encode($response, JSON_PRETTY_PRINT);
|
||||||
|
@ -45,7 +45,7 @@ class CompanyUserTransformer extends EntityTransformer
|
|||||||
|
|
||||||
public function transform(CompanyUser $company_user)
|
public function transform(CompanyUser $company_user)
|
||||||
{
|
{
|
||||||
return ['company_user' => [
|
return [
|
||||||
'permissions' => $company_user->permissions,
|
'permissions' => $company_user->permissions,
|
||||||
'settings' => $company_user->settings,
|
'settings' => $company_user->settings,
|
||||||
'is_owner' => (bool) $company_user->is_owner,
|
'is_owner' => (bool) $company_user->is_owner,
|
||||||
@ -53,7 +53,7 @@ class CompanyUserTransformer extends EntityTransformer
|
|||||||
'is_locked' => (bool) $company_user->is_locked,
|
'is_locked' => (bool) $company_user->is_locked,
|
||||||
'updated_at' => $company_user->updated_at,
|
'updated_at' => $company_user->updated_at,
|
||||||
'deleted_at' => $company_user->deleted_at,
|
'deleted_at' => $company_user->deleted_at,
|
||||||
]
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +87,6 @@ class CompanyTest extends TestCase
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
->assertStatus(200)->decodeResponseJson();
|
->assertStatus(200)->decodeResponseJson();
|
||||||
\Log::error($response['data'][0]);
|
|
||||||
//$company = Company::find($this->decodePrimaryKey($response['data']['company_users'][0]['company']['id']));
|
|
||||||
$company = Company::find($this->decodePrimaryKey($response['data'][0]['company']['id']));
|
$company = Company::find($this->decodePrimaryKey($response['data'][0]['company']['id']));
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user