mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Fixes for signup route
This commit is contained in:
parent
3ff6dd4472
commit
bacf1f74a0
@ -14,7 +14,9 @@ namespace App\Http\Controllers;
|
||||
use App\Http\Requests\Account\CreateAccountRequest;
|
||||
use App\Jobs\Account\CreateAccount;
|
||||
use App\Models\Account;
|
||||
use App\Models\CompanyUser;
|
||||
use App\Transformers\AccountTransformer;
|
||||
use App\Transformers\CompanyUserTransformer;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@ -23,9 +25,9 @@ class AccountController extends BaseController
|
||||
{
|
||||
use DispatchesJobs;
|
||||
|
||||
protected $entity_type = Account::class;
|
||||
protected $entity_type = CompanyUser::class;
|
||||
|
||||
protected $entity_transformer = AccountTransformer::class;
|
||||
protected $entity_transformer = CompanyUserTransformer::class;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -65,10 +67,9 @@ class AccountController extends BaseController
|
||||
{
|
||||
|
||||
$account = CreateAccount::dispatchNow($request->all());
|
||||
|
||||
$account->load('company_users');
|
||||
|
||||
return $this->itemResponse($account);
|
||||
|
||||
$ct = CompanyUser::whereUserId(auth()->user()->id);
|
||||
return $this->listResponse($ct);
|
||||
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class ClientTest extends TestCase
|
||||
$acc = $response->json();
|
||||
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$token = $account->default_company->tokens->first()->token;
|
||||
|
||||
@ -102,7 +102,7 @@ class ClientTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
|
||||
|
@ -65,7 +65,7 @@ class CompanyTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$token = $account->default_company->tokens->first()->token;
|
||||
|
||||
|
@ -61,7 +61,7 @@ class InvoiceTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
$token = $company_token->token;
|
||||
@ -125,7 +125,7 @@ class InvoiceTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
$token = $company_token->token;
|
||||
|
@ -62,7 +62,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
$token = $company_token->token;
|
||||
@ -126,7 +126,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
$token = $company_token->token;
|
||||
|
@ -62,7 +62,7 @@ class ProductTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$token = $account->default_company->tokens->first()->token;
|
||||
|
||||
|
@ -61,7 +61,7 @@ class QuoteTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
$token = $company_token->token;
|
||||
@ -125,7 +125,7 @@ class QuoteTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
$token = $company_token->token;
|
||||
|
@ -46,8 +46,8 @@ class RecurringInvoiceTest extends TestCase
|
||||
$data = [
|
||||
'first_name' => $this->faker->firstName,
|
||||
'last_name' => $this->faker->lastName,
|
||||
'name' => $this->faker->company,
|
||||
'email' => $this->faker->unique()->safeEmail,
|
||||
'name' => $this->faker->company,
|
||||
'email' => $this->faker->unique()->safeEmail,
|
||||
'password' => 'ALongAndBrilliantPassword123',
|
||||
'_token' => csrf_token(),
|
||||
'privacy_policy' => 1,
|
||||
@ -61,7 +61,7 @@ class RecurringInvoiceTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
$token = $company_token->token;
|
||||
@ -124,7 +124,7 @@ class RecurringInvoiceTest extends TestCase
|
||||
])->post('/api/v1/signup', $data);
|
||||
|
||||
$acc = $response->json();
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
$token = $company_token->token;
|
||||
|
@ -61,7 +61,7 @@ class RecurringQuoteTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
$token = $company_token->token;
|
||||
@ -125,7 +125,7 @@ class RecurringQuoteTest extends TestCase
|
||||
|
||||
$acc = $response->json();
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$company_token = $account->default_company->tokens()->first();
|
||||
$token = $company_token->token;
|
||||
|
@ -64,7 +64,7 @@ class UserTest extends TestCase
|
||||
$acc = $response->json();
|
||||
|
||||
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||
$account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id']));
|
||||
|
||||
$token = $account->default_company->tokens->first()->token;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user