-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/Team-UMC/UMC-Server into…
… fix/#82/project-data-modify
- Loading branch information
Showing
50 changed files
with
1,377 additions
and
23 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
src/main/java/com/umc/networkingService/domain/album/controller/AlbumCommentController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.umc.networkingService.domain.album.controller; | ||
|
||
import com.umc.networkingService.config.security.auth.CurrentMember; | ||
import com.umc.networkingService.domain.album.dto.request.AlbumCommentCreateRequest; | ||
import com.umc.networkingService.domain.album.dto.request.AlbumCommentUpdateRequest; | ||
import com.umc.networkingService.domain.album.dto.response.AlbumCommentIdResponse; | ||
import com.umc.networkingService.domain.album.service.AlbumCommentService; | ||
import com.umc.networkingService.domain.member.entity.Member; | ||
import com.umc.networkingService.global.common.base.BaseResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.UUID; | ||
|
||
@Tag(name = "사진첩 댓글 API", description = "사진첩 댓글 관련 API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/albums/comments") | ||
public class AlbumCommentController { | ||
|
||
private final AlbumCommentService albumCommentService; | ||
|
||
@Operation(summary = "댓글 작성 API", description = "댓글을 작성하는 API입니다.") | ||
@ApiResponses(value ={ | ||
@ApiResponse(responseCode = "COMMON200", description = "성공"), | ||
@ApiResponse(responseCode = "ALBUM001", description = "존재하지 않는 사진첩입니다.") | ||
}) | ||
@PostMapping | ||
public BaseResponse<AlbumCommentIdResponse> createAlbumComment(@CurrentMember Member member, | ||
@Valid @RequestBody AlbumCommentCreateRequest request) { | ||
return BaseResponse.onSuccess(albumCommentService.createAlbumComment(member, request)); | ||
} | ||
|
||
@Operation(summary = "댓글 수정 API", description = "댓글을 수정하는 API입니다.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "성공"), | ||
@ApiResponse(responseCode = "COMMENT001", description = "댓글을 찾을 수 없을 경우 발생"), | ||
@ApiResponse(responseCode = "COMMENT002", description = "댓글 수정 권한이 없을 경우 발생") | ||
}) | ||
@PatchMapping("/{commentId}") | ||
public BaseResponse<AlbumCommentIdResponse> updateAlbumComment(@CurrentMember Member member, | ||
@PathVariable(value = "commentId") UUID commentId, | ||
@Valid @RequestBody AlbumCommentUpdateRequest request) { | ||
return BaseResponse.onSuccess(albumCommentService.updateAlbumComment(member, commentId, request)); | ||
} | ||
|
||
@Operation(summary = "댓글 삭제 API", description = "댓글을 삭제하는 API입니다.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "성공"), | ||
@ApiResponse(responseCode = "COMMENT001", description = "댓글을 찾을 수 없을 경우 발생"), | ||
@ApiResponse(responseCode = "COMMENT002", description = "댓글 수정 권한이 없을 경우 발생") | ||
}) | ||
@DeleteMapping("/{commentId}") | ||
public BaseResponse<AlbumCommentIdResponse> deleteAlbumComment(@CurrentMember Member member, | ||
@PathVariable(value = "commentId") UUID commentId) { | ||
return BaseResponse.onSuccess(albumCommentService.deleteAlbumComment(member, commentId)); | ||
} | ||
} |
112 changes: 112 additions & 0 deletions
112
src/main/java/com/umc/networkingService/domain/album/controller/AlbumController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
package com.umc.networkingService.domain.album.controller; | ||
|
||
import com.umc.networkingService.config.security.auth.CurrentMember; | ||
import com.umc.networkingService.domain.album.dto.request.AlbumCreateRequest; | ||
import com.umc.networkingService.domain.album.dto.request.AlbumUpdateRequest; | ||
import com.umc.networkingService.domain.album.dto.response.AlbumDetailResponse; | ||
import com.umc.networkingService.domain.album.dto.response.AlbumIdResponse; | ||
import com.umc.networkingService.domain.album.dto.response.AlbumPagingResponse; | ||
import com.umc.networkingService.domain.album.service.AlbumService; | ||
import com.umc.networkingService.domain.member.entity.Member; | ||
import com.umc.networkingService.global.common.base.BaseResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.Parameters; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.domain.Sort; | ||
import org.springframework.data.web.PageableDefault; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@Tag(name = "사진첩 API", description = "사진첩 관련 API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/albums") | ||
public class AlbumController { | ||
|
||
private final AlbumService albumService; | ||
|
||
@Operation(summary = "사진첩 작성 API", description = "사진첩을 작성하는 API입니다.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "성공"), | ||
@ApiResponse(responseCode = "IMAGE001", description = "파일 S3 업로드 실패한 경우") | ||
}) | ||
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||
public BaseResponse<AlbumIdResponse> createAlbum(@CurrentMember Member member, | ||
@Valid @RequestPart("request")AlbumCreateRequest request, | ||
@RequestPart(name = "albumImages", required = false) List<MultipartFile> albumImages) { | ||
return BaseResponse.onSuccess(albumService.createAlbum(member, request, albumImages)); | ||
} | ||
|
||
@Operation(summary = "사진첩 수정 API", description = "사진첩을 수정하는 API입니다.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "성공"), | ||
@ApiResponse(responseCode = "ALBUM001", description = "존재하지 않는 사진첩입니다."), | ||
@ApiResponse(responseCode = "ALBUM002", description = "해당 사진첩에 대한 권한이 없습니다."), | ||
@ApiResponse(responseCode = "IMAGE001", description = "파일 S3 업로드 실패한 경우") | ||
}) | ||
@PatchMapping(value = "/{albumId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||
public BaseResponse<AlbumIdResponse> updateAlbum(@CurrentMember Member member, | ||
@PathVariable(value = "albumId") UUID albumId, | ||
@Valid @RequestPart("request")AlbumUpdateRequest request, | ||
@RequestPart(name = "albumImages", required = false) List<MultipartFile> albumImages) { | ||
return BaseResponse.onSuccess(albumService.updateAlbum(member, albumId, request, albumImages)); | ||
} | ||
|
||
@Operation(summary = "사진첩 삭제 API", description = "사진첩을 삭제하는 API입니다.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "성공"), | ||
@ApiResponse(responseCode = "ALBUM001", description = "존재하지 않는 사진첩입니다."), | ||
@ApiResponse(responseCode = "ALBUM002", description = "해당 사진첩에 대한 권한이 없습니다.") | ||
}) | ||
@DeleteMapping("/{albumId}") | ||
public BaseResponse<AlbumIdResponse> deleteAlbum(@CurrentMember Member member, | ||
@PathVariable(value = "albumId") UUID albumId) { | ||
return BaseResponse.onSuccess(albumService.deleteAlbum(member, albumId)); | ||
} | ||
|
||
|
||
@Operation(summary = "사진첩 조회 API", description = "사진첩 조회하는 API입니다.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "성공") | ||
}) | ||
@Parameters(value = { | ||
@Parameter(name = "page", description = "page 시작은 0번부터, 내림차순으로 조회됩니다.") | ||
}) | ||
@GetMapping | ||
public BaseResponse<AlbumPagingResponse> showAlbums(@CurrentMember Member member, | ||
@PageableDefault(sort = "created_at", direction = Sort.Direction.DESC) | ||
@Parameter(hidden = true) Pageable pageable){ | ||
return BaseResponse.onSuccess(albumService.showAlbums(member, pageable)); | ||
} | ||
|
||
@Operation(summary = "특정 사진첩 상세 조회 API", description = "특정 사진첩을 상세 조회합니다.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "성공"), | ||
@ApiResponse(responseCode = "ALBUM001", description = "존재하지 않는 사진첩입니다.") | ||
}) | ||
@GetMapping("/{albumId}") | ||
public BaseResponse<AlbumDetailResponse> showAlbumDetail(@CurrentMember Member member, | ||
@PathVariable(value = "albumId") UUID albumId) { | ||
return BaseResponse.onSuccess(albumService.showAlbumDetail(member, albumId)); | ||
} | ||
|
||
@Operation(summary = "사진첩 좋아요/취소 API", description = "클릭 시 좋아요 or 취소 됩니다.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "성공"), | ||
@ApiResponse(responseCode = "ALBUM001", description = "존재하지 않는 사진첩입니다.") | ||
}) | ||
@PostMapping("/{albumId}/heart") | ||
public BaseResponse<AlbumIdResponse> toggleAlbumLike(@CurrentMember Member member, | ||
@PathVariable(value = "albumId") UUID albumId) { | ||
return BaseResponse.onSuccess(albumService.toggleAlbumLike(member, albumId)); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...in/java/com/umc/networkingService/domain/album/dto/request/AlbumCommentCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.umc.networkingService.domain.album.dto.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.UUID; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AlbumCommentCreateRequest { | ||
|
||
@NotNull(message = "albumId는 필수 입력값입니다.") | ||
private UUID albumId; | ||
|
||
@NotBlank(message = "content는 필수 입력값입니다.") | ||
private String content; | ||
} |
19 changes: 19 additions & 0 deletions
19
...in/java/com/umc/networkingService/domain/album/dto/request/AlbumCommentUpdateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.umc.networkingService.domain.album.dto.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.UUID; | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class AlbumCommentUpdateRequest { | ||
@NotBlank(message = "content는 필수 입력갑입니다.") | ||
private String content; | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/umc/networkingService/domain/album/dto/request/AlbumCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.umc.networkingService.domain.album.dto.request; | ||
|
||
import com.umc.networkingService.global.common.enums.Semester; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AlbumCreateRequest { | ||
|
||
@NotBlank(message = "title은 필수 입력값입니다.") | ||
private String title; | ||
|
||
@NotBlank(message = "content는 필수 입력갑입니다.") | ||
private String content; | ||
|
||
private Semester semester; | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/umc/networkingService/domain/album/dto/request/AlbumUpdateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.umc.networkingService.domain.album.dto.request; | ||
|
||
import com.umc.networkingService.global.common.enums.Semester; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AlbumUpdateRequest { | ||
@NotBlank(message = "title은 필수 입력값입니다.") | ||
private String title; | ||
|
||
@NotBlank(message = "content는 필수 입력갑입니다.") | ||
private String content; | ||
|
||
private Semester semester; | ||
} |
14 changes: 14 additions & 0 deletions
14
...main/java/com/umc/networkingService/domain/album/dto/response/AlbumCommentIdResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.umc.networkingService.domain.album.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.UUID; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AlbumCommentIdResponse { | ||
private UUID commentId; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/umc/networkingService/domain/album/dto/response/AlbumDetailResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.umc.networkingService.domain.album.dto.response; | ||
|
||
import com.umc.networkingService.global.common.enums.Semester; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Getter | ||
@Builder | ||
public class AlbumDetailResponse { | ||
private String writer; | ||
private String profileImage; | ||
private Semester semester; | ||
private String title; | ||
private String content; | ||
private List<String> albumImages; | ||
private int hitCount; | ||
private int heartCount; | ||
private int commentCount; | ||
private boolean isLiked; | ||
private LocalDateTime createdAt; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/umc/networkingService/domain/album/dto/response/AlbumIdResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.umc.networkingService.domain.album.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.UUID; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AlbumIdResponse { | ||
private UUID albumId; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/umc/networkingService/domain/album/dto/response/AlbumPageResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.umc.networkingService.domain.album.dto.response; | ||
|
||
import com.umc.networkingService.global.common.enums.Semester; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
|
||
@Getter | ||
@Builder | ||
public class AlbumPageResponse { | ||
private UUID albumId; | ||
private String writer; | ||
private String profileImage; | ||
private Semester semester; | ||
private String title; | ||
private String content; | ||
private String thumbnail; | ||
private int hitCount; | ||
private int heartCount; | ||
private int commentCount; | ||
private LocalDateTime createdAt; | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/umc/networkingService/domain/album/dto/response/AlbumPagingResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.umc.networkingService.domain.album.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class AlbumPagingResponse { | ||
private int page; | ||
private List<AlbumPageResponse> albumPageResponses = new ArrayList<>(); | ||
private int totalPages; | ||
private Boolean isFirst; | ||
private Boolean isLast; | ||
private int totalElements; | ||
} |
Oops, something went wrong.