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
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ public class AdminController {
private final AdminService adminService;
private final JwtTokenProvider jwtTokenProvider;

@GetMapping("/admin/introductions")
@Operation(summary = "학회 소개 정보 조회", description = "학회 소개 페이지의 현재 저장된 정보를 조회합니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "500", description = "INTER SERVER ERROR", content = @Content(schema = @Schema(implementation = BaseResponse.class))),
})
public ResponseEntity<BaseResponse> getIntroduction() {
return ResponseEntity.ok(new BaseResponse(introService.getAdminIntroduction()));
}

@Hidden
@PostMapping(value = "/admin/introductions", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<BaseResponse> addIntroduction(@ModelAttribute IntroRequest request) {
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/com/kusitms/website/domain/admin/AdminService.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
import com.kusitms.website.domain.review.dto.request.ReviewRequest;
import com.kusitms.website.domain.review.dto.response.ReviewDetailResponse;
import com.kusitms.website.domain.review.dto.response.ReviewResponse;
import com.kusitms.website.domain.review.entity.Review;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -131,8 +130,8 @@ public void saveMeetup(MeetupRequest request) {
public void updateMeetup(MeetupRequest request) {
TMPMeetupProject meetup = meetupRepository.findById(request.getMeetupId()).orElseThrow();

String logoUrl = s3Service.uploadFile(request.getLogoFile(), "meetup");
String posterUrl = s3Service.uploadFile(request.getPosterFile(), "meetup");
String logoUrl = uploadOrKeep(request.getLogoFile(), meetup.getLogoUrl(), "meetup");
String posterUrl = uploadOrKeep(request.getPosterFile(), meetup.getPosterUrl(), "meetup");

meetup.update(request.getCardinal(),
request.getName(),
Expand All @@ -144,6 +143,7 @@ public void updateMeetup(MeetupRequest request) {
request.getInstagramUrl(),
request.getGithubUrl(),
request.getAppUrl(),
request.getBehanceUrl(),
LocalDate.parse(request.getStartDate(), DateTimeFormatter.ISO_DATE),
LocalDate.parse(request.getEndDate(), DateTimeFormatter.ISO_DATE),
request.getTeamName());
Expand Down Expand Up @@ -281,4 +281,9 @@ public void updateReview(ReviewRequest request) {
public void deleteReview(Long reviewId) {
reviewRepository.deleteById(reviewId);
}

private String uploadOrKeep(MultipartFile file, String existingUrl, String dirName) {
if (file == null || file.isEmpty()) return existingUrl;
return s3Service.uploadFile(file, dirName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public class TMPMeetupProject {
@Column(name = "app_url")
private String appUrl;

@Column(name = "behance_url")
private String behanceUrl;

@Column(name = "start_date", nullable = false)
private LocalDate startDate;

Expand All @@ -64,7 +67,7 @@ public class TMPMeetupProject {
@Builder
public TMPMeetupProject(int cardinal, String name, String intro, ProjectType type, String oneLineIntro,
String logoUrl, String posterUrl, String instagramUrl, String githubUrl, String appUrl,
LocalDate startDate, LocalDate endDate, String teamName) {
String behanceUrl, LocalDate startDate, LocalDate endDate, String teamName) {
this.cardinal = cardinal;
this.name = name;
this.intro = intro;
Expand All @@ -75,14 +78,15 @@ public TMPMeetupProject(int cardinal, String name, String intro, ProjectType typ
this.instagramUrl = instagramUrl;
this.githubUrl = githubUrl;
this.appUrl = appUrl;
this.behanceUrl = behanceUrl;
this.startDate = startDate;
this.endDate = endDate;
this.teamName = teamName;
}

public void update(int cardinal, String name, String intro, ProjectType type, String oneLineIntro,
String logoUrl, String posterUrl, String instagramUrl, String githubUrl, String appUrl,
LocalDate startDate, LocalDate endDate, String teamName) {
String behanceUrl, LocalDate startDate, LocalDate endDate, String teamName) {
this.cardinal = cardinal;
this.name = name;
this.intro = intro;
Expand All @@ -93,6 +97,7 @@ public void update(int cardinal, String name, String intro, ProjectType type, St
this.instagramUrl = instagramUrl;
this.githubUrl = githubUrl;
this.appUrl = appUrl;
this.behanceUrl = behanceUrl;
this.startDate = startDate;
this.endDate = endDate;
this.teamName = teamName;
Expand Down
Loading
Loading