-
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.
- Loading branch information
1 parent
8468e7c
commit d2402c5
Showing
12 changed files
with
166 additions
and
178 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
114 changes: 0 additions & 114 deletions
114
...nullnullteam/vaccinationlog/infrastructure/repository/VaccinationRecommendRepository.java
This file was deleted.
Oops, something went wrong.
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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/hackathon/nullnullteam/vaccinationrecommend/VaccinationRecommend.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,28 @@ | ||
package com.hackathon.nullnullteam.vaccinationrecommend; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Builder | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
public class VaccinationRecommend { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String name; | ||
|
||
private int startAge; | ||
|
||
private int endAge; | ||
} |
28 changes: 28 additions & 0 deletions
28
...ackathon/nullnullteam/vaccinationrecommend/controller/VaccinationRecommendController.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,28 @@ | ||
package com.hackathon.nullnullteam.vaccinationrecommend.controller; | ||
|
||
import com.hackathon.nullnullteam.vaccinationrecommend.VaccinationRecommend; | ||
import com.hackathon.nullnullteam.vaccinationrecommend.controller.dto.VaccinationRecommendResponse; | ||
import com.hackathon.nullnullteam.vaccinationrecommend.service.VaccinationRecommendService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/vaccination") | ||
public class VaccinationRecommendController { | ||
|
||
private final VaccinationRecommendService vaccinationRecommendService; | ||
|
||
@GetMapping("") | ||
public VaccinationRecommendResponse.Infos getRecommendedVaccinations( | ||
@PathVariable Long memberId) { | ||
List<VaccinationRecommend> recommendations = vaccinationRecommendService.getRecommendedVaccinations(memberId); | ||
return VaccinationRecommendResponse.Infos.from(recommendations); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...kathon/nullnullteam/vaccinationrecommend/controller/dto/VaccinationRecommendResponse.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.hackathon.nullnullteam.vaccinationrecommend.controller.dto; | ||
|
||
import com.hackathon.nullnullteam.vaccinationrecommend.VaccinationRecommend; | ||
import lombok.Builder; | ||
|
||
import java.util.List; | ||
|
||
public class VaccinationRecommendResponse { | ||
@Builder | ||
public record Infos( | ||
List<VaccinationRecommend> recommends | ||
){ | ||
public static Infos from(List<VaccinationRecommend> list){ | ||
return Infos.builder() | ||
.recommends(list) | ||
.build(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...llteam/vaccinationrecommend/infrastructure/repository/VaccinationRecommendRepository.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,11 @@ | ||
package com.hackathon.nullnullteam.vaccinationrecommend.infrastructure.repository; | ||
|
||
import com.hackathon.nullnullteam.vaccinationrecommend.VaccinationRecommend; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface VaccinationRecommendRepository extends JpaRepository<VaccinationRecommend, Long> { | ||
|
||
List<VaccinationRecommend> findAllByStartAgeLessThanEqualAndEndAgeGreaterThanEqual(int age); | ||
} |
Oops, something went wrong.