diff --git a/backend/app/Models/User.php b/backend/app/Models/User.php index 749c7b7..97edce1 100644 --- a/backend/app/Models/User.php +++ b/backend/app/Models/User.php @@ -19,7 +19,11 @@ class User extends Authenticatable */ protected $fillable = [ 'name', + 'first_name', + 'last_name', + 'phone', 'email', + 'role', 'password', ]; diff --git a/backend/database/migrations/2025_10_20_120000_add_role_phone_active_to_users_table.php b/backend/database/migrations/2025_10_20_120000_add_role_phone_active_to_users_table.php deleted file mode 100644 index 6fc7f46..0000000 --- a/backend/database/migrations/2025_10_20_120000_add_role_phone_active_to_users_table.php +++ /dev/null @@ -1,20 +0,0 @@ -string('phone')->nullable()->after('email'); - $table->enum('role', ['STUDENT','EMPLOYER','ADMIN'])->default('STUDENT')->after('phone'); - $table->boolean('is_active')->default(true)->after('role'); - }); - } - public function down(): void { - Schema::table('users', function (Blueprint $table) { - $table->dropColumn(['phone','role','is_active']); - }); - } -}; diff --git a/backend/database/migrations/2025_10_20_120100_create_student_data_table.php b/backend/database/migrations/2025_10_20_120100_create_student_data_table.php deleted file mode 100644 index b46d14e..0000000 --- a/backend/database/migrations/2025_10_20_120100_create_student_data_table.php +++ /dev/null @@ -1,21 +0,0 @@ -id(); - $table->foreignId('user_id')->unique()->constrained('users')->cascadeOnDelete(); - $table->string('address')->nullable(); - $table->string('personal_email')->nullable(); - $table->string('study_field')->nullable(); - $table->timestamps(); - }); - } - public function down(): void { - Schema::dropIfExists('student_data'); - } -}; diff --git a/backend/database/migrations/2025_10_20_120200_create_companies_table.php b/backend/database/migrations/2025_10_20_120200_create_companies_table.php deleted file mode 100644 index 09c83d9..0000000 --- a/backend/database/migrations/2025_10_20_120200_create_companies_table.php +++ /dev/null @@ -1,21 +0,0 @@ -id(); - $table->string('name'); - $table->string('ICO', 20)->nullable()->unique(); - $table->string('address'); - $table->boolean('hiring')->default(false); - $table->timestamps(); - }); - } - public function down(): void { - Schema::dropIfExists('companies'); - } -}; diff --git a/backend/database/migrations/2025_10_20_120300_create_employers_table.php b/backend/database/migrations/2025_10_20_120300_create_employers_table.php deleted file mode 100644 index 96c9e89..0000000 --- a/backend/database/migrations/2025_10_20_120300_create_employers_table.php +++ /dev/null @@ -1,20 +0,0 @@ -id(); - $table->foreignId('company_id')->constrained('companies')->cascadeOnDelete(); - $table->foreignId('user_id')->unique()->constrained('users')->cascadeOnDelete(); - $table->string('position')->nullable(); - $table->timestamps(); - }); - } - public function down(): void { - Schema::dropIfExists('employers'); - } -}; diff --git a/backend/database/migrations/2025_10_20_120400_create_internships_table.php b/backend/database/migrations/2025_10_20_120400_create_internships_table.php deleted file mode 100644 index 7abbfd4..0000000 --- a/backend/database/migrations/2025_10_20_120400_create_internships_table.php +++ /dev/null @@ -1,38 +0,0 @@ -id(); - - - $table->foreignId('user_id')->constrained('users'); - $table->foreignId('company_id')->constrained('companies'); - $table->foreignId('employer_id')->nullable()->constrained('employers')->nullOnDelete(); - - - $table->string('agreement')->nullable(); - $table->date('start_date'); - $table->date('end_date'); - $table->enum('semester', ['ZS','LS']); - $table->smallInteger('year_of_study'); - $table->text('position_description')->nullable(); - $table->boolean('is_paid')->default(false); - - - $table->unsignedBigInteger('status_id')->nullable(); - - $table->timestamps(); - - $table->index(['semester','company_id','user_id','status_id']); - - }); - } - public function down(): void { - Schema::dropIfExists('internships'); - } -}; diff --git a/backend/database/migrations/2025_10_20_120500_create_internship_statuses_table.php b/backend/database/migrations/2025_10_20_120500_create_internship_statuses_table.php deleted file mode 100644 index 53d4e3c..0000000 --- a/backend/database/migrations/2025_10_20_120500_create_internship_statuses_table.php +++ /dev/null @@ -1,25 +0,0 @@ -id(); - $table->foreignId('internship_id')->constrained('internships')->cascadeOnDelete(); - $table->enum('status', ['SUBMITTED','CONFIRMED','DENIED','DEFENDED','NOT_DEFENDED']); - $table->timestamp('changed')->useCurrent(); - $table->foreignId('modified_by')->nullable()->constrained('users')->nullOnDelete(); - $table->text('note')->nullable(); - $table->string('source', 30)->default('UI'); - $table->timestamps(); - - $table->index(['internship_id','status']); - }); - } - public function down(): void { - Schema::dropIfExists('internship_statuses'); - } -}; diff --git a/backend/database/migrations/2025_10_20_120600_add_status_fk_to_internships.php b/backend/database/migrations/2025_10_20_120600_add_status_fk_to_internships.php deleted file mode 100644 index fbf5e7c..0000000 --- a/backend/database/migrations/2025_10_20_120600_add_status_fk_to_internships.php +++ /dev/null @@ -1,20 +0,0 @@ -foreign('status_id') - ->references('id')->on('internship_statuses') - ->nullOnDelete(); - }); - } - public function down(): void { - Schema::table('internships', function (Blueprint $table) { - $table->dropForeign(['status_id']); - }); - } -}; diff --git a/backend/database/migrations/2025_10_20_191423_alter_users_table.php b/backend/database/migrations/2025_10_20_191423_alter_users_table.php new file mode 100644 index 0000000..9041dde --- /dev/null +++ b/backend/database/migrations/2025_10_20_191423_alter_users_table.php @@ -0,0 +1,38 @@ +string('first_name')->nullable(false)->after('name'); + $table->string('last_name')->nullable(false)->after('first_name'); + $table->string('phone')->nullable(false)->unique()->after('email'); + $table->enum("role", ["STUDENT", "EMPLOYER", "ADMIN"])->nullable(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropUnique(['phone']); + + $table->dropColumn([ + 'first_name', + 'last_name', + 'phone', + 'role', + ]); + }); + } +}; diff --git a/backend/database/migrations/2025_10_20_192305_create_student_data_table.php b/backend/database/migrations/2025_10_20_192305_create_student_data_table.php new file mode 100644 index 0000000..af27da8 --- /dev/null +++ b/backend/database/migrations/2025_10_20_192305_create_student_data_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId("user_id")->nullable(false)->constrained("users")->onDelete("cascade"); + $table->string("address")->nullable(false); + $table->string("personal_email")->nullable(false); + $table->string("study_field")->nullable(false); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('student_data'); + } +}; diff --git a/backend/database/migrations/2025_10_20_192651_create_companies_table.php b/backend/database/migrations/2025_10_20_192651_create_companies_table.php new file mode 100644 index 0000000..ae58858 --- /dev/null +++ b/backend/database/migrations/2025_10_20_192651_create_companies_table.php @@ -0,0 +1,31 @@ +id(); + $table->string("name")->nullable(false)->unique(); + $table->string("address")->nullable(false); + $table->unsignedInteger("ico")->nullable(false)->unique(); + $table->boolean("hiring")->nullable(false)->default(false); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('companies'); + } +}; diff --git a/backend/database/migrations/2025_10_20_192915_create_employers_table.php b/backend/database/migrations/2025_10_20_192915_create_employers_table.php new file mode 100644 index 0000000..a1fd10c --- /dev/null +++ b/backend/database/migrations/2025_10_20_192915_create_employers_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignId("user_id")->nullable(false)->constrained("users")->onDelete("cascade"); + $table->foreignId("company_id")->nullable(false)->constrained("companies")->onDelete("cascade"); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('employers'); + } +}; diff --git a/backend/database/migrations/2025_10_20_193012_create_internships_table.php b/backend/database/migrations/2025_10_20_193012_create_internships_table.php new file mode 100644 index 0000000..35295a1 --- /dev/null +++ b/backend/database/migrations/2025_10_20_193012_create_internships_table.php @@ -0,0 +1,37 @@ +id(); + $table->foreignId("user_id")->nullable(false)->constrained("users")->onDelete("cascade"); + $table->foreignId("company_id")->nullable(false)->constrained("companies")->onDelete("cascade"); + $table->dateTimeTz("start")->nullable(false); + $table->dateTimeTz("end")->nullable(false); + $table->unsignedSmallInteger("year_of_study")->nullable(false); + $table->enum("semester", ["WINTER", "SUMMER"])->nullable(false); + $table->string("position_description")->nullable(false); + $table->binary("agreement")->nullable(true); + $table->foreignId("personel_id")->nullable(false)->constrained("users")->onDelete("cascade"); + $table->foreignId("status_id")->nullable(false)->constrained("internship_statuses")->onDelete("cascade"); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('internships'); + } +}; diff --git a/backend/database/migrations/2025_10_20_193408_create_internship_statuses_table.php b/backend/database/migrations/2025_10_20_193408_create_internship_statuses_table.php new file mode 100644 index 0000000..a54ffa7 --- /dev/null +++ b/backend/database/migrations/2025_10_20_193408_create_internship_statuses_table.php @@ -0,0 +1,32 @@ +id(); + $table->foreignId("internship_id")->nullable(false)->constrained("internships")->onDelete("cascade"); + $table->enum("status", ["SUBMITTED", "CONFIRMED", "DENIED", "DEFENDED", "NOT_DEFENDED"])->nullable(false)->default("SUBMITTED"); + $table->dateTimeTz("changed")->nullable(false); + $table->string("note")->nullable(true)->default(null); + $table->foreignId("modified_by")->nullable(false)->constrained("users")->onDelete("cascade"); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('internship_statuses'); + } +};