Clean up todos (#2979)

This commit is contained in:
David Bomba 2019-10-11 13:20:04 +11:00 committed by GitHub
parent 3cbe60abda
commit 778b655aa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 14 deletions

View File

@ -230,12 +230,9 @@ class CompanyController extends BaseController
*/ */
$company_token = CreateCompanyToken::dispatchNow($company, auth()->user()); $company_token = CreateCompanyToken::dispatchNow($company, auth()->user());
//todo Need to discuss this with Hillel which is the best representation to return
//when a company is created. Do we send the entire account? Do we only send back the created CompanyUser?
$this->entity_transformer = CompanyUserTransformer::class; $this->entity_transformer = CompanyUserTransformer::class;
$this->entity_type = CompanyUser::class; $this->entity_type = CompanyUser::class;
//return $this->itemResponse($company);
$ct = CompanyUser::whereUserId(auth()->user()->id)->whereCompanyId($company->id); $ct = CompanyUser::whereUserId(auth()->user()->id)->whereCompanyId($company->id);
return $this->listResponse($ct); return $this->listResponse($ct);

View File

@ -34,9 +34,6 @@ class ContactSetDb
'errors' => [] 'errors' => []
]; ];
// we must have a token passed, that matched a token in the db, and multiDB is enabled.
// todo i don't think we can call the DB prior to setting it???? i think this if statement needs to be rethought
//if( $request->header('X-API-TOKEN') && (CompanyToken::whereRaw("BINARY `token`= ?",[$request->header('X-API-TOKEN')])->first()) && config('ninja.db.multi_db_enabled'))
if( $request->header('X-API-TOKEN') && config('ninja.db.multi_db_enabled')) if( $request->header('X-API-TOKEN') && config('ninja.db.multi_db_enabled'))
{ {

View File

@ -33,9 +33,6 @@ class SetDb
'errors' => [] 'errors' => []
]; ];
// we must have a token passed, that matched a token in the db, and multiDB is enabled.
// todo i don't think we can call the DB prior to setting it???? i think this if statement needs to be rethought
//if( $request->header('X-API-TOKEN') && (CompanyToken::whereRaw("BINARY `token`= ?",[$request->header('X-API-TOKEN')])->first()) && config('ninja.db.multi_db_enabled'))
if( $request->header('X-API-TOKEN') && config('ninja.db.multi_db_enabled')) if( $request->header('X-API-TOKEN') && config('ninja.db.multi_db_enabled'))
{ {

View File

@ -89,7 +89,8 @@ class UpdateInvoicePayment implements ShouldQueue
$invoice->updateBalance($invoice->partial*-1); $invoice->updateBalance($invoice->partial*-1);
$invoice->clearPartial(); $invoice->clearPartial();
$invoice->setDueDate(); $invoice->setDueDate();
//todo do we need to mark it as a partial? $invoice->setStatus(Invoice::STATUS_PARTIAL);
} }
else else
{ {

View File

@ -54,12 +54,8 @@ class CreateUser
*/ */
public function handle() : ?User public function handle() : ?User
{ {
// $x = mt_rand(1,10000);//todo
// $email = 'turbo124+'. $x .'@gmail.com'; //todo
$user = new User(); $user = new User();
// $user->account_id = $this->account->id;
$user->password = bcrypt($this->request['password']); $user->password = bcrypt($this->request['password']);
$user->accepted_terms_version = config('ninja.terms_version'); $user->accepted_terms_version = config('ninja.terms_version');
$user->confirmation_code = $this->createDbHash(config('database.default')); $user->confirmation_code = $this->createDbHash(config('database.default'));

View File

@ -359,4 +359,10 @@ class Invoice extends BaseModel
$this->due_date = Carbon::now()->addDays(PaymentTerm::find($this->company->settings->payment_terms_id)->num_days); $this->due_date = Carbon::now()->addDays(PaymentTerm::find($this->company->settings->payment_terms_id)->num_days);
$this->save(); $this->save();
} }
public function setStatus($status)
{
$this->status_id = $status;
$this->save();
}
} }