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

Function createReference

apps/api/src/controllers/manage.controller.ts:472–500  ·  view source on GitHub ↗
(
  request: FastifyRequest<{ Body: z.infer<typeof zCreateReference> }>,
  reply: FastifyReply
)

Source from the content-addressed store, hash-verified

470}
471
472export async function createReference(
473 request: FastifyRequest<{ Body: z.infer<typeof zCreateReference> }>,
474 reply: FastifyReply
475) {
476 const { projectId, title, description, datetime } = request.body;
477
478 // Verify project belongs to organization
479 const project = await db.project.findFirst({
480 where: {
481 id: projectId,
482 organizationId: request.client!.organizationId,
483 },
484 });
485
486 if (!project) {
487 throw new HttpError('Project not found', { status: 404 });
488 }
489
490 const reference = await db.reference.create({
491 data: {
492 projectId,
493 title,
494 description: description || null,
495 date: new Date(datetime),
496 },
497 });
498
499 reply.send({ data: reference });
500}
501
502export async function updateReference(
503 request: FastifyRequest<{

Callers

nothing calls this directly

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected