From 5ebf940873f064fdf8bd33f34617662ac3dcb4cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Fri, 6 Mar 2026 20:34:52 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[=EB=AC=B8=EC=84=9C=EC=8A=A4=EB=83=85?= =?UTF-8?q?=EC=83=B7]=20UpsertRequest=20rendered=5Fhtml=20=EA=B2=80?= =?UTF-8?q?=EC=A6=9D=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20upsert()=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=20=EB=88=84=EB=9D=BD=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - UpsertRequest에 rendered_html nullable string 검증 추가 - DocumentService upsert()에서 create/update 시 rendered_html 전달 Co-Authored-By: Claude Opus 4.6 --- app/Http/Requests/Document/UpsertRequest.php | 3 +++ app/Services/DocumentService.php | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/Http/Requests/Document/UpsertRequest.php b/app/Http/Requests/Document/UpsertRequest.php index 99c1920..dc7eba3 100644 --- a/app/Http/Requests/Document/UpsertRequest.php +++ b/app/Http/Requests/Document/UpsertRequest.php @@ -30,6 +30,9 @@ public function rules(): array 'data.*.field_key' => 'required_with:data|string|max:100', 'data.*.field_value' => 'nullable|string', + // HTML 스냅샷 + 'rendered_html' => 'nullable|string', + // 첨부파일 'attachments' => 'nullable|array', 'attachments.*.file_id' => 'required_with:attachments|integer|exists:files,id', diff --git a/app/Services/DocumentService.php b/app/Services/DocumentService.php index 6877956..2fef635 100644 --- a/app/Services/DocumentService.php +++ b/app/Services/DocumentService.php @@ -857,24 +857,32 @@ public function upsert(array $data): Document if ($existingDocument) { // UPDATE: 기존 update 로직 재사용 - return $this->update($existingDocument->id, [ + $updatePayload = [ 'title' => $data['title'] ?? $existingDocument->title, 'linkable_type' => 'item', 'linkable_id' => $itemId, 'data' => $data['data'] ?? [], 'attachments' => $data['attachments'] ?? [], - ]); + ]; + if (isset($data['rendered_html'])) { + $updatePayload['rendered_html'] = $data['rendered_html']; + } + return $this->update($existingDocument->id, $updatePayload); } // CREATE: 기존 create 로직 재사용 - return $this->create([ + $createPayload = [ 'template_id' => $templateId, 'title' => $data['title'] ?? '', 'linkable_type' => 'item', 'linkable_id' => $itemId, 'data' => $data['data'] ?? [], 'attachments' => $data['attachments'] ?? [], - ]); + ]; + if (isset($data['rendered_html'])) { + $createPayload['rendered_html'] = $data['rendered_html']; + } + return $this->create($createPayload); }); }