Showing
9 changed files
with
0 additions
and
74 deletions
back/src/api/Category/Category.js
deleted
100644 → 0
1 | -import { prisma, isAuthenticated } from "../../../utils"; | ||
2 | -import { NEW_CATEGORY } from "../../../topics"; | ||
3 | - | ||
4 | -export default { | ||
5 | - Mutation: { | ||
6 | - addCategory: async (_, args, { request, pubsub }) => { | ||
7 | - isAuthenticated(request); | ||
8 | - const { name } = args; | ||
9 | - const newCategory = await prisma.category.create({ | ||
10 | - data: { | ||
11 | - name, | ||
12 | - }, | ||
13 | - }); | ||
14 | - if (newCategory !== undefined) { | ||
15 | - pubsub.publish(NEW_CATEGORY, { subCategory: newCategory }); | ||
16 | - } | ||
17 | - return newCategory; | ||
18 | - }, | ||
19 | - }, | ||
20 | -}; |
-
Please register or login to post a comment