Implement recent checks API endpoint for dashboard
- Replace placeholder implementation with real database query - Add cross-project checks retrieval for authenticated users - Include detailed check information with hops, timing, and metadata - Add proper database joins across checks → projects → organizations → memberships - Format response to match frontend expectations - Rebuild API with updated implementation Fixes dashboard checks history display - now shows real tracking data instead of empty placeholder
This commit is contained in:
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"tracking.routes.d.ts","sourceRoot":"","sources":["../../src/routes/tracking.routes.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,MAAM,4CAAmB,CAAC;AAsZhC,eAAe,MAAM,CAAC"}
|
{"version":3,"file":"tracking.routes.d.ts","sourceRoot":"","sources":["../../src/routes/tracking.routes.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,MAAM,4CAAmB,CAAC;AAochC,eAAe,MAAM,CAAC"}
|
||||||
57
apps/api/dist/routes/tracking.routes.js
vendored
57
apps/api/dist/routes/tracking.routes.js
vendored
@@ -264,17 +264,66 @@ router.get('/projects/:projectId/checks', auth_middleware_1.requireAuth, async (
|
|||||||
router.get('/checks/recent', auth_middleware_1.requireAuth, async (req, res) => {
|
router.get('/checks/recent', auth_middleware_1.requireAuth, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { limit = 20 } = req.query;
|
const { limit = 20 } = req.query;
|
||||||
const checks = await redirectTracker.listChecks('anonymous-project', Number(limit), 0);
|
const userId = req.user.id;
|
||||||
|
const checks = await prisma_1.prisma.check.findMany({
|
||||||
|
where: {
|
||||||
|
project: {
|
||||||
|
organization: {
|
||||||
|
memberships: {
|
||||||
|
some: {
|
||||||
|
userId: userId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
project: {
|
||||||
|
select: {
|
||||||
|
name: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hops: {
|
||||||
|
orderBy: {
|
||||||
|
hopIndex: 'asc'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
startedAt: 'desc'
|
||||||
|
},
|
||||||
|
take: Number(limit)
|
||||||
|
});
|
||||||
|
const formattedChecks = checks.map(check => ({
|
||||||
|
id: check.id,
|
||||||
|
inputUrl: check.inputUrl,
|
||||||
|
finalUrl: check.finalUrl,
|
||||||
|
method: check.method,
|
||||||
|
status: check.status,
|
||||||
|
startedAt: check.startedAt,
|
||||||
|
finishedAt: check.finishedAt,
|
||||||
|
totalTimeMs: check.totalTimeMs,
|
||||||
|
redirectCount: check.hops.length,
|
||||||
|
projectName: check.project.name,
|
||||||
|
hops: check.hops.map(hop => ({
|
||||||
|
hopIndex: hop.hopIndex,
|
||||||
|
url: hop.url,
|
||||||
|
statusCode: hop.statusCode,
|
||||||
|
redirectType: hop.redirectType,
|
||||||
|
latencyMs: hop.latencyMs,
|
||||||
|
contentType: hop.contentType
|
||||||
|
}))
|
||||||
|
}));
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
status: 200,
|
status: 200,
|
||||||
data: {
|
data: {
|
||||||
checks,
|
checks: formattedChecks
|
||||||
message: 'Cross-project recent checks will be implemented in a future phase'
|
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
version: 'v2',
|
version: 'v2',
|
||||||
userId: req.user.id,
|
userId: userId,
|
||||||
|
total: formattedChecks.length
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
2
apps/api/dist/routes/tracking.routes.js.map
vendored
2
apps/api/dist/routes/tracking.routes.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -3226,3 +3226,66 @@
|
|||||||
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:52:57.822Z","url":"/v2/analyze/check/cmeoofb3e00012go3vwe870xw"}
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:52:57.822Z","url":"/v2/analyze/check/cmeoofb3e00012go3vwe870xw"}
|
||||||
{"contentLength":"1280","duration":36,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********115","x-forwarded-proto":"*****","x-real-ip":"162*********115"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T19:52:57.855Z","url":"/v2/track/cmeoofb3e00012go3vwe870xw","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
{"contentLength":"1280","duration":36,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********115","x-forwarded-proto":"*****","x-real-ip":"162*********115"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T19:52:57.855Z","url":"/v2/track/cmeoofb3e00012go3vwe870xw","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
{"contentLength":"7103","duration":35,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********115","x-forwarded-proto":"*****","x-real-ip":"162*********115"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T19:52:57.857Z","url":"/v2/analyze/check/cmeoofb3e00012go3vwe870xw","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
{"contentLength":"7103","duration":35,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********115","x-forwarded-proto":"*****","x-real-ip":"162*********115"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T19:52:57.857Z","url":"/v2/analyze/check/cmeoofb3e00012go3vwe870xw","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:54:41.452Z","url":"/v2/checks/recent?limit=20"}
|
||||||
|
{"contentLength":"189","duration":27,"headers":{"accept":"*/*","cookie":"aut**********htI","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T19:54:41.478Z","url":"/v2/checks/recent?limit=20","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:56:35.653Z","url":"/api/v1/auth/login"}
|
||||||
|
{"level":"info","message":"Login attempt for email: andrei@cloudz.ro","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:56:35.659Z"}
|
||||||
|
{"level":"warn","message":"Login failed: Invalid password for email andrei@cloudz.ro","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:56:35.995Z"}
|
||||||
|
{"level":"warn","message":"Login failed: Invalid credentials","service":"redirect-intelligence-api","stack":"Error: Invalid credentials\n at AuthService.login (/root/catch_redirect/apps/api/dist/services/auth.service.js:90:19)\n at async /root/catch_redirect/apps/api/dist/routes/auth.routes.js:47:33","timestamp":"2025-08-23T19:56:35.996Z"}
|
||||||
|
{"contentLength":"72","duration":346,"headers":{"accept":"*/*","content-length":"56","content-type":"application/json","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"POST","service":"redirect-intelligence-api","statusCode":400,"timestamp":"2025-08-23T19:56:35.998Z","url":"/api/v1/auth/login","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:57:38.343Z","url":"/v2/checks/recent?limit=20"}
|
||||||
|
{"contentLength":"189","duration":16,"headers":{"accept":"*/*","authorization":"Bea**********yVY","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T19:57:38.359Z","url":"/v2/checks/recent?limit=20","userAgent":"curl/7.81.0"}
|
||||||
|
{"level":"info","message":"SIGTERM received, shutting down gracefully","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:58:47.445Z"}
|
||||||
|
{"level":"info","message":"🚀 Redirect Intelligence v2 API Server running on http://localhost:3334","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:58:50.606Z"}
|
||||||
|
{"level":"info","message":"📖 API Documentation: http://localhost:3334/api/docs","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:58:50.612Z"}
|
||||||
|
{"level":"info","message":"🏥 Health Check: http://localhost:3334/health","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:58:50.613Z"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:58:57.575Z","url":"/health"}
|
||||||
|
{"contentLength":"100","duration":15,"headers":{"accept":"*/*","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T19:58:57.588Z","url":"/health","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:59:07.663Z","url":"/v2/checks/recent?limit=5"}
|
||||||
|
{"contentLength":"189","duration":148,"headers":{"accept":"*/*","authorization":"Bea**********yVY","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T19:59:07.810Z","url":"/v2/checks/recent?limit=5","userAgent":"curl/7.81.0"}
|
||||||
|
{"level":"info","message":"SIGTERM received, shutting down gracefully","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:59:30.937Z"}
|
||||||
|
{"level":"info","message":"🚀 Redirect Intelligence v2 API Server running on http://localhost:3334","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:59:33.987Z"}
|
||||||
|
{"level":"info","message":"📖 API Documentation: http://localhost:3334/api/docs","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:59:33.992Z"}
|
||||||
|
{"level":"info","message":"🏥 Health Check: http://localhost:3334/health","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:59:33.992Z"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:59:41.070Z","url":"/health"}
|
||||||
|
{"contentLength":"100","duration":16,"headers":{"accept":"*/*","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T19:59:41.083Z","url":"/health","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T19:59:50.422Z","url":"/v2/checks/recent?limit=5"}
|
||||||
|
{"contentLength":"6817","duration":193,"headers":{"accept":"*/*","authorization":"Bea**********yVY","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T19:59:50.614Z","url":"/v2/checks/recent?limit=5","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:00:25.123Z","url":"/api/v1/auth/me"}
|
||||||
|
{"duration":19,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********.45","x-forwarded-proto":"*****","x-real-ip":"162********.45"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":304,"timestamp":"2025-08-23T20:00:25.140Z","url":"/api/v1/auth/me","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:00:25.328Z","url":"/v2/checks/recent?limit=20"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:00:25.331Z","url":"/v2/projects"}
|
||||||
|
{"contentLength":"10961","duration":43,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********.45","x-forwarded-proto":"*****","x-real-ip":"162********.45"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:00:25.370Z","url":"/v2/checks/recent?limit=20","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
|
{"contentLength":"298","duration":163,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********.45","x-forwarded-proto":"*****","x-real-ip":"162********.45"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:00:25.493Z","url":"/v2/projects","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:00:29.536Z","url":"/v2/analyze/check/cmeoofb3e00012go3vwe870xw"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:00:29.541Z","url":"/v2/track/cmeoofb3e00012go3vwe870xw"}
|
||||||
|
{"duration":22,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********.45","x-forwarded-proto":"*****","x-real-ip":"162********.45"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":304,"timestamp":"2025-08-23T20:00:29.563Z","url":"/v2/track/cmeoofb3e00012go3vwe870xw","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
|
{"contentLength":"7103","duration":30,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********.45","x-forwarded-proto":"*****","x-real-ip":"162********.45"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:00:29.565Z","url":"/v2/analyze/check/cmeoofb3e00012go3vwe870xw","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:01:10.219Z","url":"/v2/projects"}
|
||||||
|
{"contentLength":"298","duration":18,"headers":{"accept":"*/*","authorization":"Bea**********yVY","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:01:10.237Z","url":"/v2/projects","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:01:17.345Z","url":"/v2/projects/cmeizda0t000kxqf4v8hnhqxt/checks?limit=5"}
|
||||||
|
{"contentLength":"20075","duration":25,"headers":{"accept":"*/*","authorization":"Bea**********yVY","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:01:17.370Z","url":"/v2/projects/cmeizda0t000kxqf4v8hnhqxt/checks?limit=5","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:02:12.759Z","url":"/v2/track/cmeoofb3e00012go3vwe870xw"}
|
||||||
|
{"contentLength":"1280","duration":19,"headers":{"accept":"*/*","authorization":"Bea**********yVY","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:02:12.777Z","url":"/v2/track/cmeoofb3e00012go3vwe870xw","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:02:35.662Z","url":"/v2/projects/cmeizda0t000kxqf4v8hnhqxt"}
|
||||||
|
{"contentLength":"3784","duration":26,"headers":{"accept":"*/*","authorization":"Bea**********yVY","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:02:35.689Z","url":"/v2/projects/cmeizda0t000kxqf4v8hnhqxt","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:02:50.416Z","url":"/v2/analyze/comprehensive"}
|
||||||
|
{"level":"info","message":"Starting comprehensive analysis for: https://google.com","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:02:50.443Z","userId":"cmeizda0i000fxqf4mysy7x6m"}
|
||||||
|
{"level":"info","message":"Starting SSL analysis for: google.com:443","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:02:50.444Z"}
|
||||||
|
{"level":"info","message":"Starting SEO analysis for: https://google.com","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:02:50.537Z"}
|
||||||
|
{"level":"info","message":"Starting security analysis for: https://google.com","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:02:50.558Z"}
|
||||||
|
{"daysToExpiry":36,"level":"info","message":"SSL analysis completed for: google.com:443","securityScore":75,"service":"redirect-intelligence-api","timestamp":"2025-08-23T20:02:50.656Z","valid":true}
|
||||||
|
{"headersScore":15,"level":"info","message":"Security analysis completed for: https://google.com","mixedContent":"PRESENT","safeBrowsing":"safe","score":65,"service":"redirect-intelligence-api","timestamp":"2025-08-23T20:02:51.043Z"}
|
||||||
|
{"hasTitle":true,"level":"info","message":"SEO analysis completed for: https://google.com","noindex":false,"robotsStatus":"found","score":72,"service":"redirect-intelligence-api","timestamp":"2025-08-23T20:02:51.046Z"}
|
||||||
|
{"level":"info","message":"Comprehensive analysis completed for: https://google.com","overallScore":71,"securitySuccess":true,"seoSuccess":true,"service":"redirect-intelligence-api","sslSuccess":true,"timestamp":"2025-08-23T20:02:51.047Z","userId":"cmeizda0i000fxqf4mysy7x6m"}
|
||||||
|
{"contentLength":"7321","duration":633,"headers":{"accept":"*/*","authorization":"Bea**********yVY","content-length":"29","content-type":"application/json","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"POST","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:02:51.048Z","url":"/v2/analyze/comprehensive","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:03:19.712Z","url":"/v2/analyze/check/cmeoofb3e00012go3vwe870xw"}
|
||||||
|
{"contentLength":"7103","duration":29,"headers":{"accept":"*/*","authorization":"Bea**********yVY","host":"localhost:3334","user-agent":"cur*****1.0"},"ip":"::ffff:127.0.0.1","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:03:19.740Z","url":"/v2/analyze/check/cmeoofb3e00012go3vwe870xw","userAgent":"curl/7.81.0"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:04:14.626Z","url":"/v2/analyze/check/cmej4gz4l0008o5ddkn23ngtk"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:04:14.632Z","url":"/v2/track/cmej4gz4l0008o5ddkn23ngtk"}
|
||||||
|
{"contentLength":"900","duration":23,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********221","x-forwarded-proto":"*****","x-real-ip":"172********221"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:04:14.649Z","url":"/v2/analyze/check/cmej4gz4l0008o5ddkn23ngtk","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
|
{"contentLength":"777","duration":21,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********221","x-forwarded-proto":"*****","x-real-ip":"172********221"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:04:14.652Z","url":"/v2/track/cmej4gz4l0008o5ddkn23ngtk","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:04:36.708Z","url":"/v2/track/cmej4hi4q000bo5ddeox6i6vw"}
|
||||||
|
{"error":"Invalid URL","level":"warn","message":"Failed to parse URL for redaction:","service":"redirect-intelligence-api","timestamp":"2025-08-23T20:04:36.713Z","url":"/v2/analyze/check/cmej4hi4q000bo5ddeox6i6vw"}
|
||||||
|
{"contentLength":"5041","duration":18,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********221","x-forwarded-proto":"*****","x-real-ip":"172********221"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:04:36.726Z","url":"/v2/track/cmej4hi4q000bo5ddeox6i6vw","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
|
{"contentLength":"5380","duration":20,"headers":{"accept":"application/json, text/plain, */*","accept-encoding":"gzip, br","accept-language":"en-GB,en;q=0.9","cf-connecting-ip":"83.******.45","cookie":"_ga**********$h0","host":"api.urltrackertool.com","origin":"htt**********com","referer":"htt**********om/","user-agent":"Moz**********.36","x-forwarded-for":"83.**********221","x-forwarded-proto":"*****","x-real-ip":"172********221"},"ip":"::ffff:10.0.0.5","level":"info","message":"Request completed","method":"GET","service":"redirect-intelligence-api","statusCode":200,"timestamp":"2025-08-23T20:04:36.733Z","url":"/v2/analyze/check/cmej4hi4q000bo5ddeox6i6vw","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}
|
||||||
|
|||||||
@@ -350,25 +350,71 @@ router.get('/checks/recent',
|
|||||||
async (req: AuthenticatedRequest, res) => {
|
async (req: AuthenticatedRequest, res) => {
|
||||||
try {
|
try {
|
||||||
const { limit = 20 } = req.query;
|
const { limit = 20 } = req.query;
|
||||||
|
const userId = req.user!.id;
|
||||||
|
|
||||||
// TODO: Implement cross-project recent checks in future phases
|
// Get all checks for the user across all their projects
|
||||||
// For Phase 2, return checks from anonymous project as placeholder
|
const checks = await prisma.check.findMany({
|
||||||
const checks = await redirectTracker.listChecks(
|
where: {
|
||||||
'anonymous-project',
|
project: {
|
||||||
Number(limit),
|
organization: {
|
||||||
0
|
memberships: {
|
||||||
);
|
some: {
|
||||||
|
userId: userId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
project: {
|
||||||
|
select: {
|
||||||
|
name: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hops: {
|
||||||
|
orderBy: {
|
||||||
|
hopIndex: 'asc'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
startedAt: 'desc'
|
||||||
|
},
|
||||||
|
take: Number(limit)
|
||||||
|
});
|
||||||
|
|
||||||
|
// Format the checks to match the expected response format
|
||||||
|
const formattedChecks = checks.map(check => ({
|
||||||
|
id: check.id,
|
||||||
|
inputUrl: check.inputUrl,
|
||||||
|
finalUrl: check.finalUrl,
|
||||||
|
method: check.method,
|
||||||
|
status: check.status,
|
||||||
|
startedAt: check.startedAt,
|
||||||
|
finishedAt: check.finishedAt,
|
||||||
|
totalTimeMs: check.totalTimeMs,
|
||||||
|
redirectCount: check.hops.length,
|
||||||
|
projectName: check.project.name,
|
||||||
|
hops: check.hops.map(hop => ({
|
||||||
|
hopIndex: hop.hopIndex,
|
||||||
|
url: hop.url,
|
||||||
|
statusCode: hop.statusCode,
|
||||||
|
redirectType: hop.redirectType,
|
||||||
|
latencyMs: hop.latencyMs,
|
||||||
|
contentType: hop.contentType
|
||||||
|
}))
|
||||||
|
}));
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
status: 200,
|
status: 200,
|
||||||
data: {
|
data: {
|
||||||
checks,
|
checks: formattedChecks
|
||||||
message: 'Cross-project recent checks will be implemented in a future phase'
|
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
version: 'v2',
|
version: 'v2',
|
||||||
userId: req.user!.id,
|
userId: userId,
|
||||||
|
total: formattedChecks.length
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user