Skip to content

Commit

Permalink
[fix] Alarm 엔티티 amount(복용량) 컬럼 추가 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
soeunkk committed Sep 3, 2022
1 parent 6a79b29 commit 4a70f6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/nadoyagsa/pillaroid/entity/Alarm.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class Alarm {
@Column
private int period;

@Column
private String amount;

@Column
private String dosage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public AlarmResponse saveAlarm(User user, AlarmDto alarmDto) {
.orElseThrow(() -> BadRequestException.NOT_EXIST_MEAL_TIME);

Map<String, String> dosageSummary = parseDosage(medicine.getDosage());
String amount = dosageSummary.get("amount").replace(" ", "");
amount = amount.equals("") ? null : amount;

Integer[] threeTakingTime = getThreeTakingTime(mealTime, dosageSummary.get("number"), dosageSummary.get("when"));

// 알림 저장
Expand All @@ -82,6 +85,7 @@ public AlarmResponse saveAlarm(User user, AlarmDto alarmDto) {
.medicine(medicine)
.name(alarmDto.getName())
.period(alarmDto.getPeriod())
.amount(amount)
.dosage(String.format("%s, %s, %s", dosageSummary.get("number"), dosageSummary.get("amount"), dosageSummary.get("when")))
.build();
Alarm savedAlarm = alarmRepository.save(alarm);
Expand Down

0 comments on commit 4a70f6d

Please sign in to comment.