281 lines
5.7 KiB
Markdown
281 lines
5.7 KiB
Markdown
# Admin Panel Quick Reference
|
|
|
|
## 🚀 Quick Start
|
|
|
|
```bash
|
|
# Check current status
|
|
node check-prices.js
|
|
|
|
# Update all prices now
|
|
node update-prices-now.js
|
|
|
|
# Update specific game
|
|
node update-prices-now.js cs2
|
|
node update-prices-now.js rust
|
|
|
|
# Test Steam API connection
|
|
node test-steam-api.js
|
|
|
|
# Make user admin
|
|
node make-admin.js
|
|
```
|
|
|
|
## 🔑 Access
|
|
|
|
**URL**: `http://localhost:5173/admin`
|
|
|
|
**Requirements**:
|
|
- staffLevel >= 3
|
|
- OR Steam ID in `ADMIN_STEAM_IDS`
|
|
|
|
**Your Account**: ✅ Already set to staffLevel 3
|
|
|
|
## 📊 Tabs Overview
|
|
|
|
### 1. Dashboard
|
|
- User count, active items, transactions
|
|
- Recent activity feed
|
|
- Top sellers
|
|
|
|
### 2. Financial (🆕)
|
|
- **Gross Profit**: Total fees collected
|
|
- **Net Profit**: Profit after deposits/withdrawals
|
|
- Deposits, Withdrawals, Purchases, Sales
|
|
- Period filters (today, week, month, year, all)
|
|
|
|
### 3. Transactions (🆕)
|
|
- View all transactions
|
|
- Filter by type, status, user
|
|
- Shows: date, user, amount, fee, balance
|
|
|
|
### 4. Items (🆕)
|
|
- Filter by game: CS2 / Rust / All
|
|
- Search, sort, filter by status/category
|
|
- **Edit Prices** button to override
|
|
- Shows listing price + market price
|
|
|
|
## 💰 Price Management
|
|
|
|
### Current Status
|
|
```
|
|
CS2: 14/19 items (73.7%) ✅
|
|
Rust: 0/4 items (0%)
|
|
```
|
|
|
|
### Override Prices
|
|
1. Go to Items tab
|
|
2. Filter by game (CS2/Rust)
|
|
3. Click "Edit Prices" on item
|
|
4. Set Listing Price + Market Price
|
|
5. Save
|
|
|
|
### Automatic Updates
|
|
- ✅ Runs on backend startup
|
|
- ✅ Runs every 60 minutes
|
|
- ✅ 29,602 CS2 prices available
|
|
- ✅ 5,039 Rust prices available
|
|
|
|
## 🎯 Common Tasks
|
|
|
|
### Daily
|
|
- [ ] Check Financial tab for profit
|
|
- [ ] Review recent transactions
|
|
- [ ] Check failed transactions
|
|
- [ ] Monitor items without prices
|
|
|
|
### Weekly
|
|
- [ ] Analyze profit trends
|
|
- [ ] Review top sellers
|
|
- [ ] Override missing prices
|
|
- [ ] Check user balances
|
|
|
|
### Monthly
|
|
- [ ] Audit price overrides
|
|
- [ ] Review fee structure
|
|
- [ ] Analyze sales patterns
|
|
|
|
## 🔍 Filters & Search
|
|
|
|
### Transaction Filters
|
|
- **Type**: deposit, withdrawal, purchase, sale, trade, bonus, refund
|
|
- **Status**: completed, pending, failed, cancelled
|
|
- **User ID**: MongoDB ObjectId
|
|
- **Date Range**: Custom start/end dates
|
|
|
|
### Item Filters
|
|
- **Game**: CS2, Rust, or All
|
|
- **Status**: active, sold, removed
|
|
- **Category**: rifles, pistols, knives, gloves, etc.
|
|
- **Search**: Item name
|
|
- **Sort**: price, marketPrice, listedAt, views
|
|
|
|
## 📈 Understanding Metrics
|
|
|
|
### Financial Formulas
|
|
```
|
|
Gross Profit = Sum(all fees)
|
|
Net Profit = Gross Profit - (Withdrawals - Deposits)
|
|
Net Balance = Deposits - Withdrawals
|
|
```
|
|
|
|
### Color Codes
|
|
- 🟢 **Green**: Positive (deposits, sales, income)
|
|
- 🔴 **Red**: Negative (withdrawals, purchases, expenses)
|
|
- 🟡 **Yellow**: Warning or pending
|
|
- 🔵 **Blue**: Informational
|
|
- 🟣 **Purple**: Admin actions
|
|
|
|
## 🛠️ Troubleshooting
|
|
|
|
### Items Not Loading
|
|
✅ **Fixed** - Query params now filter empty values
|
|
|
|
### No Prices
|
|
```bash
|
|
node update-prices-now.js
|
|
```
|
|
|
|
### Admin Menu Not Gold
|
|
✅ **Fixed** - Gold gradient applied to Admin menu item
|
|
|
|
### Prices Not Auto-Updating
|
|
Check `.env`:
|
|
```env
|
|
ENABLE_PRICE_UPDATES=true
|
|
```
|
|
|
|
## 🔐 Security Checklist
|
|
|
|
- [x] Admin access limited to staffLevel 3+
|
|
- [x] All admin routes authenticated
|
|
- [x] Price overrides logged
|
|
- [x] Steam IDs validated
|
|
- [ ] Enable 2FA (recommended)
|
|
- [ ] Monitor for suspicious transactions
|
|
|
|
## 📱 UI Features
|
|
|
|
### Dashboard Tab
|
|
- Quick stats cards
|
|
- Recent activity feed
|
|
- Top sellers list
|
|
|
|
### Financial Tab
|
|
- Period filters
|
|
- Profit calculations
|
|
- Transaction breakdowns
|
|
- CS2/Rust metrics
|
|
|
|
### Transactions Tab
|
|
- Advanced filters
|
|
- Pagination (50/page)
|
|
- User info with avatars
|
|
- Type/status badges
|
|
|
|
### Items Tab
|
|
- Game separation
|
|
- Search + filters
|
|
- Price override modal
|
|
- Pagination (20/page)
|
|
|
|
## 🎨 Visual Indicators
|
|
|
|
### Admin Menu
|
|
- 🟡 **Gold background** in dropdown
|
|
- Yellow gradient highlight
|
|
- Border accent
|
|
|
|
### Transaction Types
|
|
- **Deposit**: Green badge
|
|
- **Withdrawal**: Red badge
|
|
- **Purchase**: Blue badge
|
|
- **Sale**: Purple badge
|
|
- **Trade**: Yellow badge
|
|
- **Bonus**: Pink badge
|
|
- **Refund**: Orange badge
|
|
|
|
### Item Rarity
|
|
- Common: Gray
|
|
- Uncommon: Green
|
|
- Rare: Blue
|
|
- Mythical: Purple
|
|
- Legendary: Pink
|
|
- Ancient: Red
|
|
- Exceedingly: Yellow
|
|
|
|
## 🚨 Quick Alerts
|
|
|
|
### When to Act
|
|
|
|
**Immediate**:
|
|
- Failed withdrawals
|
|
- Negative net profit
|
|
- Security alerts
|
|
- API errors
|
|
|
|
**Soon**:
|
|
- Low price coverage (<50%)
|
|
- Unusual transaction patterns
|
|
- High refund rate
|
|
- Missing market data
|
|
|
|
**Eventually**:
|
|
- Items without views
|
|
- Stale listings (>30 days)
|
|
- Inactive users with balance
|
|
- Price discrepancies
|
|
|
|
## 📞 Help
|
|
|
|
### Diagnostic Commands
|
|
```bash
|
|
# Check everything
|
|
node check-prices.js
|
|
|
|
# Test API
|
|
node test-steam-api.js
|
|
|
|
# View MongoDB
|
|
mongosh turbotrades
|
|
db.items.countDocuments()
|
|
db.transactions.countDocuments()
|
|
```
|
|
|
|
### Logs to Check
|
|
- Backend console output
|
|
- Browser dev console (F12)
|
|
- MongoDB logs
|
|
- API error responses
|
|
|
|
### Files to Review
|
|
- `.env` - Configuration
|
|
- `ADMIN_PANEL.md` - Full documentation
|
|
- `PRICING_SYSTEM.md` - Price details
|
|
- `SESSION_PILLS_AND_TRANSACTIONS.md` - Transaction system
|
|
|
|
## ✅ Success Checklist
|
|
|
|
- [x] Admin panel accessible at `/admin`
|
|
- [x] Gold admin menu in dropdown
|
|
- [x] Financial tab tracking profit
|
|
- [x] Transactions tab with filters
|
|
- [x] Items tab with price overrides
|
|
- [x] CS2/Rust separation working
|
|
- [x] Automatic price updates (hourly)
|
|
- [x] 73.7% CS2 price coverage
|
|
- [x] Steam API connected (29,602 prices)
|
|
- [x] All tabs loading correctly
|
|
|
|
## 🎉 You're Ready!
|
|
|
|
Everything is configured and working. Navigate to `/admin` and start managing your marketplace!
|
|
|
|
---
|
|
|
|
**Quick Links**:
|
|
- Admin Panel: `http://localhost:5173/admin`
|
|
- Backend: `http://localhost:3000`
|
|
- MongoDB: `mongodb://localhost:27017/turbotrades`
|
|
- SteamAPIs: `https://steamapis.com/`
|
|
|
|
**Support**: Check `ADMIN_PANEL.md` for detailed documentation |