-
Notifications
You must be signed in to change notification settings - Fork 1
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
ef6cdb8
commit 714aebb
Showing
16 changed files
with
186 additions
and
37 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
stock-service/src/main/java/com/flab/investing/stock/application/StockIntraDayService.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,20 @@ | ||
package com.flab.investing.stock.application; | ||
|
||
import com.flab.investing.global.error.exception.NotFoundStockException; | ||
import com.flab.investing.stock.domain.entity.StockIntraday; | ||
import com.flab.investing.stock.repository.StockIntradayRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class StockIntraDayService { | ||
|
||
private final StockIntradayRepository stockIntradayRepository; | ||
|
||
public StockIntraday findByStockId(final Long stockId) { | ||
return stockIntradayRepository.findTopByStockIdOrderByCreatedAtDesc(stockId) | ||
.orElseThrow(NotFoundStockException::new); | ||
} | ||
|
||
} |
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
1 change: 0 additions & 1 deletion
1
stock-service/src/main/java/com/flab/investing/stock/application/UserService.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
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
57 changes: 57 additions & 0 deletions
57
stock-service/src/main/java/com/flab/investing/stock/domain/entity/StockIntraday.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,57 @@ | ||
package com.flab.investing.stock.domain.entity; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.mongodb.core.mapping.Document; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Document(collection = "stockIntraday") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class StockIntraday { | ||
|
||
@Id | ||
private String id; | ||
|
||
private Long stockId; | ||
private String date; | ||
private String code; | ||
private String amount; | ||
private String status; | ||
private String sign; | ||
private String highLimit; | ||
private String lowerLimit; | ||
@CreatedDate | ||
private LocalDateTime createdAt; | ||
@LastModifiedDate | ||
private LocalDateTime updatedAt; | ||
|
||
public StockIntraday(final String id, | ||
final Long stockId, | ||
final String date, | ||
final String code, | ||
final String amount, | ||
final String status, | ||
final String sign, | ||
final String highLimit, | ||
final String lowerLimit, | ||
final LocalDateTime createdAt, | ||
final LocalDateTime updatedAt) { | ||
this.id = id; | ||
this.stockId = stockId; | ||
this.date = date; | ||
this.code = code; | ||
this.amount = amount; | ||
this.status = status; | ||
this.sign = sign; | ||
this.highLimit = highLimit; | ||
this.lowerLimit = lowerLimit; | ||
this.createdAt = createdAt; | ||
this.updatedAt = updatedAt; | ||
} | ||
} |
11 changes: 4 additions & 7 deletions
11
stock-service/src/main/java/com/flab/investing/stock/infrastructure/UserServiceClient.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 |
---|---|---|
@@ -1,19 +1,16 @@ | ||
package com.flab.investing.stock.infrastructure; | ||
|
||
import com.flab.investing.stock.infrastructure.request.UserRequest; | ||
import com.flab.investing.stock.infrastructure.response.UserResponse; | ||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
|
||
@Component | ||
@FeignClient(name = "userService", url="${userService.url}") | ||
@FeignClient(name = "userService", url = "${userService.url}") | ||
public interface UserServiceClient { | ||
|
||
@GetMapping("/users") | ||
UserResponse tokenValidate(@RequestBody UserRequest request); | ||
@GetMapping(value = "/users") | ||
UserResponse tokenValidate(@RequestHeader String accessToken); | ||
|
||
} | ||
|
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 |
---|---|---|
|
@@ -2,9 +2,8 @@ | |
|
||
public record UserResponse( | ||
String code, | ||
Long userId, | ||
String message, | ||
String name | ||
Long id, | ||
String userEmail | ||
) { | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
stock-service/src/main/java/com/flab/investing/stock/repository/StockIntradayRepository.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.flab.investing.stock.repository; | ||
|
||
import com.flab.investing.stock.domain.entity.StockIntraday; | ||
import org.springframework.data.mongodb.repository.MongoRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface StockIntradayRepository extends MongoRepository<StockIntraday, String> { | ||
|
||
Optional<StockIntraday> findTopByStockIdOrderByCreatedAtDesc(Long stockId); | ||
} |
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
Oops, something went wrong.