File tree Expand file tree Collapse file tree 5 files changed +58
-27
lines changed
src/main/java/umc/th/juinjang Expand file tree Collapse file tree 5 files changed +58
-27
lines changed Original file line number Diff line number Diff line change 11package umc .th .juinjang .api .appVersion .controller ;
22
3+ import lombok .RequiredArgsConstructor ;
34import org .springframework .web .bind .annotation .GetMapping ;
45import org .springframework .web .bind .annotation .RequestMapping ;
56import org .springframework .web .bind .annotation .RestController ;
6-
7- import lombok .RequiredArgsConstructor ;
87import umc .th .juinjang .api .appVersion .controller .response .AppVersionResponse ;
8+ import umc .th .juinjang .api .appVersion .service .AppVersionService ;
99import umc .th .juinjang .api .dto .ApiResponse ;
10- import umc .th .juinjang .config .AppVersionProperties ;
1110
1211@ RestController
1312@ RequestMapping ("/api/app/version" )
1413@ RequiredArgsConstructor
1514public class AppVersionController {
1615
17- private final AppVersionProperties appVersionProperties ;
16+ private final AppVersionService appVersionService ;
1817
19- @ GetMapping ("/ios" )
20- public ApiResponse <AppVersionResponse > getIOSVersion () {
21- return ApiResponse .onSuccess (AppVersionResponse .of (appVersionProperties .getIos ()));
22- }
18+ @ GetMapping ("/ios" )
19+ public ApiResponse <AppVersionResponse > getIOSVersion () {
20+ return ApiResponse .onSuccess (AppVersionResponse .of (
21+ appVersionService .getIosVersion ()
22+ ));
23+ }
2324
2425}
Original file line number Diff line number Diff line change 1+ package umc .th .juinjang .api .appVersion .service ;
2+
3+ import lombok .RequiredArgsConstructor ;
4+ import org .springframework .stereotype .Service ;
5+ import umc .th .juinjang .config .AppConfig .model .AppConfig ;
6+ import umc .th .juinjang .config .AppConfig .repository .AppConfigRepository ;
7+
8+ @ RequiredArgsConstructor
9+ @ Service
10+ public class AppVersionService {
11+
12+ private final AppConfigRepository appConfigRepository ;
13+
14+ public String getIosVersion () {
15+ final String APPLE_VERSION_CONFIG_KEY = "app.version.ios" ;
16+ return appConfigRepository .findById (APPLE_VERSION_CONFIG_KEY )
17+ .map (AppConfig ::getConfigValue )
18+ .orElseThrow (() -> new IllegalStateException ("iOS version config not found" ));
19+ }
20+
21+ }
Original file line number Diff line number Diff line change 1+ package umc .th .juinjang .config .AppConfig .model ;
2+
3+ import jakarta .persistence .Entity ;
4+ import jakarta .persistence .Id ;
5+ import java .time .LocalDateTime ;
6+ import lombok .Getter ;
7+
8+ @ Entity
9+ @ Getter
10+ public class AppConfig {
11+
12+ @ Id
13+ private String configKey ;
14+
15+ private String configValue ;
16+
17+ private String description ;
18+
19+ private LocalDateTime updatedAt ;
20+ }
Original file line number Diff line number Diff line change 1+ package umc .th .juinjang .config .AppConfig .repository ;
2+
3+
4+ import org .springframework .data .jpa .repository .JpaRepository ;
5+ import umc .th .juinjang .config .AppConfig .model .AppConfig ;
6+
7+ public interface AppConfigRepository extends JpaRepository <AppConfig , String > {
8+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments