Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
P
Pardus Kataliz - pardusacikhack
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
kataliz
Pardus Kataliz - pardusacikhack
Commits
4eac0df5
Kaydet (Commit)
4eac0df5
authored
May 03, 2021
tarafından
Emincan Özcan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
api update
üst
e4420e4d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
49 deletions
+40
-49
FetchAllDataController.php
backend/app/Http/Controllers/Api/FetchAllDataController.php
+38
-0
FetchAlternativeAppsController.php
...p/Http/Controllers/Api/FetchAlternativeAppsController.php
+0
-23
FetchAppPackages.php
backend/app/Http/Controllers/Api/FetchAppPackages.php
+0
-23
api.php
backend/routes/api.php
+2
-3
No files found.
backend/app/Http/Controllers/Api/FetchAllDataController.php
0 → 100644
Dosyayı görüntüle @
4eac0df5
<?php
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\Controller
;
use
App\Models\AppPackage
;
use
App\Models\NonPardusApp
;
use
App\Models\PardusApp
;
use
Illuminate\Http\Request
;
class
FetchAllDataController
extends
Controller
{
public
function
__invoke
()
{
// caching this all data probably good idea for production usage.
$pardusApps
=
PardusApp
::
select
([
'id'
,
'name'
,
'image_url'
,
'scripts'
])
->
get
();
$nonPardusApps
=
NonPardusApp
::
select
([
'id'
,
'name'
,
'image_url'
])
->
with
([
'pardusApps:id'
])
->
get
()
->
toArray
();
foreach
(
$nonPardusApps
as
$k
=>
$v
)
{
$nonPardusApps
[
$k
][
'pardus_apps'
]
=
collect
(
$v
[
'pardus_apps'
])
->
pluck
(
'id'
)
->
toArray
();
}
$appPackages
=
AppPackage
::
select
([
'id'
,
'name'
,
'image_url'
])
->
with
(
'pardusApps:id'
)
->
get
()
->
toArray
();
foreach
(
$appPackages
as
$k
=>
$v
)
{
$appPackages
[
$k
][
'pardus_apps'
]
=
collect
(
$v
[
'pardus_apps'
])
->
pluck
(
'id'
)
->
toArray
();
}
return
response
([
'success'
=>
true
,
'message'
=>
'Alternative apps are fetched successfully.'
,
'data'
=>
[
'pardus_apps'
=>
$pardusApps
,
'non_pardus_apps'
=>
$nonPardusApps
,
'app_packages'
=>
$appPackages
]
]);
}
}
backend/app/Http/Controllers/Api/FetchAlternativeAppsController.php
deleted
100644 → 0
Dosyayı görüntüle @
e4420e4d
<?php
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\Controller
;
use
App\Models\NonPardusApp
;
use
Illuminate\Http\Request
;
class
FetchAlternativeAppsController
extends
Controller
{
public
function
__invoke
()
{
// @todo send only id fields of pardus apps, client itself should fetch pardusApps and merge data.
$data
=
NonPardusApp
::
with
(
'pardusApps'
)
->
get
();
return
response
([
'success'
=>
true
,
'message'
=>
'Alternative apps are fetched successfully.'
,
'data'
=>
[
'alternative_apps'
=>
$data
,
]
]);
}
}
backend/app/Http/Controllers/Api/FetchAppPackages.php
deleted
100644 → 0
Dosyayı görüntüle @
e4420e4d
<?php
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\Controller
;
use
App\Models\AppPackage
;
use
App\Models\NonPardusApp
;
use
Illuminate\Http\Request
;
class
FetchAppPackages
extends
Controller
{
public
function
__invoke
()
{
$data
=
AppPackage
::
with
(
'pardusApps'
)
->
get
();
return
response
([
'success'
=>
true
,
'message'
=>
'App packages are fetched successfully.'
,
'data'
=>
[
'app_packages'
=>
$data
,
]
]);
}
}
backend/routes/api.php
Dosyayı görüntüle @
4eac0df5
<?php
use
App\Http\Controllers\Api\FetchAl
ternativeApps
Controller
;
use
App\Http\Controllers\Api\FetchAl
lData
Controller
;
use
App\Http\Controllers\Api\FetchAppPackages
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Route
;
...
...
@@ -20,5 +20,4 @@ Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return
$request
->
user
();
});
Route
::
get
(
'alternative-apps'
,
FetchAlternativeAppsController
::
class
);
Route
::
get
(
'app-packages'
,
FetchAppPackages
::
class
);
Route
::
get
(
'get-all-data'
,
FetchAllDataController
::
class
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment