-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #452 - refactor: user profile cleaning * Update app/Observers/UserHistoryObserver.php Co-authored-by: Krzysztof Rewak <krzysztof.rewak@blumilk.pl> * #452 - fix: code review fixes * #452 - fix: rollback last update key name --------- Co-authored-by: Krzysztof Rewak <krzysztof.rewak@blumilk.pl>
- Loading branch information
1 parent
5c72a04
commit f65ff3b
Showing
16 changed files
with
129 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Toby\Observers; | ||
|
||
use Laragear\CacheQuery\Facades\CacheQuery; | ||
use Toby\Models\UserHistory; | ||
|
||
class UserHistoryObserver | ||
{ | ||
public function creating(UserHistory $userHistory): void | ||
{ | ||
CacheQuery::forget("user:history:{$userHistory->user->id}"); | ||
} | ||
|
||
public function updating(UserHistory $userHistory): void | ||
{ | ||
CacheQuery::forget("user:history{$userHistory->user->id}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
database/migrations/2024_07_04_130731_cleaning_fields_in_profiles_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration { | ||
public function up(): void | ||
{ | ||
Schema::table("profiles", function (Blueprint $table): void { | ||
$table->dropColumn("last_medical_exam_date"); | ||
$table->dropColumn("next_medical_exam_date"); | ||
$table->dropColumn("last_ohs_training_date"); | ||
$table->dropColumn("next_ohs_training_date"); | ||
$table->dropColumn("employment_date"); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::table("profiles", function (Blueprint $table): void { | ||
$table->date("last_medical_exam_date")->nullable()->default(null); | ||
$table->date("next_medical_exam_date")->nullable()->default(null); | ||
$table->date("last_ohs_training_date")->nullable()->default(null); | ||
$table->date("next_ohs_training_date")->nullable()->default(null); | ||
$table->date("employment_date")->nullable()->default(null); | ||
}); | ||
} | ||
}; |
Oops, something went wrong.