From 4690cf92d97af78fa0a703a47476c909c7e24ba8 Mon Sep 17 00:00:00 2001 From: Hintents Developer Date: Thu, 25 Jun 2026 05:42:01 -0700 Subject: [PATCH] feat: add recent users API endpoint for latest registrations --- stellar-payment-platform/server.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/stellar-payment-platform/server.js b/stellar-payment-platform/server.js index 7f6b26d..122b2cc 100644 --- a/stellar-payment-platform/server.js +++ b/stellar-payment-platform/server.js @@ -373,6 +373,22 @@ app.get('/users', async (req, res, next) => { } }); +app.get('/api/v1/users/recent', async (_req, res, next) => { + try { + const recentUsers = await prisma.user.findMany({ + select: { username: true, address: true }, + orderBy: { createdAt: 'desc' }, + take: 5, + }); + + return res.status(200).json(recentUsers); + } catch { + const recentError = new Error('Failed to fetch recent users'); + recentError.statusCode = 500; + return next(recentError); + } +}); + app.get('/.well-known/stellar.toml', cors({ origin: '*' }), (_req, res) => { res.setHeader('Content-Type', 'text/plain'); res.send('FEDERATION_SERVER="https://stellar-tags-production.up.railway.app/federation"\n');