@@ -105,17 +105,11 @@ app.use(function (error, req, res, next) {
105105} ) ;
106106
107107// =====================================================================
108- // STEAM AUTHENTICATION SETUP
108+ // STEAM INVENTORY (for float inspection only - no auth needed)
109109// =====================================================================
110- // Better Auth authentication (from Next.js frontend)
111- const auth = require ( './lib/auth' ) ;
112- const { requireAuth, optionalAuth } = auth ;
110+ // Note: Portfolio-related inventory sync moved to Investment API (port 3003)
113111const steamInventory = require ( './lib/steam-inventory' ) ;
114112
115- // Initialize auth with postgres connection
116- auth . initialize ( postgres ) ;
117- winston . info ( 'Better Auth authentication configured' ) ;
118-
119113
120114
121115if ( CONFIG . trust_proxy === true ) {
@@ -269,7 +263,7 @@ app.post('/bulk', (req, res) => {
269263 }
270264} ) ;
271265
272- app . get ( '/stats' , ( req , res ) => {
266+ app . get ( '/api/ stats' , ( req , res ) => {
273267 res . json ( {
274268 bots_online : botController . getReadyAmount ( ) ,
275269 bots_total : botController . bots . length ,
@@ -1199,9 +1193,11 @@ app.get('/api/inventory/:steamId', async (req, res) => {
11991193} ) ;
12001194
12011195// ============================================================================
1202- // PORTFOLIO MANAGEMENT ENDPOINTS
1196+ // PORTFOLIO MANAGEMENT ENDPOINTS - MOVED TO INVESTMENT API
12031197// ============================================================================
1204-
1198+ // NOTE: All portfolio endpoints have been moved to cs2-investment-api (port 3003)
1199+ // This includes: add, get, stats, sales, deletions, allocations, snapshots, etc.
1200+ if ( false ) {
12051201/**
12061202 * Add new investment to portfolio
12071203 * POST /api/portfolio/add
@@ -2624,8 +2620,9 @@ function calculateDiversityScore(itemTypes, totalItems) {
26242620 const score = Math . max ( 1 , Math . min ( 10 , categoryScore - dominancePenalty ) ) ;
26252621 return score ;
26262622}
2623+ } // End of disabled portfolio endpoints block
26272624
2628- winston . info ( 'Portfolio endpoints loaded successfully' ) ;
2625+ // winston.info('Portfolio endpoints loaded successfully');
26292626
26302627// =====================================================================
26312628// CSGO-API INTEGRATION ENDPOINTS
@@ -2949,9 +2946,11 @@ app.get('/api/pricing/fee-examples', (req, res) => {
29492946winston . info ( 'Steam fee calculation endpoints loaded' ) ;
29502947
29512948// =====================================================================
2952- // PORTFOLIO SNAPSHOTS & ADVANCED FEATURES
2949+ // PORTFOLIO SNAPSHOTS & ADVANCED FEATURES - MOVED TO INVESTMENT API
29532950// =====================================================================
2954-
2951+ // NOTE: All advanced portfolio features moved to cs2-investment-api (port 3003)
2952+ // This includes: snapshots, auth, webhooks, alerts, batch updates, etc.
2953+ if ( false ) {
29552954// Create portfolio snapshot
29562955app . post ( '/api/portfolio/snapshot/create/:userId' , async ( req , res ) => {
29572956 try {
@@ -3830,114 +3829,21 @@ app.delete('/api/webhooks/discord/:webhookId', async (req, res) => {
38303829winston . info ( 'Discord webhook endpoints loaded' ) ;
38313830
38323831// =====================================================================
3833- // PRICE ALERT ENDPOINTS
3832+ // PRICE ALERT ENDPOINTS - MOVED TO INVESTMENT API
38343833// =====================================================================
3834+ // NOTE: Price alerts have been moved to the Investment API (port 3003)
3835+ // The enhanced version includes:
3836+ // - Smart status calculation (pending/active/triggered)
3837+ // - Distance to target tracking
3838+ // - Statistics aggregation
3839+ // - Update/modify alerts
3840+ // - Background job for checking alerts
3841+ //
3842+ // Routes via Nginx: https://api.cs2floatchecker.com/api/alerts/*
3843+ // See: /var/www/cs2-investment-api/routes/alerts.js
3844+ // Docs: /var/www/PRICE_ALERTS_API.md
38353845
3836- // Create price alert
3837- app . post ( '/api/alerts/create' , async ( req , res ) => {
3838- try {
3839- const { user_id, item_name, target_price, condition, marketplace } = req . body ;
3840-
3841- if ( ! user_id || ! item_name || ! target_price || ! condition ) {
3842- return res . status ( 400 ) . json ( {
3843- error : 'Missing required fields' ,
3844- message : 'Required: user_id, item_name, target_price, condition'
3845- } ) ;
3846- }
3847-
3848- if ( ! [ 'above' , 'below' ] . includes ( condition ) ) {
3849- return res . status ( 400 ) . json ( {
3850- error : 'Invalid condition' ,
3851- message : 'Condition must be "above" or "below"'
3852- } ) ;
3853- }
3854-
3855- const result = await postgres . pool . query ( `
3856- INSERT INTO price_alerts (
3857- user_id, item_name, target_price, condition, marketplace
3858- ) VALUES ($1, $2, $3, $4, $5)
3859- RETURNING *
3860- ` , [ user_id , item_name , target_price , condition , marketplace || 'steam' ] ) ;
3861-
3862- res . json ( {
3863- success : true ,
3864- message : 'Price alert created' ,
3865- alert : result . rows [ 0 ]
3866- } ) ;
3867- } catch ( error ) {
3868- winston . error ( 'Create alert error:' , error ) ;
3869- res . status ( 500 ) . json ( {
3870- error : 'Failed to create alert' ,
3871- message : error . message
3872- } ) ;
3873- }
3874- } ) ;
3875-
3876- // Get user's price alerts
3877- app . get ( '/api/alerts/:userId' , async ( req , res ) => {
3878- try {
3879- const { userId } = req . params ;
3880- const { active_only = 'true' } = req . query ;
3881-
3882- let query = `
3883- SELECT * FROM price_alerts
3884- WHERE user_id = $1
3885- ` ;
3886-
3887- if ( active_only === 'true' ) {
3888- query += ' AND is_active = true' ;
3889- }
3890-
3891- query += ' ORDER BY created_at DESC' ;
3892-
3893- const result = await postgres . pool . query ( query , [ userId ] ) ;
3894-
3895- res . json ( {
3896- success : true ,
3897- count : result . rows . length ,
3898- alerts : result . rows
3899- } ) ;
3900- } catch ( error ) {
3901- winston . error ( 'Get alerts error:' , error ) ;
3902- res . status ( 500 ) . json ( {
3903- error : 'Failed to get alerts' ,
3904- message : error . message
3905- } ) ;
3906- }
3907- } ) ;
3908-
3909- // Delete price alert
3910- app . delete ( '/api/alerts/:alertId' , async ( req , res ) => {
3911- try {
3912- const { alertId } = req . params ;
3913-
3914- const result = await postgres . pool . query ( `
3915- DELETE FROM price_alerts
3916- WHERE id = $1
3917- RETURNING id, item_name, target_price
3918- ` , [ alertId ] ) ;
3919-
3920- if ( result . rows . length === 0 ) {
3921- return res . status ( 404 ) . json ( {
3922- error : 'Alert not found'
3923- } ) ;
3924- }
3925-
3926- res . json ( {
3927- success : true ,
3928- message : 'Alert deleted' ,
3929- alert : result . rows [ 0 ]
3930- } ) ;
3931- } catch ( error ) {
3932- winston . error ( 'Delete alert error:' , error ) ;
3933- res . status ( 500 ) . json ( {
3934- error : 'Failed to delete alert' ,
3935- message : error . message
3936- } ) ;
3937- }
3938- } ) ;
3939-
3940- winston . info ( 'Price alert endpoints loaded' ) ;
3846+ // winston.info('Price alert endpoints loaded'); // Disabled - moved to Investment API
39413847
39423848// =====================================================================
39433849// BATCH PRICE UPDATE ENDPOINTS
@@ -4089,18 +3995,22 @@ function calculateTradeRisk(history) {
40893995 lastTradeDate : tradeDate . toISOString ( )
40903996 } ;
40913997}
3998+ } // End of disabled portfolio advanced features block
40923999
40934000// =====================================================================
40944001// STEAM AUTHENTICATION ROUTES
40954002// =====================================================================
40964003// REMOVED: Old Passport.js Steam auth routes
40974004// steamAuth.setupAuthRoutes(app, postgres);
4098- winston . info ( 'Using Better Auth for authentication (configured in Next.js frontend)' ) ;
4005+ // Note: Better Auth removed from CSFloat API - only needed in Investment API
4006+ // CSFloat API is public (float inspection for 500 extension users)
40994007
41004008// =====================================================================
4101- // STEAM INVENTORY ENDPOINTS
4009+ // STEAM INVENTORY ENDPOINTS - MOVED TO INVESTMENT API
41024010// =====================================================================
4103-
4011+ // NOTE: These endpoints have been moved to cs2-investment-api on port 3003
4012+ // They require Better Auth which is only enabled on the Investment API
4013+ /*
41044014// Get user's CS2 inventory
41054015app.get('/api/steam/inventory/:steamId?', requireAuth, async (req, res) => {
41064016 try {
@@ -4154,15 +4064,19 @@ app.get('/api/steam/inventory/:steamId?/value', requireAuth, async (req, res) =>
41544064 });
41554065 }
41564066});
4067+ */
41574068
41584069// ============================================================================
4159- // QUICK ACTIONS API
4070+ // QUICK ACTIONS API - MOVED TO INVESTMENT API
41604071// ============================================================================
4161-
4072+ // NOTE: These endpoints have been moved to cs2-investment-api on port 3003
4073+ // They are portfolio features and belong in the Investment API
4074+ /*
41624075/**
41634076 * Quick Add Investment - Streamlined endpoint for fast item addition
41644077 * POST /api/portfolio/quick/add
41654078 */
4079+ /*
41664080app.post('/api/portfolio/quick/add',
41674081 validate(z.object({
41684082 userId: z.string().min(1),
@@ -4235,6 +4149,7 @@ app.post('/api/portfolio/quick/add',
42354149 * Quick Record Sale - Fast sale recording
42364150 * POST /api/portfolio/quick/sell/:investmentId
42374151 */
4152+ /*
42384153app.post('/api/portfolio/quick/sell/:investmentId',
42394154 validateParams(z.object({
42404155 investmentId: z.string().regex(/^\d+$/).transform(Number)
@@ -4305,6 +4220,7 @@ app.post('/api/portfolio/quick/sell/:investmentId',
43054220 * Quick Price Check - Get current prices for multiple items
43064221 * POST /api/portfolio/quick/price-check
43074222 */
4223+ /*
43084224app.post('/api/portfolio/quick/price-check',
43094225 validate(z.object({
43104226 itemNames: z.array(z.string()).min(1).max(50)
@@ -4344,8 +4260,9 @@ app.post('/api/portfolio/quick/price-check',
43444260 });
43454261 })
43464262);
4263+ */
43474264
4348- winston . info ( 'Quick Actions API endpoints loaded' ) ;
4265+ // winston.info('Quick Actions API endpoints loaded');
43494266
43504267// ============================================================================
43514268// CS2 ITEM SEARCH API
@@ -4433,30 +4350,31 @@ app.post('/api/items/cache/refresh',
44334350winston . info ( 'CS2 Item Search API endpoints loaded' ) ;
44344351
44354352// ============================================================================
4436- // STEAM INVENTORY INTEGRATION
4353+ // STEAM INVENTORY INTEGRATION - MOVED TO INVESTMENT API
44374354// ============================================================================
4438-
4355+ // NOTE: These endpoints have been moved to cs2-investment-api on port 3003
4356+ /*
44394357// Sync inventory to portfolio
44404358app.post('/api/steam/inventory/sync', requireAuth, async (req, res) => {
44414359 try {
44424360 const steamId = req.user.steam_id;
44434361 const { selected_items = [] } = req.body;
4444-
4362+
44454363 // Get inventory
44464364 const inventoryResult = await steamInventory.getSteamInventory(steamId);
4447-
4365+
44484366 if (!inventoryResult.success) {
44494367 return res.status(400).json(inventoryResult);
44504368 }
4451-
4369+
44524370 let added = 0;
44534371 let errors = [];
4454-
4372+
44554373 // Filter items to sync (either all or selected)
44564374 const itemsToSync = selected_items.length > 0
44574375 ? inventoryResult.items.filter(item => selected_items.includes(item.assetid))
44584376 : inventoryResult.items;
4459-
4377+
44604378 // Add each item to portfolio
44614379 for (const item of itemsToSync) {
44624380 try {
@@ -4516,15 +4434,15 @@ app.post('/api/steam/inventory/sync', requireAuth, async (req, res) => {
45164434 });
45174435 }
45184436 }
4519-
4437+
45204438 res.json({
45214439 success: true,
45224440 message: `Synced ${added} items from Steam inventory`,
45234441 added: added,
45244442 total_items: itemsToSync.length,
45254443 errors: errors.length > 0 ? errors : undefined
45264444 });
4527-
4445+
45284446 } catch (error) {
45294447 winston.error('Inventory sync error:', error);
45304448 res.status(500).json({
@@ -4551,8 +4469,9 @@ app.get('/api/steam/inventory/test/:steamId', async (req, res) => {
45514469 });
45524470 }
45534471});
4472+ */
45544473
4555- winston . info ( 'Steam inventory endpoints loaded' ) ;
4474+ // winston.info('Steam inventory endpoints loaded');
45564475
45574476// =====================================================================
45584477// HEALTH CHECK ENDPOINT
0 commit comments