Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
title,
content,
published: false,
author: {
connect: { email: authorEmail },
},
},
})
},
})
t.field('publish', {
type: 'Post',
nullable: true,
args: {
id: idArg(),
},
resolve: (_, { id }, ctx) => {
return ctx.photon.posts.update({
where: { id },
data: { published: true },
})
},
})
},
})
},
{
content: {
contains: searchString,
},
},
],
},
})
},
})
t.field('post', {
type: 'Post',
nullable: true,
args: { id: idArg() },
resolve: (parent, { id }, ctx) => {
return ctx.photon.posts.findOne({
where: {
id,
},
})
},
})
},
})
}
})
.decks();
return ctx.photon.users.findOne({
where: {
email: whoAmI.email
}
});
}
});
t.field('singleDeck', {
type: 'Deck',
nullable: true,
args: { id: idArg() },
resolve: (_parent, { id }, ctx) => {
return ctx.photon.decks.findOne({
where: {
id
}
});
}
});
t.list.field('feedUsers', {
type: 'User',
resolve: (_parent, _args, ctx) => {
return ctx.photon.users.findMany();
}
});
const userId = getUserId(ctx)
return ctx.photon.posts.create({
data: {
title,
content,
published: false,
author: { connect: { id: userId } },
},
})
},
})
t.field('deletePost', {
type: 'Post',
nullable: true,
args: { id: idArg() },
resolve: (parent, { id }, ctx) => {
return ctx.photon.posts.delete({
where: {
id,
},
})
},
})
t.field('publish', {
type: 'Post',
nullable: true,
args: { id: idArg() },
resolve: (parent, { id }, ctx) => {
return ctx.photon.posts.update({
where: { id },
const userId = getUserId(ctx)
return ctx.photon.posts.create({
data: {
title,
content,
published: false,
author: { connect: { id: userId } },
},
})
},
})
t.field('deletePost', {
type: 'Post',
nullable: true,
args: { id: idArg() },
resolve: (parent, { id }, ctx) => {
return ctx.photon.posts.delete({
where: {
id,
},
})
},
})
t.field('publish', {
type: 'Post',
nullable: true,
args: { id: idArg() },
resolve: (parent, { id }, ctx) => {
return ctx.photon.posts.update({
where: { id },
type: 'Resource',
args: {
resourceId: idArg({ required: true }),
data: arg({ type: 'UpdateResourceInput', required: true }),
},
resolve: updateResource,
})
/*
* ATTRIBUTE
*/
t.field('createAttribute', {
type: 'Attribute',
args: {
parentId: idArg({ required: true }),
},
resolve: createAttribute,
})
t.field('updateAttribute', {
type: 'Attribute',
args: {
attributeId: idArg({ required: true }),
data: arg({ type: 'UpdateAttributeInput', required: true }),
},
resolve: updateAttribute,
})
t.field('deleteAttribute', {
type: 'Attribute',
args: {