Skip to content

Commit

Permalink
#27 - Feat: Add Age Based Recommend controller
Browse files Browse the repository at this point in the history
  • Loading branch information
eun61n00 committed Sep 17, 2023
1 parent d3f8af2 commit a24ae26
Showing 1 changed file with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package org.routemaster.api.total.domain.recommend.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.routemaster.api.total.domain.attraction.data.search.AttractionSearchVO;
import org.routemaster.api.total.domain.attraction.service.AttractionSearchService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

@Slf4j
@RestController
@RequestMapping("/recommend/age-based")
@RequiredArgsConstructor
public class AgeBasedRecommendRestController {

private final AttractionSearchService attractionSearchService;

@GetMapping
public ResponseEntity<Mono<AttractionSearchVO>> recommendAttractionByAge(
@RequestParam Integer age
) {
Integer recommendAreaCode = 1;
Integer recommendContentTypeId = null;
String recommendLargeCategory = null;
String recommendMediumCategory = null;
String recommendSmallCategory = null;

if (age == 20) {
recommendAreaCode = 1;
recommendContentTypeId = 15;
} else if (age == 30) {
recommendContentTypeId = 14;
recommendLargeCategory = "A02";
recommendMediumCategory = "A0206";
} else if (age == 40) {
recommendContentTypeId = 38;
recommendLargeCategory = "A04";
recommendMediumCategory = "A0401";
recommendSmallCategory = "A04010300";
} else if (age == 50) {
recommendAreaCode = 32;
recommendLargeCategory = "A01";
}

log.info("recommendAreaCode: {}", recommendAreaCode);
log.info("recommendContentTypeId: {}", recommendContentTypeId);
log.info("recommendLargeCategory: {}", recommendLargeCategory);
log.info("recommendMediumCategory: {}", recommendMediumCategory);
log.info("recommendSmallCategory: {}", recommendSmallCategory);

return ResponseEntity.ok(
attractionSearchService.searchAreaBasedAttraction(10,
1,
"C",
recommendContentTypeId,
recommendAreaCode,
null,
recommendLargeCategory,
recommendMediumCategory,
recommendSmallCategory,
null)
);
}
}

0 comments on commit a24ae26

Please sign in to comment.