-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[BE/feat] 식사 분석하는 API 기능 변경에 따른 유스케이스 개발 및 기존 도메인 리팩토링
- Loading branch information
Showing
34 changed files
with
411 additions
and
133 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
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
10 changes: 0 additions & 10 deletions
10
...ed/src/main/java/com/gaebaljip/exceed/adapter/out/jpa/nutritionist/MonthlyTargetPort.java
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...in/java/com/gaebaljip/exceed/application/domain/nutritionist/AbstractAnalyzerFactory.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,8 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public abstract class AbstractAnalyzerFactory { | ||
public abstract Analyzer createAnalyzer(DailyMeal dailyMeal, Member member); | ||
} |
5 changes: 5 additions & 0 deletions
5
BE/exceed/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/Analyzable.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,5 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
public interface Analyzable { | ||
boolean analyze(); | ||
} |
15 changes: 15 additions & 0 deletions
15
BE/exceed/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/Analyzer.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,15 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public abstract class Analyzer implements Analyzable { | ||
|
||
protected DailyMeal dailyMeal; | ||
protected Member member; | ||
|
||
public Analyzer(DailyMeal dailyMeal, Member member) { | ||
this.dailyMeal = dailyMeal; | ||
this.member = member; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...d/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/CalorieAnalyzer.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,15 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class CalorieAnalyzer extends Analyzer { | ||
public CalorieAnalyzer(DailyMeal dailyMeal, Member member) { | ||
super(dailyMeal, member); | ||
} | ||
|
||
@Override | ||
public boolean analyze() { | ||
return member.measureTargetCalorie() - dailyMeal.calculateCurrentCalorie() <= 0; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ain/java/com/gaebaljip/exceed/application/domain/nutritionist/CalorieAnalyzerFactory.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,22 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class CalorieAnalyzerFactory extends AbstractAnalyzerFactory { | ||
|
||
private CalorieAnalyzerFactory() {} | ||
|
||
private static class SingletonHolder { | ||
private static final CalorieAnalyzerFactory INSTANCE = new CalorieAnalyzerFactory(); | ||
} | ||
|
||
public static CalorieAnalyzerFactory getInstance() { | ||
return SingletonHolder.INSTANCE; | ||
} | ||
|
||
@Override | ||
public CalorieAnalyzer createAnalyzer(DailyMeal dailyMeal, Member member) { | ||
return new CalorieAnalyzer(dailyMeal, member); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
.../main/java/com/gaebaljip/exceed/application/domain/nutritionist/CarbohydrateAnalyzer.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,15 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class CarbohydrateAnalyzer extends Analyzer { | ||
public CarbohydrateAnalyzer(DailyMeal dailyMeal, Member member) { | ||
super(dailyMeal, member); | ||
} | ||
|
||
@Override | ||
public boolean analyze() { | ||
return member.measureTargetCarbohydrate() - dailyMeal.calculateCurrentCarbohydrate() <= 0; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ava/com/gaebaljip/exceed/application/domain/nutritionist/CarbohydrateAnalyzerFactory.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,23 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class CarbohydrateAnalyzerFactory extends AbstractAnalyzerFactory { | ||
|
||
private CarbohydrateAnalyzerFactory() {} | ||
|
||
private static class SingletonHolder { | ||
private static final CarbohydrateAnalyzerFactory INSTANCE = | ||
new CarbohydrateAnalyzerFactory(); | ||
} | ||
|
||
public static CarbohydrateAnalyzerFactory getInstance() { | ||
return SingletonHolder.INSTANCE; | ||
} | ||
|
||
@Override | ||
public CarbohydrateAnalyzer createAnalyzer(DailyMeal dailyMeal, Member member) { | ||
return new CarbohydrateAnalyzer(dailyMeal, member); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...xceed/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/FatAnalyzer.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,15 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class FatAnalyzer extends Analyzer { | ||
public FatAnalyzer(DailyMeal dailyMeal, Member member) { | ||
super(dailyMeal, member); | ||
} | ||
|
||
@Override | ||
public boolean analyze() { | ||
return member.measureTargetFat() - dailyMeal.calculateCurrentFat() <= 0; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...rc/main/java/com/gaebaljip/exceed/application/domain/nutritionist/FatAnalyzerFactory.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,22 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class FatAnalyzerFactory extends AbstractAnalyzerFactory { | ||
|
||
private FatAnalyzerFactory() {} | ||
|
||
private static class SingletonHolder { | ||
private static final FatAnalyzerFactory INSTANCE = new FatAnalyzerFactory(); | ||
} | ||
|
||
public static FatAnalyzerFactory getInstance() { | ||
return SingletonHolder.INSTANCE; | ||
} | ||
|
||
@Override | ||
public FatAnalyzer createAnalyzer(DailyMeal dailyMeal, Member member) { | ||
return new FatAnalyzer(dailyMeal, member); | ||
} | ||
} |
35 changes: 0 additions & 35 deletions
35
...ceed/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/Nutritionist.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...d/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/ProteinAnalyzer.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,15 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class ProteinAnalyzer extends Analyzer { | ||
public ProteinAnalyzer(DailyMeal dailyMeal, Member member) { | ||
super(dailyMeal, member); | ||
} | ||
|
||
@Override | ||
public boolean analyze() { | ||
return member.measureTargetProtein() - dailyMeal.calculateCurrentProtein() <= 0; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ain/java/com/gaebaljip/exceed/application/domain/nutritionist/ProteinAnalyzerFactory.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,22 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class ProteinAnalyzerFactory extends AbstractAnalyzerFactory { | ||
|
||
private ProteinAnalyzerFactory() {} | ||
|
||
private static class SingletonHolder { | ||
private static final ProteinAnalyzerFactory INSTANCE = new ProteinAnalyzerFactory(); | ||
} | ||
|
||
public static ProteinAnalyzerFactory getInstance() { | ||
return SingletonHolder.INSTANCE; | ||
} | ||
|
||
@Override | ||
public ProteinAnalyzer createAnalyzer(DailyMeal dailyMeal, Member member) { | ||
return new ProteinAnalyzer(dailyMeal, member); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ain/java/com/gaebaljip/exceed/application/port/in/nutritionist/GetAllAnalysisUsecase.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.gaebaljip.exceed.application.port.in.nutritionist; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import com.gaebaljip.exceed.dto.AllAnalysisDTO; | ||
import com.gaebaljip.exceed.dto.request.GetAllAnalysisRequest; | ||
|
||
@Component | ||
public interface GetAllAnalysisUsecase { | ||
AllAnalysisDTO execute(GetAllAnalysisRequest request); | ||
} |
11 changes: 0 additions & 11 deletions
11
...c/main/java/com/gaebaljip/exceed/application/port/in/nutritionist/GetAnalysisUsecase.java
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
...java/com/gaebaljip/exceed/application/port/in/nutritionist/GetCalorieAnalysisUsecase.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.gaebaljip.exceed.application.port.in.nutritionist; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import com.gaebaljip.exceed.dto.request.GetCalorieAnalysisRequest; | ||
import com.gaebaljip.exceed.dto.response.GetCalorieAnalysisResponse; | ||
|
||
@Component | ||
public interface GetCalorieAnalysisUsecase { | ||
GetCalorieAnalysisResponse execute(GetCalorieAnalysisRequest getCalorieAnalysisRequest); | ||
} |
Oops, something went wrong.