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

Function getReference

apps/api/src/controllers/manage.controller.ts:444–470  ·  view source on GitHub ↗
(
  request: FastifyRequest<{ Params: { id: string } }>,
  reply: FastifyReply
)

Source from the content-addressed store, hash-verified

442}
443
444export async function getReference(
445 request: FastifyRequest<{ Params: { id: string } }>,
446 reply: FastifyReply
447) {
448 const reference = await db.reference.findUnique({
449 where: {
450 id: request.params.id,
451 },
452 include: {
453 project: {
454 select: {
455 organizationId: true,
456 },
457 },
458 },
459 });
460
461 if (!reference) {
462 throw new HttpError('Reference not found', { status: 404 });
463 }
464
465 if (reference.project.organizationId !== request.client!.organizationId) {
466 throw new HttpError('Reference not found', { status: 404 });
467 }
468
469 reply.send({ data: reference });
470}
471
472export async function createReference(
473 request: FastifyRequest<{ Body: z.infer<typeof zCreateReference> }>,

Callers

nothing calls this directly

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected