style: Pint 포맷팅 적용
This commit is contained in:
@@ -43,7 +43,7 @@ public function show(int $id): JsonResponse
|
||||
{
|
||||
$photo = ConstructionSitePhoto::with(['user', 'rows'])->find($id);
|
||||
|
||||
if (!$photo) {
|
||||
if (! $photo) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진대지를 찾을 수 없습니다.',
|
||||
@@ -77,7 +77,7 @@ public function uploadPhoto(Request $request, int $id, int $rowId): JsonResponse
|
||||
{
|
||||
$photo = ConstructionSitePhoto::find($id);
|
||||
|
||||
if (!$photo) {
|
||||
if (! $photo) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진대지를 찾을 수 없습니다.',
|
||||
@@ -88,7 +88,7 @@ public function uploadPhoto(Request $request, int $id, int $rowId): JsonResponse
|
||||
->where('construction_site_photo_id', $id)
|
||||
->first();
|
||||
|
||||
if (!$row) {
|
||||
if (! $row) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진 행을 찾을 수 없습니다.',
|
||||
@@ -102,7 +102,7 @@ public function uploadPhoto(Request $request, int $id, int $rowId): JsonResponse
|
||||
|
||||
$result = $this->service->uploadPhoto($row, $request->file('photo'), $validated['type']);
|
||||
|
||||
if (!$result) {
|
||||
if (! $result) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진 업로드에 실패했습니다.',
|
||||
@@ -120,7 +120,7 @@ public function update(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$photo = ConstructionSitePhoto::find($id);
|
||||
|
||||
if (!$photo) {
|
||||
if (! $photo) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진대지를 찾을 수 없습니다.',
|
||||
@@ -146,7 +146,7 @@ public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$photo = ConstructionSitePhoto::with('rows')->find($id);
|
||||
|
||||
if (!$photo) {
|
||||
if (! $photo) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진대지를 찾을 수 없습니다.',
|
||||
@@ -165,7 +165,7 @@ public function deletePhoto(int $id, int $rowId, string $type): JsonResponse
|
||||
{
|
||||
$photo = ConstructionSitePhoto::find($id);
|
||||
|
||||
if (!$photo) {
|
||||
if (! $photo) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진대지를 찾을 수 없습니다.',
|
||||
@@ -176,14 +176,14 @@ public function deletePhoto(int $id, int $rowId, string $type): JsonResponse
|
||||
->where('construction_site_photo_id', $id)
|
||||
->first();
|
||||
|
||||
if (!$row) {
|
||||
if (! $row) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진 행을 찾을 수 없습니다.',
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!in_array($type, ['before', 'during', 'after'])) {
|
||||
if (! in_array($type, ['before', 'during', 'after'])) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '올바르지 않은 사진 유형입니다.',
|
||||
@@ -203,7 +203,7 @@ public function downloadPhoto(Request $request, int $id, int $rowId, string $typ
|
||||
{
|
||||
$photo = ConstructionSitePhoto::find($id);
|
||||
|
||||
if (!$photo) {
|
||||
if (! $photo) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진대지를 찾을 수 없습니다.',
|
||||
@@ -214,23 +214,23 @@ public function downloadPhoto(Request $request, int $id, int $rowId, string $typ
|
||||
->where('construction_site_photo_id', $id)
|
||||
->first();
|
||||
|
||||
if (!$row) {
|
||||
if (! $row) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진 행을 찾을 수 없습니다.',
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!in_array($type, ['before', 'during', 'after'])) {
|
||||
if (! in_array($type, ['before', 'during', 'after'])) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '올바르지 않은 사진 유형입니다.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$path = $row->{$type . '_photo_path'};
|
||||
$path = $row->{$type.'_photo_path'};
|
||||
|
||||
if (!$path) {
|
||||
if (! $path) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '파일을 찾을 수 없습니다.',
|
||||
@@ -240,7 +240,7 @@ public function downloadPhoto(Request $request, int $id, int $rowId, string $typ
|
||||
$googleCloudService = app(GoogleCloudService::class);
|
||||
$content = $googleCloudService->downloadFromStorage($path);
|
||||
|
||||
if (!$content) {
|
||||
if (! $content) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '파일 다운로드에 실패했습니다.',
|
||||
@@ -248,7 +248,7 @@ public function downloadPhoto(Request $request, int $id, int $rowId, string $typ
|
||||
}
|
||||
|
||||
$extension = pathinfo($path, PATHINFO_EXTENSION) ?: 'jpg';
|
||||
$mimeType = 'image/' . ($extension === 'jpg' ? 'jpeg' : $extension);
|
||||
$mimeType = 'image/'.($extension === 'jpg' ? 'jpeg' : $extension);
|
||||
|
||||
$typeLabel = match ($type) {
|
||||
'before' => '작업전',
|
||||
@@ -273,7 +273,7 @@ public function addRow(int $id): JsonResponse
|
||||
{
|
||||
$photo = ConstructionSitePhoto::find($id);
|
||||
|
||||
if (!$photo) {
|
||||
if (! $photo) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진대지를 찾을 수 없습니다.',
|
||||
@@ -293,7 +293,7 @@ public function deleteRow(int $id, int $rowId): JsonResponse
|
||||
{
|
||||
$photo = ConstructionSitePhoto::with('rows')->find($id);
|
||||
|
||||
if (!$photo) {
|
||||
if (! $photo) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진대지를 찾을 수 없습니다.',
|
||||
@@ -309,7 +309,7 @@ public function deleteRow(int $id, int $rowId): JsonResponse
|
||||
|
||||
$row = $photo->rows->firstWhere('id', $rowId);
|
||||
|
||||
if (!$row) {
|
||||
if (! $row) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '사진 행을 찾을 수 없습니다.',
|
||||
|
||||
Reference in New Issue
Block a user