feat: [file] path 기반 presigned URL 엔드포인트 추가

- POST /api/v1/files/presigned-url-by-path 추가
- file_id 없이 image_path만 있는 레거시 데이터 지원
This commit is contained in:
2026-03-20 11:24:24 +09:00
parent 3417a7eaad
commit 1e7a84d516
2 changed files with 16 additions and 0 deletions

View File

@@ -145,6 +145,21 @@ public function presignedUrl(int $id, Request $request)
return ApiResponse::handle(fn () => ['url' => $url]);
}
/**
* R2 Presigned URL 발급 (file_path 기반, 30분 유효)
*/
public function presignedUrlByPath(Request $request)
{
$path = $request->input('path');
if (! $path) {
abort(400, 'path is required');
}
$url = Storage::disk('r2')->temporaryUrl($path, now()->addMinutes(30));
return ApiResponse::handle(fn () => ['url' => $url]);
}
/**
* Soft delete file
*/