Initial commit of testapi

This commit is contained in:
2025-06-20 13:33:07 +02:00
commit a455aba1d5
377 changed files with 30566 additions and 0 deletions
@@ -0,0 +1,49 @@
<?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('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
@@ -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');
}
};
@@ -0,0 +1,57 @@
<?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('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};
@@ -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('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};
@@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSmartdokProfilesTable extends Migration
{
public function up() {
Schema::create('smartdok_profiles', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('username');
$table->string('name');
$table->timestamps();
});
}
public function down() {
Schema::dropIfExists('smartdok_profiles');
}
}
@@ -0,0 +1,20 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDepartmentsTable extends Migration
{
public function up() {
Schema::create('departments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->timestamps();
});
}
public function down() {
Schema::dropIfExists('departments');
}
}
@@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProjectsTable extends Migration
{
public function up() {
Schema::create('projects', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('project_name');
$table->string('project_number');
$table->timestamps();
});
}
public function down() {
Schema::dropIfExists('projects');
}
}
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProjectSmartdokProfileTable extends Migration
{
public function up() {
Schema::create('project_smartdok_profile', function (Blueprint $table) {
$table->unsignedBigInteger('project_id');
$table->uuid('smartdok_profile_id');
$table->foreign('project_id')
->references('id')->on('projects')
->onDelete('cascade');
$table->foreign('smartdok_profile_id')
->references('id')->on('smartdok_profiles')
->onDelete('cascade');
$table->primary(['project_id', 'smartdok_profile_id']);
});
}
public function down() {
Schema::dropIfExists('project_smartdok_profile');
}
}
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDepartmentProjectTable extends Migration
{
public function up() {
Schema::create('department_project', function (Blueprint $table) {
$table->unsignedBigInteger('department_id');
$table->unsignedBigInteger('project_id');
$table->foreign('department_id')
->references('id')->on('departments')
->onDelete('cascade');
$table->foreign('project_id')
->references('id')->on('projects')
->onDelete('cascade');
$table->primary(['department_id', 'project_id']);
});
}
public function down() {
Schema::dropIfExists('department_project');
}
}
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateWorkHoursTable extends Migration
{
public function up() {
Schema::create('work_hours', function (Blueprint $table) {
$table->id();
$table->uuid('user_id');
$table->decimal('ordinary_hours', 4, 1);
$table->date('work_date');
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('smartdok_profiles')
->onDelete('cascade');
});
}
public function down() {
Schema::dropIfExists('work_hours');
}
}
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProjectWorkhourTable extends Migration
{
public function up() {
Schema::create('project_workhour', function (Blueprint $table) {
$table->string('workhour_id');
$table->unsignedBigInteger('project_id');
$table->foreign('workhour_id')
->references('id')->on('work_hours')
->onDelete('cascade');
$table->foreign('project_id')
->references('id')->on('projects')
->onDelete('cascade');
$table->primary(['workhour_id', 'project_id']);
});
}
public function down() {
Schema::dropIfExists('project_workhour');
}
}
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCommentToWorkHoursTable extends Migration
{
public function up() {
Schema::table('work_hours', function (Blueprint $table) {
$table->text('comment')
->after('work_date')
->nullable();
});
}
public function down() {
Schema::table('work_hours', function (Blueprint $table) {
$table->dropColumn('comment');
});
}
}
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddProjectIdToWorkHoursTable extends Migration
{
public function up() {
Schema::table('work_hours', function (Blueprint $table) {
// assuming projects.id is bigIncrements
$table->unsignedBigInteger('project_id')
->after('user_id')
->nullable(false);
$table->foreign('project_id')
->references('id')
->on('projects')
->onDelete('cascade');
});
}
public function down() {
Schema::table('work_hours', function (Blueprint $table) {
$table->dropForeign(['project_id']);
$table->dropColumn('project_id');
});
}
}
@@ -0,0 +1,26 @@
<?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::table('project_workhour', function (Blueprint $table) {
Schema::dropIfExists('project_workhour');
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::table('project_workhour', function (Blueprint $table) {
//
});
}
};
@@ -0,0 +1,27 @@
<?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('apikeys', function (Blueprint $table) {
$table->id();
$table->string('category')->unique();
$table->string('key');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('apikeys');
}
};
@@ -0,0 +1,26 @@
<?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('apiadmins', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('apiadmins');
}
};