MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getProfile

Function getProfile

apps/api/src/controllers/insights.controller.ts:534–544  ·  view source on GitHub ↗
(
  req: FastifyRequest<{ Params: { projectId?: string; profileId: string }; Querystring: z.infer<typeof zGetProfileQuery> }>,
  reply: FastifyReply
)

Source from the content-addressed store, hash-verified

532export const zGetProfileQuery = z.object({ eventLimit: z.number().int().min(1).max(100).default(20) });
533
534export async function getProfile(
535 req: FastifyRequest<{ Params: { projectId?: string; profileId: string }; Querystring: z.infer<typeof zGetProfileQuery> }>,
536 reply: FastifyReply
537) {
538 const projectId = await getProjectId(req as RequestWithProjectParam);
539 const result = await getProfileWithEvents(projectId, req.params.profileId, req.query.eventLimit);
540 if (!result.profile) {
541 return reply.status(404).send({ error: 'Profile not found', profileId: req.params.profileId });
542 }
543 return reply.send({ profile: result.profile, recentEvents: result.recent_events });
544}
545
546export const zProfileSessionsQuery = z.object({ limit: z.number().int().min(1).max(100).default(20) });
547

Callers

nothing calls this directly

Calls 3

getProfileWithEventsFunction · 0.90
getProjectIdFunction · 0.70
sendMethod · 0.45

Tested by

no test coverage detected