commit iniziale

This commit is contained in:
Marco Cavalli 2023-10-05 11:54:33 +02:00
parent 9e364c6696
commit a40cafc383
46 changed files with 9556 additions and 1 deletions

15
.editorconfig Normal file
View File

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2

14
.env.example Normal file
View File

@ -0,0 +1,14 @@
APP_NAME=Lumen
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_TIMEZONE=UTC
APP_PASSWORD=
LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=
GITEA_ORGANIZATION=
GITEA_URL=
GITEA_TOKEN=

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
/vendor
/.idea
Homestead.json
Homestead.yaml
.env
.phpunit.result.cache

6
.styleci.yml Normal file
View File

@ -0,0 +1,6 @@
php:
preset: laravel
disabled:
- unused_use
js: true
css: true

View File

@ -1,2 +1,7 @@
# gitea_issues_exporter
# Gitea Issues Exporter
Simple application built on [Lumen](https://lumen.laravel.com) to export as csv file closed issues with tracked time on a gitea instance.
## License
Gitea Issues Exporter is open-sourced software licensed under the [GPL2 license](https://opensource.org/license/gpl-2-0/).

View File

29
app/Console/Kernel.php Normal file
View File

@ -0,0 +1,29 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
//
}
}

10
app/Events/Event.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App\Events;
use Illuminate\Queue\SerializesModels;
abstract class Event
{
use SerializesModels;
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Events;
class ExampleEvent extends Event
{
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
//
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace App\Exceptions;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Validation\ValidationException;
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
ValidationException::class,
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
class CheckSimpleAuthController extends Controller
{
public function check(Request $req) {
if (
getenv('GITEA_ORGANIZATION') === $req->input('organizzazione')
&&
getenv('APP_PASSWORD') === $req->input('password')
) {
return view('backend', [
'token' => getenv('GITEA_TOKEN')
]);
} else {
return redirect('/');
}
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Laravel\Lumen\Routing\Controller as BaseController;
class Controller extends BaseController
{
//
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Http\Controllers;
class ExampleController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//
}
//
}

View File

@ -0,0 +1,120 @@
<?php
namespace App\Http\Controllers;
use OwenVoke\Gitea\Client;
use Illuminate\Http\Request;
use DateTime;
class GiteaApiController extends Controller
{
private $giteaClient;
private $organization;
public function __construct()
{
$this->organization = getenv('GITEA_ORGANIZATION');
$this->giteaClient = new Client(null, null, getenv('GITEA_URL'));
$this->giteaClient->authenticate(getenv('GITEA_TOKEN'), null, Client::AUTH_ACCESS_TOKEN);
}
private function get_repositories()
{
$repositories = $this->giteaClient->organizations()->repositories($this->organization, 1, 9999);
return $repositories;
}
private function get_issues(string $repository, array $parameters = array())
{
return $issues = $this->giteaClient->repositories()->issues()->all($this->organization, $repository, $parameters);
}
private function get_issue_total_time(string $repository, int $id)
{
$times = $this->giteaClient->repositories()->issues()->times($this->organization, $repository, $id);
$count = 0;
foreach ($times as $time) {
$count += (int) $time['time'];
}
return $count;
}
private function get_issue_labels(array $issue)
{
$labels = '';
foreach ($issue['labels'] as $label) {
$labels .= $label['name'] . ',';
}
return $labels;
}
private function create_columns(array $issue)
{
return array(
'Progetto' => $issue['repository']['name'],
'#' => $issue['number'],
'Titolo' => $issue['title'],
'URL' => $issue['html_url'],
'Aperto_il' => $issue['created_at'],
'Chiuso_il' => $issue['closed_at'],
'Etichette' => $this->get_issue_labels($issue),
'Tempo' => gmdate('H:i:s', $this->get_issue_total_time($issue['repository']['name'], $issue['number']))
);
}
private function create_csv(string $file_name, array $data)
{
$f = fopen('php://output', 'w'); // Configure fopen to create, open, and write data.
fputcsv($f, array_keys($data[0])); // Add the keys as the column headers
// Loop over the array and passing in the values only.
foreach ($data as $row) {
fputcsv($f, $row);
}
fclose($f);
// tell the browser it's going to be a csv file
header('Content-Type: text/csv');
// tell the browser we want to save it instead of displaying it
header('Content-Disposition: attachment; filename="' . $file_name . '.csv";');
exit();
}
private function date_to_datetime(string $date)
{
$date = str_replace('/', '-', $date);
$datetime = new DateTime($date);
return $datetime->format('Y-m-d H:i:s');
}
private function export_issues(string $from_date, array $issues_params)
{
$data = array();
$repositories = $this->get_repositories();
foreach ($repositories as $repository) {
$issues = $this->get_issues($repository['name'], $issues_params);
foreach ($issues as $issue) {
$from_datetime = $this->date_to_datetime($from_date);
if (substr($issue['closed_at'], 0, 19) > $from_datetime) {
$data[] = $this->create_columns($issue);
}
}
}
$file_name = date('Y_F', strtotime(explode(' ', $data[0]['Chiuso_il'])[0]));
$this->create_csv($file_name, $data);
}
public function export_closed_issues(Request $req)
{
if ($req->input('token') != getenv('GITEA_TOKEN')) {
return redirect('/');
}
$date = $req->input('year') . '-' . $req->input('month') . '-01';
$this->export_issues($date, ['state' => 'closed']);
return view('backend', [
'token' => getenv('GITEA_TOKEN')
]);
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Factory as Auth;
class Authenticate
{
/**
* The authentication guard factory instance.
*
* @var \Illuminate\Contracts\Auth\Factory
*/
protected $auth;
/**
* Create a new middleware instance.
*
* @param \Illuminate\Contracts\Auth\Factory $auth
* @return void
*/
public function __construct(Auth $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if ($this->auth->guard($guard)->guest()) {
return response('Unauthorized.', 401);
}
return $next($request);
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Closure;
class ExampleMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
return $next($request);
}
}

26
app/Jobs/ExampleJob.php Normal file
View File

@ -0,0 +1,26 @@
<?php
namespace App\Jobs;
class ExampleJob extends Job
{
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
}
}

24
app/Jobs/Job.php Normal file
View File

@ -0,0 +1,24 @@
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
abstract class Job implements ShouldQueue
{
/*
|--------------------------------------------------------------------------
| Queueable Jobs
|--------------------------------------------------------------------------
|
| This job base class provides a central location to place any logic that
| is shared across all of your jobs. The trait included with the class
| provides access to the "queueOn" and "delay" queue helper methods.
|
*/
use InteractsWithQueue, Queueable, SerializesModels;
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Listeners;
use App\Events\ExampleEvent;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class ExampleListener
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param \App\Events\ExampleEvent $event
* @return void
*/
public function handle(ExampleEvent $event)
{
//
}
}

33
app/Models/User.php Normal file
View File

@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Laravel\Lumen\Auth\Authorizable;
class User extends Model implements AuthenticatableContract, AuthorizableContract
{
use Authenticatable, Authorizable, HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'name', 'email',
];
/**
* The attributes excluded from the model's JSON form.
*
* @var string[]
*/
protected $hidden = [
'password',
];
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Providers;
use App\Models\User;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Boot the authentication services for the application.
*
* @return void
*/
public function boot()
{
// Here you may define how you wish users to be authenticated for your Lumen
// application. The callback which receives the incoming request instance
// should return either a User instance or null. You're free to obtain
// the User instance via an API token or any other method necessary.
$this->app['auth']->viaRequest('api', function ($request) {
if ($request->input('api_token')) {
return User::where('api_token', $request->input('api_token'))->first();
}
});
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Providers;
use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
\App\Events\ExampleEvent::class => [
\App\Listeners\ExampleListener::class,
],
];
/**
* Determine if events and listeners should be automatically discovered.
*
* @return bool
*/
public function shouldDiscoverEvents()
{
return false;
}
}

35
artisan Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| First we need to get an application instance. This creates an instance
| of the application / container and bootstraps the application so it
| is ready to receive HTTP / Console requests from the environment.
|
*/
$app = require __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(
'Illuminate\Contracts\Console\Kernel'
);
exit($kernel->handle(new ArgvInput, new ConsoleOutput));

116
bootstrap/app.php Normal file
View File

@ -0,0 +1,116 @@
<?php
require_once __DIR__.'/../vendor/autoload.php';
(new Laravel\Lumen\Bootstrap\LoadEnvironmentVariables(
dirname(__DIR__)
))->bootstrap();
date_default_timezone_set(env('APP_TIMEZONE', 'UTC'));
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| Here we will load the environment and create the application instance
| that serves as the central piece of this framework. We'll use this
| application as an "IoC" container and router for this framework.
|
*/
$app = new Laravel\Lumen\Application(
dirname(__DIR__)
);
$app->withFacades();
// $app->withEloquent();
/*
|--------------------------------------------------------------------------
| Register Container Bindings
|--------------------------------------------------------------------------
|
| Now we will register a few bindings in the service container. We will
| register the exception handler and the console kernel. You may add
| your own bindings here if you like or you can make another file.
|
*/
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
/*
|--------------------------------------------------------------------------
| Register Config Files
|--------------------------------------------------------------------------
|
| Now we will register the "app" configuration file. If the file exists in
| your configuration directory it will be loaded; otherwise, we'll load
| the default version. You may register other files below as needed.
|
*/
$app->configure('app');
/*
|--------------------------------------------------------------------------
| Register Middleware
|--------------------------------------------------------------------------
|
| Next, we will register the middleware with the application. These can
| be global middleware that run before and after each request into a
| route or middleware that'll be assigned to some specific routes.
|
*/
// $app->middleware([
// App\Http\Middleware\ExampleMiddleware::class
// ]);
// $app->routeMiddleware([
// 'auth' => App\Http\Middleware\Authenticate::class,
// ]);
/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
|
| Here we will register all of the application's service providers which
| are used to bind services into the container. Service providers are
| totally optional, so you are not required to uncomment this line.
|
*/
// $app->register(App\Providers\AppServiceProvider::class);
// $app->register(App\Providers\AuthServiceProvider::class);
// $app->register(App\Providers\EventServiceProvider::class);
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
/*
|--------------------------------------------------------------------------
| Load The Application Routes
|--------------------------------------------------------------------------
|
| Next we will include the routes file so that they can all be added to
| the application. This will provide all of the URLs the application
| can respond to, as well as the controllers that may handle them.
|
*/
$app->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/web.php';
});
return $app;

58
composer.json Normal file
View File

@ -0,0 +1,58 @@
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": [
"framework",
"laravel",
"lumen"
],
"license": "MIT",
"type": "project",
"require": {
"php": "^8.1",
"flipbox/lumen-generator": "^9.2",
"guzzlehttp/guzzle": "^7.4",
"http-interop/http-factory-guzzle": "^1.2",
"laravel/lumen-framework": "^10.0",
"owenvoke/gitea": "dev-main as 0.1.6"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/albumed/gitea-php",
"only": ["owenvoke/gitea"]
}
],
"require-dev": {
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.4",
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

8442
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name,
'email' => $this->faker->unique()->safeEmail,
];
}
}

View File

View File

@ -0,0 +1,19 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// $this->call('UsersTableSeeder');
}
}

17
phpunit.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
</php>
</phpunit>

21
public/.htaccess Normal file
View File

@ -0,0 +1,21 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

15
public/2023_October.csv Normal file
View File

@ -0,0 +1,15 @@
Progetto,#,Titolo,URL,Aperto_il,Chiuso_il,Etichette,Tempo
gruppo_co,2,"Sovrapposizione top bar e menu",https://git.congegni.net/GruppoCO/gruppo_co/issues/2,2023-09-29T11:06:55+02:00,2023-10-02T12:29:04+02:00,"Kind/Bug,Priority/Medium,Status/Resolved,",00:30:00
gruppo_co,1,"Pagina contatti non funziona mappa",https://git.congegni.net/GruppoCO/gruppo_co/issues/1,2023-09-21T16:55:03+02:00,2023-09-21T17:04:22+02:00,"Kind/Bug,Priority/Low,Status/Confirmed,",00:00:00
turinigroup_wordpress,1,"Schermata Bianca in WordPress Durante la Modifica di Articoli e Pagine",https://git.congegni.net/GruppoCO/turinigroup_wordpress/issues/1,2023-09-27T10:26:00+02:00,2023-09-27T17:35:11+02:00,"Kind/Bug,Priority/Medium,Status/Resolved,",00:30:00
italy_law_firms_fiscalcode,1,"Integrazione testi pagina German",https://git.congegni.net/GruppoCO/italy_law_firms_fiscalcode/issues/1,2023-09-27T15:38:47+02:00,2023-09-27T17:04:36+02:00,,00:00:00
beauty_san,2,"CNS e JB - modifiche Mail discovery kit",https://git.congegni.net/GruppoCO/beauty_san/issues/2,2023-09-28T16:39:54+02:00,2023-10-03T18:24:47+02:00,"Kind/Bug,Priority/Low,RequestBy/GruppoCO,Status/Resolved,",00:30:00
beauty_san,1,"Tuttotondo - Caricamento video YouTube",https://git.congegni.net/GruppoCO/beauty_san/issues/1,2023-09-27T18:40:54+02:00,2023-10-03T18:25:31+02:00,"Kind/Enhancement,Priority/High,RequestBy/GruppoCO,Status/Resolved,",00:00:00
Progetto,#,Titolo,URL,Aperto_il,Chiuso_il,Etichette,Tempo
londinese,1,"Caricamento della cartella immagini nel backoffice o ftp",https://git.congegni.net/GruppoCO/londinese/issues/1,2023-09-27T16:37:06+02:00,2023-10-04T17:01:59+02:00,"Priority/Low,RequestBy/GruppoCO,Status/Resolved,",00:15:00
gruppo_co,2,"Sovrapposizione top bar e menu",https://git.congegni.net/GruppoCO/gruppo_co/issues/2,2023-09-29T11:06:55+02:00,2023-10-02T12:29:04+02:00,"Kind/Bug,Priority/Medium,Status/Resolved,",00:30:00
gruppo_co,1,"Pagina contatti non funziona mappa",https://git.congegni.net/GruppoCO/gruppo_co/issues/1,2023-09-21T16:55:03+02:00,2023-09-21T17:04:22+02:00,"Kind/Bug,Priority/Low,Status/Confirmed,",00:00:00
turinigroup_wordpress,1,"Schermata Bianca in WordPress Durante la Modifica di Articoli e Pagine",https://git.congegni.net/GruppoCO/turinigroup_wordpress/issues/1,2023-09-27T10:26:00+02:00,2023-09-27T17:35:11+02:00,"Kind/Bug,Priority/Medium,Status/Resolved,",00:30:00
italy_law_firms_fiscalcode,1,"Integrazione testi pagina German",https://git.congegni.net/GruppoCO/italy_law_firms_fiscalcode/issues/1,2023-09-27T15:38:47+02:00,2023-09-27T17:04:36+02:00,,00:00:00
beauty_san,2,"CNS e JB - modifiche Mail discovery kit",https://git.congegni.net/GruppoCO/beauty_san/issues/2,2023-09-28T16:39:54+02:00,2023-10-03T18:24:47+02:00,"Kind/Bug,Priority/Low,RequestBy/GruppoCO,Status/Resolved,",00:30:00
beauty_san,1,"Tuttotondo - Caricamento video YouTube",https://git.congegni.net/GruppoCO/beauty_san/issues/1,2023-09-27T18:40:54+02:00,2023-10-03T18:25:31+02:00,"Kind/Enhancement,Priority/High,RequestBy/GruppoCO,Status/Resolved,",00:00:00
1 Progetto # Titolo URL Aperto_il Chiuso_il Etichette Tempo
2 gruppo_co 2 Sovrapposizione top bar e menu https://git.congegni.net/GruppoCO/gruppo_co/issues/2 2023-09-29T11:06:55+02:00 2023-10-02T12:29:04+02:00 Kind/Bug,Priority/Medium,Status/Resolved, 00:30:00
3 gruppo_co 1 Pagina contatti non funziona mappa https://git.congegni.net/GruppoCO/gruppo_co/issues/1 2023-09-21T16:55:03+02:00 2023-09-21T17:04:22+02:00 Kind/Bug,Priority/Low,Status/Confirmed, 00:00:00
4 turinigroup_wordpress 1 Schermata Bianca in WordPress Durante la Modifica di Articoli e Pagine https://git.congegni.net/GruppoCO/turinigroup_wordpress/issues/1 2023-09-27T10:26:00+02:00 2023-09-27T17:35:11+02:00 Kind/Bug,Priority/Medium,Status/Resolved, 00:30:00
5 italy_law_firms_fiscalcode 1 Integrazione testi pagina German https://git.congegni.net/GruppoCO/italy_law_firms_fiscalcode/issues/1 2023-09-27T15:38:47+02:00 2023-09-27T17:04:36+02:00 00:00:00
6 beauty_san 2 CNS e JB - modifiche Mail discovery kit https://git.congegni.net/GruppoCO/beauty_san/issues/2 2023-09-28T16:39:54+02:00 2023-10-03T18:24:47+02:00 Kind/Bug,Priority/Low,RequestBy/GruppoCO,Status/Resolved, 00:30:00
7 beauty_san 1 Tuttotondo - Caricamento video YouTube https://git.congegni.net/GruppoCO/beauty_san/issues/1 2023-09-27T18:40:54+02:00 2023-10-03T18:25:31+02:00 Kind/Enhancement,Priority/High,RequestBy/GruppoCO,Status/Resolved, 00:00:00
8 Progetto # Titolo URL Aperto_il Chiuso_il Etichette Tempo
9 londinese 1 Caricamento della cartella immagini nel backoffice o ftp https://git.congegni.net/GruppoCO/londinese/issues/1 2023-09-27T16:37:06+02:00 2023-10-04T17:01:59+02:00 Priority/Low,RequestBy/GruppoCO,Status/Resolved, 00:15:00
10 gruppo_co 2 Sovrapposizione top bar e menu https://git.congegni.net/GruppoCO/gruppo_co/issues/2 2023-09-29T11:06:55+02:00 2023-10-02T12:29:04+02:00 Kind/Bug,Priority/Medium,Status/Resolved, 00:30:00
11 gruppo_co 1 Pagina contatti non funziona mappa https://git.congegni.net/GruppoCO/gruppo_co/issues/1 2023-09-21T16:55:03+02:00 2023-09-21T17:04:22+02:00 Kind/Bug,Priority/Low,Status/Confirmed, 00:00:00
12 turinigroup_wordpress 1 Schermata Bianca in WordPress Durante la Modifica di Articoli e Pagine https://git.congegni.net/GruppoCO/turinigroup_wordpress/issues/1 2023-09-27T10:26:00+02:00 2023-09-27T17:35:11+02:00 Kind/Bug,Priority/Medium,Status/Resolved, 00:30:00
13 italy_law_firms_fiscalcode 1 Integrazione testi pagina German https://git.congegni.net/GruppoCO/italy_law_firms_fiscalcode/issues/1 2023-09-27T15:38:47+02:00 2023-09-27T17:04:36+02:00 00:00:00
14 beauty_san 2 CNS e JB - modifiche Mail discovery kit https://git.congegni.net/GruppoCO/beauty_san/issues/2 2023-09-28T16:39:54+02:00 2023-10-03T18:24:47+02:00 Kind/Bug,Priority/Low,RequestBy/GruppoCO,Status/Resolved, 00:30:00
15 beauty_san 1 Tuttotondo - Caricamento video YouTube https://git.congegni.net/GruppoCO/beauty_san/issues/1 2023-09-27T18:40:54+02:00 2023-10-03T18:25:31+02:00 Kind/Enhancement,Priority/High,RequestBy/GruppoCO,Status/Resolved, 00:00:00

28
public/index.php Normal file
View File

@ -0,0 +1,28 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| First we need to get an application instance. This creates an instance
| of the application / container and bootstraps the application so it
| is ready to receive HTTP / Console requests from the environment.
|
*/
$app = require __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();

0
resources/views/.gitkeep Normal file
View File

View File

@ -0,0 +1,41 @@
@extends('layout')
@section('title', 'Backoffice')
@section('content')
<section class="login" style="max-width:800px;width:100%:">
<div class="card">
<div class="card-header">
Genera il file
</div>
<div class="card-body">
<form name="search-form" action="{{ url('export') }}" method="POST">
<input type="hidden" name="token" value="{{$token}}">
<p>Esportazione a partire da:</p>
<div class="mb-3">
<label for="Mese" class="form-label">Mese</label>
<select class="form-control" id="month" name="month">
<option value="01">Jan</option>
<option value="02">Feb</option>
<option value="03">Mar</option>
<option value="04">Apr</option>
<option value="05">May</option>
<option value="06">Jun</option>
<option value="07">Jul</option>
<option value="08">Aug</option>
<option value="09">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
</div>
<div class="mb-3">
<label for="Anno" class="form-label">Anno</label>
<input type="number" value="{{date('Y')}}" min="2000" max="2099" class="form-control" id="year" name="year">
</div>
<button type="submit" class="btn btn-primary" style="width:100%;">Entra</button>
</form>
</div>
</div>
</section>
@endsection

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Congegni Issues Exporter - @yield('title')</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<main class="container-fluid d-flex justify-content-center align-items-center" style="min-height:100vh;">
@yield('content')
</main>
</body>
</html>

View File

@ -0,0 +1,27 @@
@extends('layout')
@section('title', 'Login')
@section('content')
<section class="login" style="max-width:600px;width:100%:">
<div class="card">
<div class="card-header">
Effettua il login
</div>
<div class="card-body">
<form name="login-form" action="{{ url('backend') }}" method="POST">
<div class="mb-3">
<label for="organizzazione" class="form-label">Organizzazione</label>
<input type="text" class="form-control" id="organizzazione" name="organizzazione" aria-describedby="textHelp">
<div id="textHelp" class="form-text">Così come compare scritta sul git.</div>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password">
</div>
<button type="submit" class="btn btn-primary" style="width:100%;">Entra</button>
</form>
</div>
</div>
</section>
@endsection

46
routes/web.php Normal file
View File

@ -0,0 +1,46 @@
<?php
/** @var \Laravel\Lumen\Routing\Router $router */
use App\Http\Controllers\GiteaApiController;
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
$router->get('{catchall}', function () use ($router) {
// $call = new GiteaApiController();
// $call->export_issues('01/09/2023',['state' => 'closed']);
return redirect('/');
});
$router->get('/', function () use ($router) {
// $call = new GiteaApiController();
// $call->export_issues('01/09/2023',['state' => 'closed']);
return view('login');
});
$router->post('backend', [
'as' => 'backend',
'uses' => 'CheckSimpleAuthController@check'
]);
$router->post('export', [
'as' => 'export',
'uses' => 'GiteaApiController@export_closed_issues'
]);
// $router->post('backend', [
// 'as' => 'backend',
// 'uses' => 'CheckSimpleAuthController@show'
// ]);

2
storage/app/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

3
storage/framework/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*
!data/
!.gitignore

View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/framework/views/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/logs/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

23
tests/ExampleTest.php Normal file
View File

@ -0,0 +1,23 @@
<?php
namespace Tests;
use Laravel\Lumen\Testing\DatabaseMigrations;
use Laravel\Lumen\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function test_that_base_endpoint_returns_a_successful_response()
{
$this->get('/');
$this->assertEquals(
$this->app->version(), $this->response->getContent()
);
}
}

18
tests/TestCase.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace Tests;
use Laravel\Lumen\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
/**
* Creates the application.
*
* @return \Laravel\Lumen\Application
*/
public function createApplication()
{
return require __DIR__.'/../bootstrap/app.php';
}
}