Sort of working beta

This commit is contained in:
2025-02-06 17:30:45 +01:00
parent 5f42c707eb
commit 2ef114e154
97 changed files with 3093 additions and 106 deletions

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@ -17,7 +17,7 @@ return new class extends Migration
$table->string('name');
$table->text('description')->nullable();
$table->boolean('is_active')->default(true);
$table->boolean('is_active')->default(false);
$table->timestamps();
});
@ -38,21 +38,24 @@ return new class extends Migration
$jobs = [
[
'id' => 1,
'name' => 'Hellcase',
'description' => 'Prends le daily free et rentre dans les concours. Tourne toutes les 24h.',
'is_active' => false,
'name' => 'Paramètres généraux',
'description' => "Les paramètres généraux de l'application.",
'is_active' => true,
],
[
'id' => 2,
'name' => 'Jeu gratuit Epic Games',
'description' => 'Prends le jeu gratuit Epic games. Tourne tous les mois et tous les jours pendant la période de Noël.',
'is_active' => false,
'name' => 'Hellcase',
'description' => 'Prends le daily free et rentre dans les concours. Tourne toutes les 24h.',
],
[
'id' => 3,
'name' => 'Jeu gratuit Epic Games',
'description' => 'Prends le jeu gratuit Epic games. Tourne tous les mois et tous les jours pendant la période de Noël.',
],
[
'id' => 4,
'name' => 'Envoyer un post instagram',
'description' => "Envoye un post instagram avec l'image et le texte fourni. Tourne tous les jours.",
'is_active' => false,
],
];

View File

@ -0,0 +1,58 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('job_info_types', function (Blueprint $table) {
$table->id();
$table->string('name')->unique()->index(); // html input type
$table->timestamps();
});
$this->seed();
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('job_info_types');
}
public function seed(): void
{
$jobInfosTypes = [
[
"id" => 1,
"name" => "text",
],
[
"id" => 2,
"name" => "email",
],
[
"id" => 3,
"name" => "password",
],
[
"id" => 4,
"name" => "url",
],
];
foreach ($jobInfosTypes as $jobInfoType) {
\App\Models\JobInfoType::forceCreate($jobInfoType);
}
}
};

View File

@ -0,0 +1,107 @@
<?php
use App\Models\JobInfoType;
use App\Models\Job;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('job_infos', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->string('name');
$table->text('description')->nullable();
$table->string('placeholder')->nullable();
$table->text('value')->nullable();
$table->boolean('is_required')->default(true);
$table->foreignIdFor(JobInfoType::class, "job_info_type_id")->constrained()->onDelete('cascade');
$table->foreignIdFor(Job::class,'job_id')->constrained()->onDelete('cascade');
$table->timestamps();
});
$this->seed();
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('job_infos');
}
public function seed(): void
{
$jobInfos = [
/* GENERAL PARAMETERS */
[
"key" => "discord_webhook_url",
"name" => "Messages - Webhook Discord",
"description" => "Le lien discord webhook utilisé pour envoyer les messages des résultats des jobs.",
"placeholder" => "https://discord.com/api/webhooks/...",
"job_info_type_id" => 4,
"job_id" => 1,
],
[
"key" => "discord_error_webhook_url",
"name" => "Alertes - Webhook Discord",
"description" => "Le lien discord webhook utilisé pour envoyer les messages d'erreur et d'alerte. Laisser vide pour utiliser le même que les messages.",
"placeholder" => "https://discord.com/api/webhooks/...",
"is_required" => false,
"job_info_type_id" => 4,
"job_id" => 1,
],
/* EPIC GAMES */
[
"key" => "epicgames_account_email",
"name" => "E-mail",
"description" => "L'adresse e-mail utilisée pour votre compte Epic Games.",
"job_info_type_id" => 2,
"job_id" => 3,
],
[
"key" => "epicgames_account_password",
"name" => "Mot de passe",
"description" => "Le mot de passe utilisé pour votre compte Epic Games.",
"job_info_type_id" => 3,
"job_id" => 3,
],
/* INSTAGRAM */
[
"key" => "instagram_account_email",
"name" => "E-mail",
"description" => "L'adresse e-mail utilisée pour votre compte Instagram.",
"job_info_type_id" => 2,
"job_id" => 4,
],
[
"key" => "instagram_account_password",
"name" => "Mot de passe",
"description" => "Le mot de passe utilisé pour votre compte Instagram.",
"job_info_type_id" => 3,
"job_id" => 4,
],
];
foreach ($jobInfos as $jobInfo) {
\App\Models\JobInfo::forceCreate($jobInfo);
}
}
};

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('job_runs', function (Blueprint $table) {
$table->id();
$table->boolean('success')->default(true);
$table->foreignIdFor(\App\Models\Job::class)->constrained()->cascadeOnDelete();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('job_runs');
}
};

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('job_artifacts', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('content')->nullable();
$table->foreignIdFor(\App\Models\JobRun::class)->constrained()->cascadeOnDelete();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('job_artifacts');
}
};