add: working JSON data insert

This commit is contained in:
Dominik Natter
2025-03-27 14:44:28 +01:00
parent 47dda68f07
commit c6ca892187

View File

@@ -9,6 +9,7 @@ export const Papers: CollectionConfig = {
access: { access: {
create: ({ req: { user } }) => Boolean(user?.type === "admin"), create: ({ req: { user } }) => Boolean(user?.type === "admin"),
delete: ({ req: { user } }) => Boolean(user?.type === "admin"), delete: ({ req: { user } }) => Boolean(user?.type === "admin"),
read: () => true,
update: async ({ req: { user, payload }, id }) => { update: async ({ req: { user, payload }, id }) => {
if (user?.type === "admin") return true; if (user?.type === "admin") return true;
@@ -22,7 +23,7 @@ export const Papers: CollectionConfig = {
if (!paper) return false; if (!paper) return false;
return paper.authors.some((author: any) => author.user.name === user.name); return paper.authors.some((author: any) => author.name === user.name);
}, },
}, },
admin: { admin: {