refactor(backend): extract UserConfig to tradingUserTypes

Made-with: Cursor
This commit is contained in:
Saravana Achu Mac 2026-04-04 19:02:45 -07:00
parent 12cedd12da
commit 72ec663125
3 changed files with 22 additions and 16 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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';