feat: enhance risk pool management and role validation
- Updated AGENTS.md to streamline information on risk pool operations and agent account restrictions. - Introduced filtering options in AdminRiskPoolIndexController for active risk pools. - Refactored AdminRiskPoolLockLogIndexController to support grouping by ticket or entry. - Enhanced AdminRoleStoreController and AdminRoleUpdateController to prevent the use of reserved slugs for new roles. - Improved error messaging for role creation and updates to clarify reserved role restrictions. - Added new API routes for ticket item retrieval to improve admin functionalities.
This commit is contained in:
@@ -254,12 +254,63 @@ test('admin risk pool lock logs include ticket_no when linked', function (): voi
|
||||
$token = mintRiskAdminToken();
|
||||
|
||||
$this->withHeader('Authorization', 'Bearer '.$token)
|
||||
->getJson('/api/v1/admin/draws/'.$draw->id.'/risk-pool-lock-logs')
|
||||
->getJson('/api/v1/admin/draws/'.$draw->id.'/risk-pool-lock-logs?group_by=entry')
|
||||
->assertOk()
|
||||
->assertJsonPath('data.group_by', 'entry')
|
||||
->assertJsonPath('data.meta.total', 1)
|
||||
->assertJsonPath('data.items.0.amount', 50);
|
||||
});
|
||||
|
||||
test('admin risk pool lock logs can group by ticket and filter active pools', function (): void {
|
||||
$draw = Draw::query()->create([
|
||||
'draw_no' => '20260512-007',
|
||||
'business_date' => '2026-05-12',
|
||||
'sequence_no' => 7,
|
||||
'status' => 'open',
|
||||
'start_time' => now()->subHour(),
|
||||
'close_time' => now()->addHour(),
|
||||
'draw_time' => now()->addHours(2),
|
||||
'cooling_end_time' => null,
|
||||
'result_source' => null,
|
||||
'current_result_version' => 0,
|
||||
'settle_version' => 0,
|
||||
'is_reopened' => false,
|
||||
]);
|
||||
|
||||
RiskPool::query()->create([
|
||||
'draw_id' => $draw->id,
|
||||
'normalized_number' => '0043',
|
||||
'total_cap_amount' => 1_000_000,
|
||||
'locked_amount' => 0,
|
||||
'remaining_amount' => 1_000_000,
|
||||
'sold_out_status' => 0,
|
||||
'version' => 0,
|
||||
]);
|
||||
|
||||
RiskPool::query()->create([
|
||||
'draw_id' => $draw->id,
|
||||
'normalized_number' => '1288',
|
||||
'total_cap_amount' => 1_000,
|
||||
'locked_amount' => 850,
|
||||
'remaining_amount' => 150,
|
||||
'sold_out_status' => 0,
|
||||
'version' => 1,
|
||||
]);
|
||||
|
||||
$token = mintRiskAdminToken();
|
||||
|
||||
$this->withHeader('Authorization', 'Bearer '.$token)
|
||||
->getJson('/api/v1/admin/draws/'.$draw->id.'/risk-pools?active_only=1')
|
||||
->assertOk()
|
||||
->assertJsonPath('data.meta.total', 1)
|
||||
->assertJsonPath('data.items.0.normalized_number', '1288');
|
||||
|
||||
$this->withHeader('Authorization', 'Bearer '.$token)
|
||||
->getJson('/api/v1/admin/draws/'.$draw->id.'/risk-pool-lock-logs?group_by=entry')
|
||||
->assertOk()
|
||||
->assertJsonPath('data.group_by', 'entry');
|
||||
});
|
||||
|
||||
test('admin risk pool show 404 when pool missing', function (): void {
|
||||
$draw = Draw::query()->create([
|
||||
'draw_no' => '20260512-003',
|
||||
|
||||
Reference in New Issue
Block a user