Compare commits

..

18 commits

Author SHA1 Message Date
Vincent BRIDIER
ad38d3b475
Merge branch 'trunk' 2023-04-27 09:48:22 +02:00
Vincent BRIDIER
2053cae132
Merge branch 'develop' into trunk 2023-04-27 09:47:52 +02:00
Vincent BRIDIER
cdb4437be8
Remove rank sorting 2023-04-27 09:47:31 +02:00
Vincent BRIDIER
24104e836e
Remove rank sorting 2023-04-27 09:46:52 +02:00
Vincent BRIDIER
14b8e8d569 Merge branch 'trunk' 2023-04-26 20:21:55 +02:00
Vincent BRIDIER
12d14f8b7e Merge branch 'develop' into trunk 2023-04-26 20:21:29 +02:00
Vincent BRIDIER
85fb716340
Add k8s log config 2023-04-26 16:34:30 +02:00
Vincent BRIDIER
ba64378f79
Merge branch 'trunk' 2023-04-26 09:49:53 +02:00
Vincent BRIDIER
06c2493a76
Merge branch 'develop' into trunk 2023-04-26 09:49:44 +02:00
Vincent BRIDIER
59c5dbdae7
Add Dockerfile 2023-04-26 09:49:27 +02:00
Vincent BRIDIER
04e96131ad
Merge branch 'trunk' 2023-04-26 09:45:01 +02:00
Vincent BRIDIER
bc931e691c
Merge branch 'develop' into trunk 2023-04-26 09:44:49 +02:00
Vincent BRIDIER
fa24157e68
Update CI 2023-04-26 09:43:49 +02:00
Vincent BRIDIER
993317cdef
add stdout channel 2023-04-26 09:39:54 +02:00
Vincent BRIDIER
d7b7b14644
Merge branch 'trunk' 2023-04-21 16:53:41 +02:00
Vincent BRIDIER
db99aa9588
Merge branch 'develop' into trunk 2023-04-21 16:53:31 +02:00
Vincent BRIDIER
19959a5bc0 Merge branch 'backoffice' into 'develop'
Backoffice

Closes #1

See merge request ldc-web/projets/op-insta!1
2023-04-21 14:49:53 +00:00
Jérémy Munsch
61c8000cab Add Back-Office 2023-04-21 14:49:53 +00:00
11 changed files with 77 additions and 59 deletions

2
.dockerignore Normal file
View file

@ -0,0 +1,2 @@
.git
*.md

View file

@ -18,7 +18,7 @@ DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120
@ -32,7 +32,10 @@ MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
FACEBOOK_GRAPH_ACCESS_TOKEN=""
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_IGHASHTAGID=
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_HASHTAGID=
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_USERID=
# The amount of media to acquire
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_NBMEDIA=
# Sentry
SENTRY_LARAVEL_DSN=

View file

@ -11,14 +11,9 @@ include:
- project: 'ldc-web/shared-ci'
ref: 'main'
file: 'test/test.yml'
- project: 'ldc-web/shared-ci'
ref: 'main'
file: 'deploy/deploy.yml'
stages:
- lint
- security
- build
- test
- deploy

7
Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-8.2:latest
COPY --chown=www-data:www-data . /app/srcs
COPY --chown=www-data:www-data ./public/build /app/srcs/public/build
COPY --chown=www-data:www-data ./vendor /app/srcs/vendor
USER root
RUN chmod -R 755 /app/srcs/storage
USER www-data

View file

@ -12,15 +12,12 @@ php artisan migrate
.env
```
FACEBOOK_GRAPH_ACCESS_TOKEN=""
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_IGHASHTAGID=
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_HASHTAGID=
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_USERID=
# The amount of media to acquire
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_NBMEDIA=
```
Commande :
```
php artisan insta:get-top-medias
```
cette commande appelle le Job : InstaGetTopMediasJob
### TODO:
- Permettre la recherche d'un hashtag et d'utiliser son id pour topMediaList
- Refresh le token en automatique si detection expired

View file

@ -40,6 +40,9 @@ class Handler extends ExceptionHandler
public function register()
{
$this->reportable(function (Throwable $e) {
if (app()->bound('sentry')) {
app('sentry')->captureException($e);
}
});
}
}

View file

@ -41,9 +41,7 @@ class TopMediaController extends Controller
);
} //end if
$this->sortQuery($topMediaList);
$searchFields = trans('Id Instagram, Participant, Lien');
$topMediaList->orderBy('updated_at', 'DESC');
$topMediaList = $topMediaList->paginate();
return \view('bo.pages.top-media.index', \compact('topMediaList', 'searchFields', 'ranking'));

View file

@ -3,17 +3,16 @@
namespace App\Http\Controllers\Fo;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\View\View;
class HomeController extends Controller
{
/**
* Display a listing of the resource.
* Redirect to BO
*
* @return \Illuminate\Contracts\View\View
* @return \Illuminate\Http\RedirectResponse
*/
public function index(): View
public function index(): \Illuminate\Http\RedirectResponse
{
return view('fo.pages.home');
return \redirect()->route('bo.dashboard');
}
}

View file

@ -126,6 +126,22 @@ return [
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
'stdout' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDOUT_FORMATTER'),
'with' => [
'stream' => 'php://stdout',
],
],
'k8s' => [
'driver' => 'stack',
'channels' => ['daily', 'stdout'],
'ignore_exceptions' => false,
],
],
];

View file

@ -1,2 +1,2 @@
User-agent: *
Disallow:
Disallow: /

View file

@ -2,48 +2,46 @@
<table class="table fix-action">
<thead>
@php
$cols = [
'id' => __('Classement'),
'username' => __('Participant'),
'timestamp' => __('Date de création du post')];
$routeName = request()->route()->getName();
$rst = !is_null(request()->rst) || !Session::has("$routeName.sorted");
$noOrder = Session::get("$routeName.sort_col") !== 'order' and (Session::has("$routeName.sort_col") or Session::has("$routeName.sort_way"));
$noOrder = Session::get("$routeName.sort_col") !== '' and (Session::has("$routeName.sort_col") or Session::has("$routeName.sort_way"));
$cols = [
'id' => __('Classement'),
'username' => __('Participant'),
'timestamp' => __('Date de création du post')];
$routeName = request()->route()->getName();
$rst = !is_null(request()->rst) || !Session::has("$routeName.sorted");
$noOrder = Session::get("$routeName.sort_col") !== 'order' and (Session::has("$routeName.sort_col") or Session::has("$routeName.sort_way"));
$noOrder = Session::get("$routeName.sort_col") !== '' and (Session::has("$routeName.sort_col") or Session::has("$routeName.sort_way"));
@endphp
@include('modules.table-col-sorter', [
'cols' => $cols,
'ignore' => ['total', 'timeslot_date', 'shop'],
'mobileHide' => ['shop'],
])
<th>Classement</th>
<th>Participant</th>
<th>Date de création du post</th>
<th></th>
</thead>
<tbody>
@if ($topMediaList->count())
@foreach ($topMediaList as $topMediaModel)
<tr>
<td>
<strong class="fs-{{ $ranking->get($topMediaModel->insta_id) + 1 }}">#{{ $ranking->get($topMediaModel->insta_id) + 1 }}</strong>
</td>
<td>{{ $topMediaModel->username }}</td>
<td>
{{ $topMediaModel->timestamp->isoFormat('LLLL') }}
</td>
<td>
<a href="{{ $topMediaModel->permalink }}" title="{{ __('Voir le media sur instagram') }}" target="_blank" data-bs-toggle="tooltip">
<i class="fa-solid fa-arrow-up-right-from-square"></i>
</a>
</td>
</tr>
@endforeach
@foreach ($topMediaList as $topMediaModel)
<tr>
<td>
<strong class="fs-{{ $ranking->get($topMediaModel->insta_id) + 1 }}">#{{ $ranking->get($topMediaModel->insta_id) + 1 }}</strong>
</td>
<td>{{ $topMediaModel->username }}</td>
<td>
{{ $topMediaModel->timestamp->isoFormat('LLLL') }}
</td>
<td>
<a href="{{ $topMediaModel->permalink }}" title="{{ __('Voir le media sur instagram') }}" target="_blank" data-bs-toggle="tooltip">
<i class="fa-solid fa-arrow-up-right-from-square"></i>
</a>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="11" class="text-center">
<span
class="h3">{{ __('Aucun résultat pour les :models', ['models' => __('models.classes.insta_media')]) }}
</span>
</td>
</tr>
<tr>
<td colspan="11" class="text-center">
<span class="h3">{{ __('Aucun résultat pour les :models', ['models' => __('models.classes.insta_media')]) }}
</span>
</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>