모의투자 로직 변경

This commit is contained in:
Macbook
2026-05-31 14:05:46 +09:00
parent ead97dad5d
commit d6eedf19bb
33 changed files with 1456 additions and 330 deletions
@@ -0,0 +1,33 @@
package com.goldenchart.controller;
import com.goldenchart.trading.TradingAccess;
import java.util.Map;
/** 매매·모의·전략 API — 정식 로그인(userId) 필수 */
public final class TradingControllerSupport {
private TradingControllerSupport() {}
public static long requireRegisteredUser(Map<String, String> headers) {
String raw = headers.get("x-user-id");
if (raw == null || raw.isBlank()) {
throw new com.goldenchart.trading.TradingAccessDeniedException();
}
try {
return TradingAccess.requireUserId(Long.parseLong(raw.trim()));
} catch (NumberFormatException e) {
throw new com.goldenchart.trading.TradingAccessDeniedException();
}
}
public static Long parseUserId(Map<String, String> headers) {
String raw = headers.get("x-user-id");
if (raw == null || raw.isBlank()) return null;
try {
return Long.parseLong(raw.trim());
} catch (NumberFormatException e) {
return null;
}
}
}