mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-10 02:43:24 +00:00
Remove unused heartbeat endpoint and storage method
- Removed PUT /offers/:offerId/heartbeat endpoint - Removed updateOfferLastSeen() from storage interface and implementations - last_seen column is still in DB but not used for cleanup - Cleanup only uses expires_at, so heartbeat was non-functional 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
33
src/app.ts
33
src/app.ts
@@ -314,39 +314,6 @@ export function createApp(storage: Storage, config: Config) {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* PUT /offers/:offerId/heartbeat
|
||||
* Update last_seen timestamp for an offer
|
||||
* Requires authentication and ownership
|
||||
*/
|
||||
app.put('/offers/:offerId/heartbeat', authMiddleware, async (c) => {
|
||||
try {
|
||||
const offerId = c.req.param('offerId');
|
||||
const peerId = getAuthenticatedPeerId(c);
|
||||
|
||||
// Verify ownership
|
||||
const offer = await storage.getOfferById(offerId);
|
||||
if (!offer) {
|
||||
return c.json({ error: 'Offer not found or expired' }, 404);
|
||||
}
|
||||
|
||||
if (offer.peerId !== peerId) {
|
||||
return c.json({ error: 'Not authorized to update this offer' }, 403);
|
||||
}
|
||||
|
||||
const now = Date.now();
|
||||
await storage.updateOfferLastSeen(offerId, now);
|
||||
|
||||
return c.json({
|
||||
id: offerId,
|
||||
lastSeen: now
|
||||
}, 200);
|
||||
} catch (err) {
|
||||
console.error('Error updating offer heartbeat:', err);
|
||||
return c.json({ error: 'Internal server error' }, 500);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* DELETE /offers/:offerId
|
||||
* Delete a specific offer
|
||||
|
||||
Reference in New Issue
Block a user