MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / create

Function create

apps/app-server/src/trpc/api/pages/backlinks/create.ts:18–48  ·  view source on GitHub ↗
({
  ctx,
  input,
}: InferProcedureOpts<typeof baseProcedure>)

Source from the content-addressed store, hash-verified

16export const createProcedure = once(() => baseProcedure.mutation(create));
17
18export async function create({
19 ctx,
20 input,
21}: InferProcedureOpts<typeof baseProcedure>) {
22 // Check if user has sufficient permissions
23
24 const [sourceGroupId, targetGroupId] = await ctx.dataAbstraction.mhget([
25 hget('page', input.sourcePageId, 'group-id'),
26 hget('page', input.targetPageId, 'group-id'),
27 ]);
28
29 await ctx.assertSufficientGroupPermissions({
30 userId: ctx.userId,
31 groupId: sourceGroupId,
32 permission: 'editGroupPages',
33 });
34
35 await ctx.assertSufficientGroupPermissions({
36 userId: ctx.userId,
37 groupId: targetGroupId,
38 permission: 'editGroupPages',
39 });
40
41 // Create page link
42
43 await addPageBacklink({
44 targetPageId: input.targetPageId,
45 sourcePageId: input.sourcePageId,
46 dataAbstraction: ctx.dataAbstraction,
47 });
48}

Callers

nothing calls this directly

Calls 3

hgetFunction · 0.90
addPageBacklinkFunction · 0.90
mhgetMethod · 0.45

Tested by

no test coverage detected