-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DDING-32] FixZone 도메인 리팩토링 및 presignedUrl 적용 (#155)
- Loading branch information
Showing
42 changed files
with
1,440 additions
and
452 deletions.
There are no files selected for viewing
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
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
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
70 changes: 22 additions & 48 deletions
70
src/main/java/ddingdong/ddingdongBE/domain/fixzone/controller/ClubFixZoneController.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 |
---|---|---|
@@ -1,79 +1,53 @@ | ||
package ddingdong.ddingdongBE.domain.fixzone.controller; | ||
|
||
import static ddingdong.ddingdongBE.domain.fileinformation.entity.FileDomainCategory.FIX_ZONE; | ||
import static ddingdong.ddingdongBE.domain.fileinformation.entity.FileTypeCategory.IMAGE; | ||
|
||
import ddingdong.ddingdongBE.auth.PrincipalDetails; | ||
import ddingdong.ddingdongBE.domain.club.entity.Club; | ||
import ddingdong.ddingdongBE.domain.club.service.ClubService; | ||
import ddingdong.ddingdongBE.domain.fixzone.controller.api.ClubFixZoneApi; | ||
import ddingdong.ddingdongBE.domain.fixzone.controller.dto.request.CreateFixZoneRequest; | ||
import ddingdong.ddingdongBE.domain.fixzone.controller.dto.request.UpdateFixZoneRequest; | ||
import ddingdong.ddingdongBE.domain.fixzone.controller.dto.response.GetDetailFixZoneResponse; | ||
import ddingdong.ddingdongBE.domain.fixzone.controller.dto.response.GetFixZoneResponse; | ||
import ddingdong.ddingdongBE.domain.fixzone.service.FixZoneService; | ||
import ddingdong.ddingdongBE.file.service.FileService; | ||
import ddingdong.ddingdongBE.domain.fixzone.controller.dto.response.CentralFixZoneResponse; | ||
import ddingdong.ddingdongBE.domain.fixzone.controller.dto.response.CentralMyFixZoneListResponse; | ||
import ddingdong.ddingdongBE.domain.fixzone.service.FacadeCentralFixZoneServiceImpl; | ||
import ddingdong.ddingdongBE.domain.fixzone.service.dto.query.CentralFixZoneQuery; | ||
import ddingdong.ddingdongBE.domain.user.entity.User; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class ClubFixZoneController implements ClubFixZoneApi { | ||
private final ClubService clubService; | ||
private final FixZoneService fixZoneService; | ||
private final FileService fileService; | ||
|
||
@Override | ||
public List<GetFixZoneResponse> getMyFixZones(PrincipalDetails principalDetails) { | ||
Club club = clubService.getByUserId(principalDetails.getUser().getId()); | ||
private final FacadeCentralFixZoneServiceImpl facadeCentralFixZoneServiceImpl; | ||
|
||
return fixZoneService.getMyFixZones(club.getId()); | ||
@Override | ||
public List<CentralMyFixZoneListResponse> getMyFixZones(PrincipalDetails principalDetails) { | ||
User user = principalDetails.getUser(); | ||
return facadeCentralFixZoneServiceImpl.getMyFixZones(user.getId()).stream() | ||
.map(CentralMyFixZoneListResponse::from) | ||
.toList(); | ||
} | ||
|
||
@Override | ||
public GetDetailFixZoneResponse getFixZoneDetail(Long fixZoneId) { | ||
return fixZoneService.getFixZoneDetail(fixZoneId); | ||
public CentralFixZoneResponse getFixZoneDetail(Long id) { | ||
CentralFixZoneQuery query = facadeCentralFixZoneServiceImpl.getFixZone(id); | ||
return CentralFixZoneResponse.from(query); | ||
} | ||
|
||
@Override | ||
public void createFixZone( | ||
PrincipalDetails principalDetails, | ||
CreateFixZoneRequest request, | ||
List<MultipartFile> images | ||
) { | ||
Club club = clubService.getByUserId(principalDetails.getUser().getId()); | ||
Long createdFixZoneId = fixZoneService.create(club, request); | ||
|
||
fileService.uploadFile(createdFixZoneId, images, IMAGE, FIX_ZONE); | ||
public void createFixZone(PrincipalDetails principalDetails, CreateFixZoneRequest request) { | ||
User user = principalDetails.getUser(); | ||
facadeCentralFixZoneServiceImpl.create(request.toCommand(user.getId())); | ||
} | ||
|
||
@Override | ||
public void updateFixZone( | ||
PrincipalDetails principalDetails, | ||
Long fixZoneId, | ||
UpdateFixZoneRequest request, | ||
List<MultipartFile> images | ||
) { | ||
clubService.getByUserId(principalDetails.getUser().getId()); | ||
public void updateFixZone(Long fixZoneId, UpdateFixZoneRequest request) { | ||
facadeCentralFixZoneServiceImpl.update(request.toCommand(fixZoneId)); | ||
|
||
fixZoneService.update(fixZoneId, request); | ||
|
||
fileService.deleteFile(fixZoneId, IMAGE, FIX_ZONE); | ||
fileService.uploadFile(fixZoneId, images, IMAGE, FIX_ZONE); | ||
} | ||
|
||
@Override | ||
public void deleteFixZone( | ||
PrincipalDetails principalDetails, | ||
Long fixZoneId | ||
) { | ||
clubService.getByUserId(principalDetails.getUser().getId()); | ||
|
||
fixZoneService.delete(fixZoneId); | ||
|
||
fileService.deleteFile(fixZoneId, IMAGE, FIX_ZONE); | ||
public void deleteFixZone(Long fixZoneId) { | ||
facadeCentralFixZoneServiceImpl.delete(fixZoneId); | ||
} | ||
|
||
} |
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
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
17 changes: 5 additions & 12 deletions
17
...ngdong/ddingdongBE/domain/fixzone/controller/dto/request/CreateFixZoneCommentRequest.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 |
---|---|---|
@@ -1,23 +1,16 @@ | ||
package ddingdong.ddingdongBE.domain.fixzone.controller.dto.request; | ||
|
||
import ddingdong.ddingdongBE.domain.club.entity.Club; | ||
import ddingdong.ddingdongBE.domain.fixzone.entity.FixZone; | ||
import ddingdong.ddingdongBE.domain.fixzone.entity.FixZoneComment; | ||
import ddingdong.ddingdongBE.domain.fixzone.service.dto.command.CreateFixZoneCommentCommand; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(name = "CreateFixZoneCommentRequest", description = "Admin - 픽스존 댓글 등록 요청") | ||
public record CreateFixZoneCommentRequest( | ||
@Schema(description = "댓글 내용") | ||
String content | ||
@Schema(description = "댓글 내용") | ||
String content | ||
) { | ||
|
||
public FixZoneComment toEntity(FixZone fixZone, Club club) { | ||
return FixZoneComment.builder() | ||
.fixZone(fixZone) | ||
.club(club) | ||
.content(content) | ||
.build(); | ||
public CreateFixZoneCommentCommand toCommand(Long userId, Long fixZoneId) { | ||
return new CreateFixZoneCommentCommand(userId, fixZoneId, content); | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.