Skip to content
Discussion options

You must be logged in to vote

I would definitely recommend going to the docs before using anything like ChatGPT.

What you're looking for is the Local API's create function. Here's some psuedo-code for you to work from:

// Inside hook
await req.payload.create({
  collection: "activity", // Activity collection slug
  data: {
      timestamp: new Date(),
      type: operation === 'create' ? 'added' : 'updated',
      relatedItem: doc.id, // Relation field to current collection 
      user: doc.author,  // Relation field to user collection
    },
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nicholas-mercer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants