diff --git a/backend/src/services/SupabaseService.ts b/backend/src/services/SupabaseService.ts index 32e555b..d3dd40f 100644 --- a/backend/src/services/SupabaseService.ts +++ b/backend/src/services/SupabaseService.ts @@ -38,22 +38,9 @@ export type { StaleOrderScope, VirtualOpenPosition } from './tradingPersistenceTypes.js'; +import type { UserConfig } from './tradingUserTypes.js'; -export interface UserConfig { - user_id: string; - first_name: string; - last_name: string; - email: string; - ALPACA_API_KEY: string; - ALPACA_SECRET_KEY: string; - REAL_ALPACA_API_KEY: string; - REAL_ALPACA_SECRET_KEY: string; - role: string; - trade_enable: boolean; - drop_threshold_for_buy: number; - gain_threshold_for_sell: number; - market_poll_interval_in_seconds: number; -} +export type { UserConfig } from './tradingUserTypes.js'; class SupabaseService { private client: SupabaseClient | null = null; diff --git a/backend/src/services/tradingUserTypes.ts b/backend/src/services/tradingUserTypes.ts new file mode 100644 index 0000000..336b3f3 --- /dev/null +++ b/backend/src/services/tradingUserTypes.ts @@ -0,0 +1,19 @@ +/** + * Trading user row shape shared by Cosmos `trading_users` documents and legacy Postgres `users` table. + */ + +export interface UserConfig { + user_id: string; + first_name: string; + last_name: string; + email: string; + ALPACA_API_KEY: string; + ALPACA_SECRET_KEY: string; + REAL_ALPACA_API_KEY: string; + REAL_ALPACA_SECRET_KEY: string; + role: string; + trade_enable: boolean; + drop_threshold_for_buy: number; + gain_threshold_for_sell: number; + market_poll_interval_in_seconds: number; +} diff --git a/backend/src/services/userRepository.ts b/backend/src/services/userRepository.ts index 09b4841..d61c386 100644 --- a/backend/src/services/userRepository.ts +++ b/backend/src/services/userRepository.ts @@ -1,8 +1,8 @@ import { getContainer } from '@bytelyst/cosmos'; import { config } from '../config/index.js'; import logger from '../utils/logger.js'; -import type { UserConfig } from './SupabaseService.js'; import { supabaseService } from './SupabaseService.js'; +import type { UserConfig } from './tradingUserTypes.js'; const USER_PROFILE_CONTAINER = 'trading_users';