-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PROD - 변경사항 배포
- Loading branch information
Showing
200 changed files
with
5,607 additions
and
1,328 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
34 changes: 34 additions & 0 deletions
34
...Api/src/main/java/com/example/matchapi/admin/banner/controller/AdminBannerController.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,34 @@ | ||
package com.example.matchapi.admin.banner.controller; | ||
|
||
import com.example.matchapi.admin.banner.service.AdminBannerService; | ||
import com.example.matchapi.banner.dto.BannerReq; | ||
import com.example.matchapi.banner.dto.BannerRes; | ||
import com.example.matchcommon.reponse.CommonResponse; | ||
import com.example.matchdomain.banner.enums.BannerType; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
@RequestMapping("/admin/banners") | ||
@Tag(name = "ADMIN-08-Banner💳 관리자 배너 관리 API") | ||
public class AdminBannerController { | ||
private final AdminBannerService adminBannerService; | ||
@PostMapping("") | ||
@Operation(summary = "ADMIN-08-01 배너 업로드") | ||
public CommonResponse<List<BannerRes.BannerList>> uploadBanner( | ||
@RequestParam BannerType bannerType, | ||
@RequestPart MultipartFile bannerImage, | ||
@RequestPart BannerReq.BannerUpload bannerUploadDto | ||
){ | ||
System.out.println(bannerUploadDto.getContentsUrl()); | ||
return CommonResponse.onSuccess(adminBannerService.uploadBanner(bannerType, bannerImage, bannerUploadDto)); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
Match-Api/src/main/java/com/example/matchapi/admin/banner/service/AdminBannerService.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,44 @@ | ||
package com.example.matchapi.admin.banner.service; | ||
|
||
import com.example.matchapi.banner.convertor.BannerConvertor; | ||
import com.example.matchapi.banner.dto.BannerReq; | ||
import com.example.matchapi.banner.dto.BannerRes; | ||
import com.example.matchdomain.banner.adaptor.BannerAdaptor; | ||
import com.example.matchdomain.banner.entity.Banner; | ||
import com.example.matchdomain.banner.enums.BannerType; | ||
import com.example.matchdomain.banner.repository.BannerRepository; | ||
import com.example.matchinfrastructure.config.s3.S3UploadService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.cache.annotation.CacheEvict; | ||
import org.springframework.cache.annotation.CachePut; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import javax.transaction.Transactional; | ||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class AdminBannerService { | ||
private final BannerRepository bannerRepository; | ||
private final BannerConvertor bannerConvertor; | ||
private final S3UploadService s3UploadService; | ||
private final BannerAdaptor bannerAdaptor; | ||
|
||
@Transactional | ||
@CachePut(cacheNames = "bannerCache", key = "'all'") | ||
public List<BannerRes.BannerList> uploadBanner(BannerType bannerType, | ||
MultipartFile bannerImage, | ||
BannerReq.BannerUpload bannerUploadDto) { | ||
String bannerImg = s3UploadService.uploadBannerImage(bannerImage); | ||
bannerRepository.save(bannerConvertor.convertToBannerUpload(bannerType, bannerImg, bannerUploadDto)); | ||
return cachingBannerList(); | ||
} | ||
|
||
@CacheEvict(cacheNames = "bannerCache") | ||
public List<BannerRes.BannerList> cachingBannerList() { | ||
List<Banner> banners = bannerAdaptor.getBannerList(); | ||
|
||
return bannerConvertor.convertToBannerList(banners); | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
...h-Api/src/main/java/com/example/matchapi/admin/event/controller/AdminEventController.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,31 @@ | ||
package com.example.matchapi.admin.event.controller; | ||
|
||
import com.example.matchapi.admin.event.dto.EventUploadReq; | ||
import com.example.matchapi.admin.event.service.AdminEventService; | ||
import com.example.matchapi.event.dto.EventRes; | ||
import com.example.matchcommon.reponse.CommonResponse; | ||
import com.example.matchinfrastructure.config.s3.S3UploadService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/admin/events") | ||
@Tag(name = "ADMIN-09-Event🎉 관리자 이벤트 관리 API") | ||
public class AdminEventController { | ||
private final AdminEventService adminEventService; | ||
|
||
@PostMapping("") | ||
@Operation(summary = "ADMIN-09-01 이벤트 업로드") | ||
public CommonResponse<String> uploadEventList(@RequestBody EventUploadReq eventUploadReq){ | ||
adminEventService.uploadEventList(eventUploadReq); | ||
return CommonResponse.onSuccess("업로드 성공"); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
Match-Api/src/main/java/com/example/matchapi/admin/event/dto/EventUploadReq.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,34 @@ | ||
package com.example.matchapi.admin.event.dto; | ||
|
||
import com.example.matchapi.common.model.ContentsList; | ||
import com.example.matchdomain.common.model.ContentsType; | ||
import com.example.matchdomain.event.enums.EventType; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class EventUploadReq { | ||
private String title; | ||
|
||
private String smallTitle; | ||
|
||
private String thumbnail; | ||
|
||
private EventType eventType; | ||
|
||
private LocalDate eventStartDate; | ||
|
||
private LocalDate eventEndDate; | ||
|
||
private List<ContentsList> contentsList; | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
Match-Api/src/main/java/com/example/matchapi/admin/event/service/AdminEventService.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,57 @@ | ||
package com.example.matchapi.admin.event.service; | ||
|
||
import com.example.matchapi.admin.event.dto.EventUploadReq; | ||
import com.example.matchapi.common.model.ContentsList; | ||
import com.example.matchapi.event.convetor.EventConvertor; | ||
import com.example.matchapi.event.dto.EventRes; | ||
import com.example.matchapi.event.service.EventService; | ||
import com.example.matchcommon.annotation.RedissonLock; | ||
import com.example.matchdomain.common.model.ContentsType; | ||
import com.example.matchdomain.event.entity.Event; | ||
import com.example.matchdomain.event.entity.EventContent; | ||
import com.example.matchdomain.event.repository.EventContentRepository; | ||
import com.example.matchdomain.event.repository.EventRepository; | ||
import com.example.matchinfrastructure.config.s3.S3UploadService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.cache.annotation.CacheEvict; | ||
import org.springframework.cache.annotation.CachePut; | ||
import org.springframework.cache.annotation.Cacheable; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static com.example.matchcommon.constants.MatchStatic.EVENT_S3_DIR; | ||
import static com.example.matchdomain.common.model.ContentsType.IMG; | ||
import static com.example.matchdomain.common.model.ContentsType.TEXT; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class AdminEventService { | ||
private final EventRepository eventRepository; | ||
private final EventContentRepository eventContentRepository; | ||
private final EventConvertor eventConvertor; | ||
private final EventService eventService; | ||
@RedissonLock(LockName = "이벤트 업로드", key = "#eventUploadReq") | ||
@CacheEvict(value = "eventCache", allEntries = true) | ||
public void uploadEventList(EventUploadReq eventUploadReq) { | ||
|
||
Event event = eventRepository.save(eventConvertor.convertToEventUpload(eventUploadReq, eventUploadReq.getThumbnail())); | ||
|
||
Long eventId = event.getId(); | ||
|
||
List<EventContent> eventContents = new ArrayList<>(); | ||
for(ContentsList content : eventUploadReq.getContentsList()){ | ||
if(content.getContentsType().equals(IMG)){ | ||
eventContents.add(eventConvertor.convertToEventContents(eventId, content.getContents(), IMG)); | ||
} | ||
else{ | ||
eventContents.add(eventConvertor.convertToEventContents(eventId, content.getContents(), TEXT)); | ||
} | ||
} | ||
|
||
eventContentRepository.saveAll(eventContents); | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
...i/src/main/java/com/example/matchapi/admin/keyword/controller/AdminKeywordController.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,37 @@ | ||
package com.example.matchapi.admin.keyword.controller; | ||
|
||
import com.example.matchapi.admin.keyword.dto.AdminKeywordReq; | ||
import com.example.matchapi.admin.keyword.service.AdminKeywordService; | ||
import com.example.matchapi.keword.dto.KeywordRes; | ||
import com.example.matchapi.keword.service.KeywordService; | ||
import com.example.matchcommon.reponse.CommonResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/admin/keywords") | ||
@Tag(name = "ADMIN-07-Keyword 추천 검색 키워드 🔎",description = "검색 키워드 API") | ||
public class AdminKeywordController { | ||
private final KeywordService keywordService; | ||
private final AdminKeywordService adminKeywordService; | ||
|
||
@GetMapping("") | ||
@Operation(summary = "07-01 ADMIN Keyword 추천 조회🔎") | ||
public CommonResponse<List<KeywordRes.KeywordList>> getKeywordList(){ | ||
return CommonResponse.onSuccess(keywordService.getKeywordList()); | ||
} | ||
|
||
@PostMapping("") | ||
@Operation(summary = "07-02 ADMIN Keyword 업로드🔎") | ||
public CommonResponse<List<KeywordRes.KeywordList>> postKeywordList( | ||
@RequestBody AdminKeywordReq.KeywordUpload keyword | ||
){ | ||
|
||
return CommonResponse.onSuccess(adminKeywordService.postKeyword(keyword)); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...Api/src/main/java/com/example/matchapi/admin/keyword/convertor/AdminKeywordConvertor.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,12 @@ | ||
package com.example.matchapi.admin.keyword.convertor; | ||
|
||
import com.example.matchapi.admin.keyword.dto.AdminKeywordReq; | ||
import com.example.matchcommon.annotation.Convertor; | ||
import com.example.matchdomain.keyword.entity.SearchKeyword; | ||
|
||
@Convertor | ||
public class AdminKeywordConvertor { | ||
public SearchKeyword convertToKeyword(AdminKeywordReq.KeywordUpload keyword) { | ||
return SearchKeyword.builder().keyword(keyword.getSearchKeyword()).priority(keyword.getPriority()).build(); | ||
} | ||
} |
Oops, something went wrong.