fix: add missing GET handler for player purchases
Game client loads purchases via GET /player/:steamId/purchases on game start but only the POST handler existed, causing 404. Added GET handler that returns item_ids from the purchases table. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -93,6 +93,13 @@ route('player/:steamId/currency/give', ['POST'], (ctx: HandlerContext) => {
|
|||||||
return { success: true };
|
return { success: true };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// GET /player/:steamId/purchases — Get purchase history
|
||||||
|
route('player/:steamId/purchases', ['GET'], (ctx: HandlerContext) => {
|
||||||
|
const db = getDb();
|
||||||
|
const rows = db.prepare('SELECT item_id FROM purchases WHERE steam_id = ? ORDER BY created_at DESC').all(ctx.params.steamId) as any[];
|
||||||
|
return { purchases: rows.map(r => r.item_id) };
|
||||||
|
});
|
||||||
|
|
||||||
// POST /player/:steamId/purchases — Record a store purchase
|
// POST /player/:steamId/purchases — Record a store purchase
|
||||||
route('player/:steamId/purchases', ['POST'], (ctx: HandlerContext) => {
|
route('player/:steamId/purchases', ['POST'], (ctx: HandlerContext) => {
|
||||||
const { item_id, item_category, card_id, price_free, price_donate, price_dust } = ctx.body as any;
|
const { item_id, item_category, card_id, price_free, price_donate, price_dust } = ctx.body as any;
|
||||||
|
|||||||
Reference in New Issue
Block a user