Merge pull request #3933 from turbo124/v2

Fixes for refresh route
This commit is contained in:
David Bomba 2020-07-26 15:13:21 +10:00 committed by GitHub
commit 5a248ef973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 56 additions and 9 deletions

View File

@ -133,7 +133,30 @@ class BaseController extends Controller
protected function refreshResponse($query)
{
// $this->manager->parseIncludes($includes);
$includes = [
'company',
'company.groups',
'company.company_gateways.gateway',
'company.clients.contacts',
'company.products',
'company.invoices.invitations',
'company.invoices.documents',
'company.payments.paymentables',
'company.quotes.invitations.contact',
'company.quotes.documents.company',
'company.credits.invitations.contact',
'company.credits.documents.company',
'company.payment_terms.company',
'company.credits.invitations.contact',
'company.credits.invitations.company',
'company.vendors.contacts',
'company.expenses',
'company.tasks',
'company.projects',
'company.designs',
];
$this->manager->parseIncludes($includes);
$this->serializer = request()->input('serializer') ?: EntityTransformer::API_SERIALIZER_ARRAY;
@ -143,7 +166,7 @@ class BaseController extends Controller
$this->manager->setSerializer(new ArraySerializer());
}
$transformer = new $this->entity_transformer(Input::get('serializer'));
$transformer = new $this->entity_transformer($this->serializer);
$updated_at = request()->has('updated_at') ? request()->input('updated_at') : 0;
$updated_at = date('Y-m-d H:i:s', $updated_at);
@ -169,7 +192,7 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at);
},
'company.invoices'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at)->with('invitations','documents');
$query->where('updated_at', '>=', $updated_at)->with('invitations','company','documents');
},
'company.payments'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at)->with('paymentables');
@ -422,6 +445,8 @@ class BaseController extends Controller
$data['report_errors'] = true;
}
$data['hash'] = md5(public_path('main.dart.js'));
return view('index.index', $data);
}

View File

@ -51,7 +51,7 @@ class QueryLogging
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
// if($count > 700)
// Log::info($queries);
Log::info($queries);
}
}

View File

@ -137,6 +137,11 @@ class Credit extends BaseModel
return $this->belongsTo(Client::class)->withTrashed();
}
// public function contacts()
// {
// return $this->hasManyThrough(ClientContact::class, Client::class);
// }
public function invitations()
{
return $this->hasMany(CreditInvitation::class);

View File

@ -34,7 +34,8 @@ class CreditInvitation extends BaseModel
];
protected $with = [
// 'company',
'company',
'contact',
];
protected $touches = ['credit'];

View File

@ -192,6 +192,11 @@ class Invoice extends BaseModel
return $this->belongsTo(Client::class)->withTrashed();
}
// public function contacts()
// {
// return $this->hasManyThrough(ClientContact::class, Client::class);
// }
public function documents()
{
return $this->morphMany(Document::class, 'documentable');

View File

@ -33,7 +33,8 @@ class InvoiceInvitation extends BaseModel
];
protected $with = [
// 'company',
'company',
'contact',
];
protected $touches = ['invoice'];

View File

@ -137,6 +137,11 @@ class Quote extends BaseModel
return $this->belongsTo(Client::class)->withTrashed();
}
// public function contacts()
// {
// return $this->hasManyThrough(ClientContact::class, Client::class);
// }
public function assigned_user()
{
return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed();

View File

@ -33,6 +33,11 @@ class QuoteInvitation extends BaseModel
'client_contact_id',
];
protected $with = [
'company',
'contact',
];
protected $touches = ['quote'];
public function getEntityType()

View File

@ -5,7 +5,7 @@
<title>Invoice Ninja</title>
<meta name="report_errors" content="{{ $report_errors }}">
<meta name="google-signin-client_id" content="{{ config('services.google.client_id') }}">
<link rel="manifest" href="manifest.json?v={{ md5(public_path('manifest.json')) }}">
<link rel="manifest" href="manifest.json?v={{ $hash }}">
</head>
<body style="background-color:#888888;">
@ -75,7 +75,7 @@
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('/flutter_service_worker.js?v={{ md5(public_path('flutter_service_worker.js')) }}');
navigator.serviceWorker.register('/flutter_service_worker.js?v={{ $hash }}');
});
}
@ -84,7 +84,7 @@
});
</script>
<script defer src="main.dart.js?v={{ md5(public_path('main.dart.js')) }}" type="application/javascript"></script>
<script defer src="main.dart.js?v={{ $hash }}" type="application/javascript"></script>
<center style="padding-top: 150px" id="loader">
<div class="loader"></div>