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

Function deleteReference

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

Source from the content-addressed store, hash-verified

552}
553
554export async function deleteReference(
555 request: FastifyRequest<{ Params: { id: string } }>,
556 reply: FastifyReply
557) {
558 const reference = await db.reference.findUnique({
559 where: {
560 id: request.params.id,
561 },
562 include: {
563 project: {
564 select: {
565 organizationId: true,
566 },
567 },
568 },
569 });
570
571 if (!reference) {
572 throw new HttpError('Reference not found', { status: 404 });
573 }
574
575 if (reference.project.organizationId !== request.client!.organizationId) {
576 throw new HttpError('Reference not found', { status: 404 });
577 }
578
579 await db.reference.delete({
580 where: {
581 id: request.params.id,
582 },
583 });
584
585 reply.send({ success: true });
586}

Callers

nothing calls this directly

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected