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

View file

@ -11,14 +11,9 @@ include:
- project: 'ldc-web/shared-ci' - project: 'ldc-web/shared-ci'
ref: 'main' ref: 'main'
file: 'test/test.yml' file: 'test/test.yml'
- project: 'ldc-web/shared-ci'
ref: 'main'
file: 'deploy/deploy.yml'
stages: stages:
- lint - lint
- security - security
- build - build
- test - 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 .env
``` ```
FACEBOOK_GRAPH_ACCESS_TOKEN="" FACEBOOK_GRAPH_ACCESS_TOKEN=""
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_IGHASHTAGID= FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_HASHTAGID=
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_USERID= 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: ### TODO:
- Permettre la recherche d'un hashtag et d'utiliser son id pour topMediaList - 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() public function register()
{ {
$this->reportable(function (Throwable $e) { $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 } //end if
$this->sortQuery($topMediaList);
$searchFields = trans('Id Instagram, Participant, Lien'); $searchFields = trans('Id Instagram, Participant, Lien');
$topMediaList->orderBy('updated_at', 'DESC');
$topMediaList = $topMediaList->paginate(); $topMediaList = $topMediaList->paginate();
return \view('bo.pages.top-media.index', \compact('topMediaList', 'searchFields', 'ranking')); return \view('bo.pages.top-media.index', \compact('topMediaList', 'searchFields', 'ranking'));

View file

@ -3,17 +3,16 @@
namespace App\Http\Controllers\Fo; namespace App\Http\Controllers\Fo;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Contracts\View\View;
class HomeController extends Controller 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' => [ 'emergency' => [
'path' => storage_path('logs/laravel.log'), '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: * User-agent: *
Disallow: Disallow: /

View file

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