Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ dependencies {
// ==============================================================
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
// implementation 'org.springframework.boot:spring-boot-starter-security'
// implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-webflux'

Expand Down Expand Up @@ -75,6 +75,12 @@ dependencies {
// ==============================================================
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'

// ==============================================================
// πŸͺ£ S3
// ==============================================================
implementation(platform("software.amazon.awssdk:bom:2.40.11"))
implementation("software.amazon.awssdk:s3")
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

import java.lang.annotation.*;

Expand All @@ -13,9 +12,7 @@
summary = FolderSwaggerDocs.CREATE_SUMMARY,
description = FolderSwaggerDocs.CREATE_DESCRIPTION
)
@ApiResponses({
@ApiResponse(responseCode = "201", description = "생성 성곡", useReturnTypeSchema = true),
@ApiResponse(responseCode = "400", description = "잘λͺ»λœ μš”μ²­"),
@ApiResponse(responseCode = "409", description = "κΈ°λ³Έ 폴더 쀑볡")
})
public @interface CreateFolderDocs {}
@ApiResponse(responseCode = "201", description = "생성 성곡", useReturnTypeSchema = true)
@ApiResponse(responseCode = "400", description = "잘λͺ»λœ μš”μ²­")
@ApiResponse(responseCode = "409", description = "κΈ°λ³Έ 폴더 쀑볡")
public @interface CreateFolderDocs {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

import java.lang.annotation.*;

Expand All @@ -13,8 +12,6 @@
summary = FolderSwaggerDocs.DELETE_SUMMARY,
description = FolderSwaggerDocs.DELETE_DESCRIPTION
)
@ApiResponses({
@ApiResponse(responseCode = "204", description = "μ‚­μ œ 성곡"),
@ApiResponse(responseCode = "404", description = "폴더 λ˜λŠ” μ‚¬μš©μž μ—†μŒ")
})
@ApiResponse(responseCode = "204", description = "μ‚­μ œ 성곡")
@ApiResponse(responseCode = "404", description = "폴더 λ˜λŠ” μ‚¬μš©μž μ—†μŒ")
public @interface DeleteFolderDocs {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

import java.lang.annotation.*;

Expand All @@ -13,8 +12,6 @@
summary = FolderSwaggerDocs.DETAIL_SUMMARY,
description = FolderSwaggerDocs.DETAIL_DESCRIPTION
)
@ApiResponses({
@ApiResponse(responseCode = "200", description = "쑰회 성곡", useReturnTypeSchema = true),
@ApiResponse(responseCode = "404", description = "폴더 λ˜λŠ” μ‚¬μš©μž μ—†μŒ")
})
@ApiResponse(responseCode = "200", description = "쑰회 성곡", useReturnTypeSchema = true)
@ApiResponse(responseCode = "404", description = "폴더 λ˜λŠ” μ‚¬μš©μž μ—†μŒ")
public @interface GetFolderDocs {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

import java.lang.annotation.*;

Expand All @@ -13,8 +12,6 @@
summary = FolderSwaggerDocs.GET_ALL_SUMMARY,
description = FolderSwaggerDocs.GET_ALL_DESCRIPTION
)
@ApiResponses({
@ApiResponse(responseCode = "200", description = "쑰회 성곡", useReturnTypeSchema = true),
@ApiResponse(responseCode = "404", description = "μ‚¬μš©μž μ—†μŒ")
})
@ApiResponse(responseCode = "200", description = "쑰회 성곡", useReturnTypeSchema = true)
@ApiResponse(responseCode = "404", description = "μ‚¬μš©μž μ—†μŒ")
public @interface GetFoldersDocs {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

import java.lang.annotation.*;

Expand All @@ -13,8 +12,6 @@
summary = FolderSwaggerDocs.UPDATE_SUMMARY,
description = FolderSwaggerDocs.UPDATE_DESCRIPTION
)
@ApiResponses({
@ApiResponse(responseCode = "200", description = "μˆ˜μ • 성곡", useReturnTypeSchema = true),
@ApiResponse(responseCode = "404", description = "폴더 λ˜λŠ” μ‚¬μš©μž μ—†μŒ")
})
@ApiResponse(responseCode = "200", description = "μˆ˜μ • 성곡", useReturnTypeSchema = true)
@ApiResponse(responseCode = "404", description = "폴더 λ˜λŠ” μ‚¬μš©μž μ—†μŒ")
public @interface UpdateFolderDocs {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package com.example.pventure.domain.photo.controller;

import com.example.pventure.domain.photo.docs.CreatePhotosDocs;
import com.example.pventure.domain.photo.docs.DeletePhotosDocs;
import com.example.pventure.domain.photo.docs.GenerateUploadUrlsDocs;
import com.example.pventure.domain.photo.docs.GetPhotoDocs;
import com.example.pventure.domain.photo.docs.GetPhotosByAlbumDocs;
import com.example.pventure.domain.photo.docs.GetUnassignedPhotosDocs;
import com.example.pventure.domain.photo.docs.MovePhotosDocs;
import com.example.pventure.domain.photo.dto.request.MovePhotoRequestDto;
import com.example.pventure.domain.photo.dto.request.PhotoRequestDto;
import com.example.pventure.domain.photo.dto.request.UploadUrlRequestDto;
import com.example.pventure.domain.photo.dto.response.PhotoDetailResponseDto;
import com.example.pventure.domain.photo.dto.response.PhotoResponseDto;
import com.example.pventure.domain.photo.dto.response.UploadUrlResponseDto;
import com.example.pventure.domain.photo.service.PhotoService;
import com.example.pventure.global.response.CustomResponse;
import com.example.pventure.global.response.CustomResponseHelper;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "Photo", description = "사진 κ΄€λ ¨ API")
@RestController
@RequestMapping("/trips/{tripId}")
@RequiredArgsConstructor
public class PhotoController {

private final PhotoService photoService;

@GenerateUploadUrlsDocs
@PostMapping("/photos/upload-urls")
public ResponseEntity<CustomResponse<List<UploadUrlResponseDto>>> generateUploadUrls(
@RequestParam Long userId,
@PathVariable Long tripId,
@Valid @RequestBody List<UploadUrlRequestDto> requestDtos
) {
return CustomResponseHelper.ok(photoService.generateUploadUrls(userId, tripId, requestDtos));
}

@CreatePhotosDocs
@PostMapping("/photos")
public ResponseEntity<CustomResponse<List<PhotoResponseDto>>> createPhotos(
@RequestParam Long userId,
@PathVariable Long tripId,
@RequestParam(required = false) Long albumId,
@Valid @RequestBody List<PhotoRequestDto> requestDtos
) {
return CustomResponseHelper.created(photoService.createPhotos(userId, tripId, albumId, requestDtos));
}

@GetPhotosByAlbumDocs
@GetMapping("/albums/{albumId}/photos")
public ResponseEntity<CustomResponse<List<PhotoResponseDto>>> getPhotosByAlbum(
@RequestParam Long userId,
@PathVariable Long tripId,
@PathVariable Long albumId
) {
return CustomResponseHelper.ok(photoService.getPhotosByAlbum(userId, tripId, albumId));
}

@GetUnassignedPhotosDocs
@GetMapping("/photos/unassigned")
public ResponseEntity<CustomResponse<List<PhotoResponseDto>>> getUnassignedPhotos(
@RequestParam Long userId,
@PathVariable Long tripId
) {
return CustomResponseHelper.ok(photoService.getUnassignedPhotos(userId, tripId));
}

@GetPhotoDocs
@GetMapping("/photos/{photoId}")
public ResponseEntity<CustomResponse<PhotoDetailResponseDto>> getPhoto(
@RequestParam Long userId,
@PathVariable Long tripId,
@PathVariable Long photoId
) {
return CustomResponseHelper.ok(photoService.getPhoto(userId, tripId, photoId));
}

@MovePhotosDocs
@PutMapping("/photos/move")
public ResponseEntity<Void> movePhotos(
@RequestParam Long userId,
@PathVariable Long tripId,
@Valid @RequestBody MovePhotoRequestDto requestDto
) {
photoService.movePhotos(userId, tripId, requestDto.getTargetAlbumId(), requestDto.getPhotoIds());
return CustomResponseHelper.noContent();
}

@DeletePhotosDocs
@DeleteMapping("/photos")
public ResponseEntity<Void> deletePhotos(
@RequestParam Long userId,
@PathVariable Long tripId,
@RequestParam List<Long> photoIds
) {
photoService.deletePhotos(userId, tripId, photoIds);
return CustomResponseHelper.noContent();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.pventure.domain.photo.docs;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Operation(
summary = PhotoSwaggerDocs.CREATE_PHOTOS_SUMMARY,
description = PhotoSwaggerDocs.CREATE_PHOTOS_DESCRIPTION
)
@ApiResponse(responseCode = "201", description = "사진 생성 성곡", useReturnTypeSchema = true)
@ApiResponse(responseCode = "400", description = "잘λͺ»λœ μš”μ²­")
@ApiResponse(responseCode = "403", description = "νŽΈμ§‘ κΆŒν•œ μ—†μŒ")
@ApiResponse(responseCode = "404", description = "μ‚¬μš©μž λ˜λŠ” μ—¬ν–‰ μ—†μŒ")
public @interface CreatePhotosDocs {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.pventure.domain.photo.docs;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Operation(
summary = PhotoSwaggerDocs.DELETE_PHOTO_SUMMARY,
description = PhotoSwaggerDocs.DELETE_PHOTO_DESCRIPTION
)
@ApiResponse(responseCode = "204", description = "μ‚­μ œ 성곡")
@ApiResponse(responseCode = "403", description = "νŽΈμ§‘ κΆŒν•œ μ—†μŒ")
@ApiResponse(responseCode = "404", description = "μ‚¬μš©μž λ˜λŠ” μ—¬ν–‰ λ˜λŠ” 사진 μ—†μŒ")
public @interface DeletePhotosDocs {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.pventure.domain.photo.docs;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Operation(
summary = PhotoSwaggerDocs.GENERATE_UPLOAD_URLS_SUMMARY,
description = PhotoSwaggerDocs.GENERATE_UPLOAD_URLS_DESCRIPTION
)
@ApiResponse(responseCode = "200", description = "μ—…λ‘œλ“œ URL 생성 성곡", useReturnTypeSchema = true)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

201μ§œλ¦¬κ°€ μ•„λ‹Œ 200으둜 ν•˜μ‹  μ΄μœ κ°€ μžˆμœΌμ‹€ κΉŒμš”?

@ApiResponse(responseCode = "400", description = "잘λͺ»λœ μš”μ²­")
@ApiResponse(responseCode = "403", description = "νŽΈμ§‘ κΆŒν•œ μ—†μŒ")
@ApiResponse(responseCode = "404", description = "μ‚¬μš©μž λ˜λŠ” μ—¬ν–‰ μ—†μŒ")
public @interface GenerateUploadUrlsDocs {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.pventure.domain.photo.docs;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Operation(
summary = PhotoSwaggerDocs.GET_PHOTO_SUMMARY,
description = PhotoSwaggerDocs.GET_PHOTO_DESCRIPTION
)
@ApiResponse(responseCode = "200", description = "쑰회 성곡", useReturnTypeSchema = true)
@ApiResponse(responseCode = "403", description = "보기 κΆŒν•œ μ—†μŒ")
@ApiResponse(responseCode = "404", description = "μ‚¬μš©μž λ˜λŠ” μ—¬ν–‰ λ˜λŠ” 사진 μ—†μŒ")
public @interface GetPhotoDocs {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.pventure.domain.photo.docs;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Operation(
summary = PhotoSwaggerDocs.GET_PHOTOS_BY_ALBUM_SUMMARY,
description = PhotoSwaggerDocs.GET_PHOTOS_BY_ALBUM_DESCRIPTION
)
@ApiResponse(responseCode = "200", description = "쑰회 성곡", useReturnTypeSchema = true)
@ApiResponse(responseCode = "403", description = "보기 κΆŒν•œ μ—†μŒ")
@ApiResponse(responseCode = "404", description = "μ‚¬μš©μž λ˜λŠ” μ—¬ν–‰ μ—†μŒ")
public @interface GetPhotosByAlbumDocs {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.pventure.domain.photo.docs;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Operation(
summary = PhotoSwaggerDocs.GET_UNASSIGNED_PHOTOS_SUMMARY,
description = PhotoSwaggerDocs.GET_UNASSIGNED_PHOTOS_DESCRIPTION
)
@ApiResponse(responseCode = "200", description = "쑰회 성곡", useReturnTypeSchema = true)
@ApiResponse(responseCode = "403", description = "보기 κΆŒν•œ μ—†μŒ")
@ApiResponse(responseCode = "404", description = "μ‚¬μš©μž λ˜λŠ” μ—¬ν–‰ μ—†μŒ")
public @interface GetUnassignedPhotosDocs {}
Loading