-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Claim verification model #10434
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d04b6db
create migration
vd1992 efac299
claim verification addition
vd1992 49d8aec
claim verification enum
vd1992 89475d4
claim verification schema type
vd1992 03a429c
claim verification mutation
vd1992 b6a5610
claim verification mutation test
vd1992 2f9a5fc
seed claim verification
vd1992 f79afe0
tweak armed forces seeding
vd1992 8f166a7
restrict to VETERAN
vd1992 09f5f2b
vet expiry conditional
vd1992 fb78b7f
claim verification upon submission
vd1992 821dd17
validation of priority expiry
vd1992 eb59203
expiry only for accepted
vd1992 b9aa322
Merge branch 'main' into 10417-claim-verification-model
vd1992 9da6401
validation of expiry date input
vd1992 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App\Enums; | ||
|
||
enum ClaimVerificationResult | ||
{ | ||
case ACCEPTED; | ||
case REJECTED; | ||
case UNVERIFIED; | ||
// a null value represents "unclaimed" | ||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace App\Rules; | ||
|
||
use App\Enums\ClaimVerificationResult; | ||
use Closure; | ||
use Illuminate\Contracts\Validation\ValidationRule; | ||
|
||
class PriorityVerificationExpiryRequirement implements ValidationRule | ||
{ | ||
/** | ||
* Run the validation rule. | ||
*/ | ||
public function validate(string $attribute, mixed $value, Closure $fail): void | ||
{ | ||
// an accepted status for priority verification must be attached to a non-null expiration | ||
if ($value['priorityVerification'] == ClaimVerificationResult::ACCEPTED->name && ! $value['priorityVerificationExpiry']) { | ||
$fail('AcceptedPriorityRequiresExpiry'); | ||
} | ||
|
||
// in any non-ACCEPTED cases no expiration should be present | ||
if (($value['veteranVerification'] != ClaimVerificationResult::ACCEPTED->name && ! is_null($value['veteranVerificationExpiry'])) || | ||
($value['priorityVerification'] != ClaimVerificationResult::ACCEPTED->name && ! is_null($value['priorityVerificationExpiry'])) | ||
) { | ||
$fail('NoExpirationForThisResult'); | ||
} | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
api/database/migrations/2024_05_21_180658_add_claim_verification_fields.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,43 @@ | ||
<?php | ||
|
||
use App\Models\PoolCandidate; | ||
use Illuminate\Database\Eloquent\Builder; | ||
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('pool_candidates', function (Blueprint $table) { | ||
$table->string('veteran_verification')->nullable(); | ||
$table->date('veteran_verification_expiry')->nullable(); | ||
$table->string('priority_verification')->nullable(); | ||
$table->date('priority_verification_expiry')->nullable(); | ||
}); | ||
|
||
PoolCandidate::whereHas('user', function (Builder $query) { | ||
$query->where('armed_forces_status', 'VETERAN'); | ||
})->update(['veteran_verification' => 'UNVERIFIED']); | ||
PoolCandidate::whereHas('user', function (Builder $query) { | ||
$query->where('has_priority_entitlement', true); | ||
})->update(['priority_verification' => 'UNVERIFIED']); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::table('pool_candidates', function (Blueprint $table) { | ||
$table->dropColumn('veteran_verification'); | ||
$table->dropColumn('veteran_verification_expiry'); | ||
$table->dropColumn('priority_verification'); | ||
$table->dropColumn('priority_verification_expiry'); | ||
}); | ||
} | ||
}; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before 2/3 of users were current/past armed forces which seemed a bit egregiously high. This small tweak just halves it.