From 6b06ef34cb44a0213b405d02e635f15c64fa41a1 Mon Sep 17 00:00:00 2001 From: weizong song Date: Mon, 8 Jun 2026 15:08:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8D=89=E7=A8=BF=E4=BF=9D=E5=AD=98=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/ApplicationController.php | 8 +++++--- tests/Feature/ChannelSignupIntegrationTest.php | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/ApplicationController.php b/app/Http/Controllers/Api/ApplicationController.php index 5ec436c..0bfd87e 100644 --- a/app/Http/Controllers/Api/ApplicationController.php +++ b/app/Http/Controllers/Api/ApplicationController.php @@ -275,7 +275,7 @@ class ApplicationController extends Controller $app->load(['files']); - return response()->json($this->transform($app)); + return response()->json($this->transform($app, false)); } public function submit(Request $request): JsonResponse @@ -564,7 +564,7 @@ class ApplicationController extends Controller return $payload; } - private function transform(Application $app): array + private function transform(Application $app, bool $includeSignature = true): array { $payload = [ 'id' => $app->id, @@ -585,7 +585,6 @@ class ApplicationController extends Controller 'oversea_country' => $app->oversea_country, 'intro' => $app->intro, 'promise_signed_at' => $app->promise_signed_at?->toIso8601String(), - 'promise_signature' => $app->promise_signature, 'submitted_at' => $app->submitted_at?->toIso8601String(), 'participant_may_edit' => $app->participantMayEditSignup(), 'files' => $app->files->map(fn ($f) => [ @@ -596,6 +595,9 @@ class ApplicationController extends Controller 'url' => $f->participantPreviewSignedUrl(), ])->values(), ]; + if ($includeSignature) { + $payload['promise_signature'] = $app->promise_signature; + } return $this->applySignupPrefillSources($app, $payload); } diff --git a/tests/Feature/ChannelSignupIntegrationTest.php b/tests/Feature/ChannelSignupIntegrationTest.php index b909837..6225685 100644 --- a/tests/Feature/ChannelSignupIntegrationTest.php +++ b/tests/Feature/ChannelSignupIntegrationTest.php @@ -150,12 +150,15 @@ class ChannelSignupIntegrationTest extends TestCase $this->putJson('/api/applications/current?competition_slug=main-event', [ 'player_name' => '张三', 'contact_email' => 'draft@example.com', + 'commitment_accepted' => true, + 'promise_signature' => 'data:image/png;base64,AAAA', ])->assertOk() ->assertJsonPath('status', 'draft') ->assertJsonPath('player_name', '张三') ->assertJsonPath('contact_email', 'draft@example.com') ->assertJsonPath('entry_group', null) - ->assertJsonPath('company_name', null); + ->assertJsonPath('company_name', null) + ->assertJsonMissingPath('promise_signature'); } public function test_channel_entry_success_errors_context_and_safe_logs(): void